From owner-svn-src-all@freebsd.org Sun Nov 3 00:13:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6976D17BE3F; Sun, 3 Nov 2019 00:13:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Gc41FMcz4Nbr; Sun, 3 Nov 2019 00:13:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DFC736BC; Sun, 3 Nov 2019 00:13:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA30DNt5010428; Sun, 3 Nov 2019 00:13:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA30DNo9010427; Sun, 3 Nov 2019 00:13:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911030013.xA30DNo9010427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 3 Nov 2019 00:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354268 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 354268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 00:13:24 -0000 Author: mav Date: Sun Nov 3 00:13:23 2019 New Revision: 354268 URL: https://svnweb.freebsd.org/changeset/base/354268 Log: Remove lock from CTL camsim frontend. CAM does not need a SIM lock for quite a while, and CTL never needed it. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Nov 2 21:52:45 2019 (r354267) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Nov 3 00:13:23 2019 (r354268) @@ -46,12 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include #include #include +#include #include #include @@ -80,7 +77,6 @@ struct cfcs_softc { struct cam_sim *sim; struct cam_devq *devq; struct cam_path *path; - struct mtx lock; uint64_t wwnn; uint64_t wwpn; uint32_t cur_tag_num; @@ -135,7 +131,6 @@ cfcs_init(void) softc = &cfcs_softc; bzero(softc, sizeof(*softc)); - mtx_init(&softc->lock, "ctl2cam", NULL, MTX_DEF); port = &softc->port; port->frontend = &cfcs_frontend; @@ -155,7 +150,6 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_port_register() failed with error %d!\n", __func__, retval); - mtx_destroy(&softc->lock); return (retval); } @@ -177,7 +171,6 @@ cfcs_init(void) softc->wwpn = port->wwpn; } - mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(port->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -186,7 +179,7 @@ cfcs_init(void) } softc->sim = cam_sim_alloc(cfcs_action, cfcs_poll, softc->port_name, - softc, /*unit*/ 0, &softc->lock, 1, + softc, /*unit*/ 0, NULL, 1, port->num_requested_ctl_io, softc->devq); if (softc->sim == NULL) { printf("%s: error allocating SIM\n", __func__); @@ -210,8 +203,6 @@ cfcs_init(void) goto bailout; } - mtx_unlock(&softc->lock); - return (retval); bailout: @@ -219,9 +210,6 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); - return (retval); } @@ -234,12 +222,9 @@ cfcs_shutdown(void) ctl_port_offline(port); - mtx_lock(&softc->lock); xpt_free_path(softc->path); xpt_bus_deregister(cam_sim_path(softc->sim)); cam_sim_free(softc->sim, /*free_devq*/ TRUE); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); if ((error = ctl_port_deregister(port)) != 0) printf("%s: cam_sim port deregistration failed\n", __func__); @@ -255,18 +240,15 @@ cfcs_poll(struct cam_sim *sim) static void cfcs_onoffline(void *arg, int online) { - struct cfcs_softc *softc; + struct cfcs_softc *softc = (struct cfcs_softc *)arg; union ccb *ccb; - softc = (struct cfcs_softc *)arg; - - mtx_lock(&softc->lock); softc->online = online; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { printf("%s: unable to allocate CCB for rescan\n", __func__); - goto bailout; + return; } if (xpt_create_path(&ccb->ccb_h.path, NULL, @@ -274,12 +256,9 @@ cfcs_onoffline(void *arg, int online) CAM_LUN_WILDCARD) != CAM_REQ_CMP) { printf("%s: can't allocate path for rescan\n", __func__); xpt_free_ccb(ccb); - goto bailout; + return; } xpt_rescan(ccb); - -bailout: - mtx_unlock(&softc->lock); } static void @@ -493,13 +472,13 @@ cfcs_done(union ctl_io *io) ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; } + ctl_free_io(io); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && (ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; } xpt_done(ccb); - ctl_free_io(io); } void @@ -509,7 +488,6 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) int err; softc = (struct cfcs_softc *)cam_sim_softc(sim); - mtx_assert(&softc->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -569,7 +547,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) * enough for now. Since we're using unsigned ints, * they'll just wrap around. */ - io->scsiio.tag_num = softc->cur_tag_num++; + io->scsiio.tag_num = atomic_fetchadd_32(&softc->cur_tag_num, 1); csio->tag_id = io->scsiio.tag_num; switch (csio->tag_action) { case CAM_TAG_ACTION_NONE: @@ -775,13 +753,13 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) cpi->target_sprt = 0; cpi->hba_misc = PIM_EXTLUNS; cpi->hba_eng_cnt = 0; - cpi->max_target = 1; + cpi->max_target = 0; cpi->max_lun = 1024; /* Do we really have a limit? */ cpi->maxio = 1024 * 1024; cpi->async_flags = 0; cpi->hpath_id = 0; - cpi->initiator_id = 0; + cpi->initiator_id = 1; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN); From owner-svn-src-all@freebsd.org Sun Nov 3 01:26:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E02917E679; Sun, 3 Nov 2019 01:26:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475JCt3Yhjz4RQq; Sun, 3 Nov 2019 01:26:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59DCA447E; Sun, 3 Nov 2019 01:26:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA31Q2O2051376; Sun, 3 Nov 2019 01:26:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA31PkRR051360; Sun, 3 Nov 2019 01:25:46 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201911030125.xA31PkRR051360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 3 Nov 2019 01:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354269 - in head/contrib/sqlite3: . tea tea/generic X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/contrib/sqlite3: . tea tea/generic X-SVN-Commit-Revision: 354269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 01:26:02 -0000 Author: cy Date: Sun Nov 3 01:25:46 2019 New Revision: 354269 URL: https://svnweb.freebsd.org/changeset/base/354269 Log: MFV r354257: Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100) MFC after: 1 month Modified: head/contrib/sqlite3/Makefile.msc head/contrib/sqlite3/configure head/contrib/sqlite3/configure.ac head/contrib/sqlite3/shell.c head/contrib/sqlite3/sqlite3.c head/contrib/sqlite3/sqlite3.h head/contrib/sqlite3/sqlite3ext.h head/contrib/sqlite3/tea/configure head/contrib/sqlite3/tea/configure.ac head/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: head/contrib/sqlite3/ (props changed) Modified: head/contrib/sqlite3/Makefile.msc ============================================================================== --- head/contrib/sqlite3/Makefile.msc Sun Nov 3 00:13:23 2019 (r354268) +++ head/contrib/sqlite3/Makefile.msc Sun Nov 3 01:25:46 2019 (r354269) @@ -73,7 +73,7 @@ API_ARMOR = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF Modified: head/contrib/sqlite3/configure ============================================================================== --- head/contrib/sqlite3/configure Sun Nov 3 00:13:23 2019 (r354268) +++ head/contrib/sqlite3/configure Sun Nov 3 01:25:46 2019 (r354269) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.30.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.29.0' -PACKAGE_STRING='sqlite 3.29.0' +PACKAGE_VERSION='3.30.1' +PACKAGE_STRING='sqlite 3.30.1' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.29.0:";; + short | recursive ) echo "Configuration of sqlite 3.30.1:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.29.0 +sqlite configure 3.30.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.29.0, which was +It was created by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.29.0' + VERSION='3.30.1' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.29.0, which was +This file was extended by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.29.0 +sqlite config.status 3.30.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/configure.ac ============================================================================== --- head/contrib/sqlite3/configure.ac Sun Nov 3 00:13:23 2019 (r354268) +++ head/contrib/sqlite3/configure.ac Sun Nov 3 01:25:46 2019 (r354269) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.30.1, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: head/contrib/sqlite3/shell.c ============================================================================== --- head/contrib/sqlite3/shell.c Sun Nov 3 00:13:23 2019 (r354268) +++ head/contrib/sqlite3/shell.c Sun Nov 3 01:25:46 2019 (r354269) @@ -9801,12 +9801,12 @@ static void editFunc( } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ - x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; - x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; @@ -9834,12 +9834,12 @@ static void editFunc( fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); - p = sqlite3_malloc64( sz+(bBin==0) ); + p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } - x = fread(p, 1, sz, f); + x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ @@ -10311,7 +10311,8 @@ static void eqp_render_level(ShellState *p, int iEqpId for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); + utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, + pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -10502,7 +10503,7 @@ static int shell_callback( while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ - for(i=j=0; (c = z[i])!=0; i++){ /* Copy changes from z[i] back to z[j] */ + for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ @@ -11081,7 +11082,7 @@ static int display_stats( raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE, bReset); + iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); @@ -12004,20 +12005,20 @@ static const char *(azHelp[]) = { ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", - " -u, --update Add files or update files with changed mtime", - " -i, --insert Like -u but always add even if mtime unchanged", + " -u, --update Add or update files with changed mtime", + " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", - " -f FILE, --file FILE Operate on archive FILE (default is current db)", - " -a FILE, --append FILE Operate on FILE opened using the apndvfs VFS", - " -C DIR, --directory DIR Change to directory DIR to read/extract files", + " -f FILE, --file FILE Use archive FILE (default is current db)", + " -a FILE, --append FILE Open FILE using the apndvfs VFS", + " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", - " .ar -cf archive.sar foo bar # Create archive.sar from files foo and bar", - " .ar -tf archive.sar # List members of archive.sar", - " .ar -xvf archive.sar # Verbosely extract files from archive.sar", + " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", + " .ar -tf ARCHIVE # List members of ARCHIVE", + " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif @@ -12026,7 +12027,7 @@ static const char *(azHelp[]) = { #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", - " --async Write to FILE without a journal and without fsync()", + " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", @@ -12046,15 +12047,15 @@ static const char *(azHelp[]) = { " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", - " trace Like \"full\" but also enable \"PRAGMA vdbe_trace\"", + " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", - ".excel Display the output of next command in a spreadsheet", + ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", - ".expert EXPERIMENTAL. Suggest indexes for specified queries", + ".expert EXPERIMENTAL. Suggest indexes for queries", /* Because explain mode comes on automatically now, the ".explain" mode -** is removed from the help screen. It is still supported for legacy, however */ -/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ +** is removed from the help screen. It is still supported for legacy, however */ +/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/ ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", @@ -12101,7 +12102,7 @@ static const char *(azHelp[]) = { " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", - " --hexdb Load the output of \"dbtotxt\" as an in-memory database", + " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", @@ -12114,7 +12115,7 @@ static const char *(azHelp[]) = { " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", - " PARAMETER should start with '$', ':', '@', or '?'", + " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -12129,6 +12130,11 @@ static const char *(azHelp[]) = { ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", + " --freelist-corrupt Assume the freelist is corrupt", + " --recovery-db NAME Store recovery metadata in database file NAME", + " --lost-and-found TABLE Alternative name for the lost-and-found table", + " --no-rowids Do not attempt to recover rowid values", + " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", @@ -12160,7 +12166,7 @@ static const char *(azHelp[]) = { " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", - " --sha3-256 Use the sha3-256 algorithm. This is the default.", + " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", @@ -12194,6 +12200,10 @@ static const char *(azHelp[]) = { " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ +#ifdef SQLITE_DEBUG + ".unmodule NAME ... Unregister virtual table modules", + " --allexcept Unregister everything except those named", +#endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", @@ -12436,6 +12446,8 @@ static unsigned char *readHexDb(ShellState *p, int *pn rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; + if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; + n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); @@ -12521,6 +12533,23 @@ static void shellInt32( } /* +** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, +** using "..." with internal double-quote characters doubled. +*/ +static void shellIdQuote( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName = (const char*)sqlite3_value_text(argv[0]); + UNUSED_PARAMETER(argc); + if( zName ){ + char *z = sqlite3_mprintf("\"%w\"", zName); + sqlite3_result_text(context, z, -1, sqlite3_free); + } +} + +/* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", @@ -12696,6 +12725,8 @@ static void open_db(ShellState *p, int openFlags){ shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); + sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); @@ -14043,7 +14074,7 @@ void shellReset( #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) -/********************************************************************************* +/****************************************************************************** ** The ".archive" or ".ar" command. */ /* @@ -14241,7 +14272,8 @@ static int arParseCommand( i = n; }else{ if( iArg>=(nArg-1) ){ - return arErrorMsg(pAr, "option requires an argument: %c",z[i]); + return arErrorMsg(pAr, "option requires an argument: %c", + z[i]); } zArg = azArg[++iArg]; } @@ -14629,10 +14661,10 @@ end_ar_transaction: ** Implementation of ".ar" dot command. */ static int arDotCommand( - ShellState *pState, /* Current shell tool state */ - int fromCmdLine, /* True if -A command-line option, not .ar cmd */ - char **azArg, /* Array of arguments passed to dot command */ - int nArg /* Number of entries in azArg[] */ + ShellState *pState, /* Current shell tool state */ + int fromCmdLine, /* True if -A command-line option, not .ar cmd */ + char **azArg, /* Array of arguments passed to dot command */ + int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; @@ -14732,7 +14764,7 @@ end_ar_command: return rc; } /* End of the ".archive" or ".ar" command logic -**********************************************************************************/ +*******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) @@ -14874,6 +14906,10 @@ static RecoverTable *recoverNewTable( rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ + sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); + } + if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ @@ -14929,18 +14965,18 @@ static RecoverTable *recoverNewTable( } } - pTab->zQuoted = shellMPrintf(&rc, "%Q", zName); + pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ - pTab->azlCol[0] = shellMPrintf(&rc, "%Q", zPk); + pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, - "SELECT %Q || group_concat(name, ', ') " + "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, @@ -15054,7 +15090,7 @@ static RecoverTable *recoverOrphanTable( pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ - pTab->zQuoted = shellMPrintf(pRc, "%Q", zTab); + pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ @@ -15103,6 +15139,7 @@ static int recoverDatabaseCmd(ShellState *pState, int RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ + int bRowids = 1; /* 0 if --no-rowids */ for(i=1; iout, azArg[0]); return 1; } } @@ -15132,6 +15169,7 @@ static int recoverDatabaseCmd(ShellState *pState, int shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ + "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" @@ -15162,7 +15200,22 @@ static int recoverDatabaseCmd(ShellState *pState, int ); } + /* If this is an auto-vacuum database, add all pointer-map pages to + ** the freelist table. Do this regardless of whether or not + ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, + "WITH ptrmap(pgno) AS (" + " SELECT 2 WHERE shell_int32(" + " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" + " )" + " UNION ALL " + " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " + " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" + ")" + "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" + ); + + shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" @@ -15210,7 +15263,7 @@ static int recoverDatabaseCmd(ShellState *pState, int " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " - "FROM pages WHERE maxlen > 0 AND i NOT IN freelist;" + "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" @@ -15235,6 +15288,11 @@ static int recoverDatabaseCmd(ShellState *pState, int ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; + /* ".recover" might output content in an order which causes immediate + ** foreign key constraints to be violated. So disable foreign-key + ** constraint enforcement to prevent problems when running the output + ** script. */ + raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, @@ -15265,8 +15323,12 @@ static int recoverDatabaseCmd(ShellState *pState, int shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); + shellPrepare(pState->db, &rc, - "SELECT max(field), group_concat(shell_escape_crnl(quote(value)), ', ')" + "SELECT max(field), group_concat(shell_escape_crnl(quote" + "(case when (? AND field<0) then NULL else value end)" + "), ', ')" + ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); @@ -15285,6 +15347,7 @@ static int recoverDatabaseCmd(ShellState *pState, int int bNoop = 0; RecoverTable *pTab; + assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ @@ -15295,29 +15358,44 @@ static int recoverDatabaseCmd(ShellState *pState, int if( pTab==0 ) break; } - if( 0==sqlite3_stricmp(pTab->zQuoted, "'sqlite_sequence'") ){ + if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); - sqlite3_bind_int(pCells, 2, pTab->iPk); + if( bRowids==0 && pTab->iPk<0 ){ + sqlite3_bind_int(pCells, 1, 1); + }else{ + sqlite3_bind_int(pCells, 1, 0); + } + sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); - sqlite3_bind_int(pCells, 1, iPgno); + sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); + int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); + RecoverTable *pTab2 = pTab; + if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ + if( pOrphan==0 ){ + pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); + } + pTab2 = pOrphan; + if( pTab2==0 ) break; + } + nField = nField+1; - if( pTab==pOrphan ){ + if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", - pTab->zQuoted, iRoot, iPgno, nField, - bIntkey ? "" : "NULL, ", zVal, pTab->azlCol[nField] + pTab2->zQuoted, iRoot, iPgno, nField, + iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", - pTab->zQuoted, pTab->azlCol[nField], zVal + pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } @@ -15376,7 +15454,7 @@ static int do_meta_command(char *zLine, ShellState *p) int nArg = 0; int n, c; int rc = 0; - char *azArg[50]; + char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ @@ -15386,7 +15464,7 @@ static int do_meta_command(char *zLine, ShellState *p) /* Parse the input line into tokens. */ - while( zLine[h] && nArgout, "ANALYZE sqlite_master;\n"); @@ -16615,12 +16693,8 @@ static int do_meta_command(char *zLine, ShellState *p) ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ - int wrSchema = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); }else /* .parameter list @@ -16933,7 +17007,7 @@ static int do_meta_command(char *zLine, ShellState *p) zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } @@ -16942,15 +17016,16 @@ static int do_meta_command(char *zLine, ShellState *p) appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); -#ifdef SQLITE_INTROSPECTION_PRAGMAS +#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," - " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); + " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", + 0); } #endif appendText(&sSelect, ") WHERE ", 0); @@ -17049,7 +17124,8 @@ static int do_meta_command(char *zLine, ShellState *p) if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); + utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -17370,8 +17446,7 @@ static int do_meta_command(char *zLine, ShellState *p) { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --schema" - " --sha3-224 --sha3-256 --sha3-384 --sha3-512\n"); + showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } @@ -17417,8 +17492,7 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); - }else if( strcmp(zTab, "sqlite_stat3")==0 - || strcmp(zTab, "sqlite_stat4")==0 ){ + }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); @@ -17650,25 +17724,26 @@ static int do_meta_command(char *zLine, ShellState *p) int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { - { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, - { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, - /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ - /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ - { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, - /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */ - { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, - { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, - { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, - { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, + { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, + { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, + /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ + /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ + { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, + { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, + /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ + { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, + { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, + { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE - { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, + { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET, "" }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, - { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE" }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, + { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, + { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; @@ -17749,6 +17824,27 @@ static int do_meta_command(char *zLine, ShellState *p) } break; + /* sqlite3_test_control(int, int, sqlite3*) */ + case SQLITE_TESTCTRL_PRNG_SEED: + if( nArg==3 || nArg==4 ){ + int ii = (int)integerValue(azArg[2]); + sqlite3 *db; + if( ii==0 && strcmp(azArg[2],"random")==0 ){ + sqlite3_randomness(sizeof(ii),&ii); + printf("-- random seed: %d\n", ii); + } + if( nArg==3 ){ + db = 0; + }else{ + db = p->db; + /* Make sure the schema has been loaded */ + sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); + } + rc2 = sqlite3_test_control(testctrl, ii, db); + isOk = 3; + } + break; + /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: @@ -17790,7 +17886,7 @@ static int do_meta_command(char *zLine, ShellState *p) } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd, aCtrl[iCtrl].zUsage); + utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); @@ -17868,6 +17964,31 @@ static int do_meta_command(char *zLine, ShellState *p) }else #endif /* !defined(SQLITE_OMIT_TRACE) */ +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) + if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ + int ii; + int lenOpt; + char *zOpt; + if( nArg<2 ){ + raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + zOpt = azArg[1]; + if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; + lenOpt = (int)strlen(zOpt); + if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ + assert( azArg[nArg]==0 ); + sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); + }else{ + for(ii=1; iidb, azArg[ii], 0, 0); + } + } + }else +#endif + #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ @@ -17882,7 +18003,8 @@ static int do_meta_command(char *zLine, ShellState *p) rc = 1; goto meta_command_exit; } - rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); + rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], + strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; Modified: head/contrib/sqlite3/sqlite3.c ============================================================================== --- head/contrib/sqlite3/sqlite3.c Sun Nov 3 00:13:23 2019 (r354268) +++ head/contrib/sqlite3/sqlite3.c Sun Nov 3 01:25:46 2019 (r354269) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.29.0. By combining all the individual C code files into this +** version 3.30.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -331,8 +331,6 @@ static const char * const sqlite3azCompileOpt[] = { #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", #endif #if SQLITE_ENABLE_STMTVTAB "ENABLE_STMTVTAB", @@ -1167,9 +1165,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.29.0" -#define SQLITE_VERSION_NUMBER 3029000 -#define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" +#define SQLITE_VERSION "3.30.1" +#define SQLITE_VERSION_NUMBER 3030001 +#define SQLITE_SOURCE_ID "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -3137,6 +3135,17 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. ** +** [[SQLITE_DBCONFIG_ENABLE_VIEW]] +**
SQLITE_DBCONFIG_ENABLE_VIEW
+**
^This option is used to enable or disable [CREATE VIEW | views]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable views, +** positive to enable views or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether views are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the view setting is not reported back.
+** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] **
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
**
^This option is used to enable or disable the @@ -3309,7 +3318,8 @@ struct sqlite3_mem_methods { #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ -#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ +#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes @@ -4858,7 +4868,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int new ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** ** ** @@ -5893,6 +5903,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** +** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] +** flag, which if present prevents the function from being invoked from +** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] +** flag is recommended for any application-defined SQL function that has +** side-effects. +** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** @@ -6009,8 +6025,30 @@ SQLITE_API int sqlite3_create_window_function( ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. +** +** The SQLITE_DETERMINISTIC flag means that the new function will always +** maps the same inputs into the same output. The abs() function is +** deterministic, for example, but randomblob() is not. +** +** The SQLITE_DIRECTONLY flag means that the function may only be invoked +** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is +** a security feature which is recommended for all +** [application-defined SQL functions] that have side-effects. This flag +** prevents an attacker from adding triggers and views to a schema then +** tricking a high-privilege application into causing unintended side-effects +** while performing ordinary queries. +** +** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** Specifying this flag makes no difference for scalar or aggregate user +** functions. However, if it is not specified for a user-defined window +** function, then any sub-types belonging to arguments passed to the window +** function may be discarded before the window function is called (i.e. +** sqlite3_value_subtype() will always return 0). */ -#define SQLITE_DETERMINISTIC 0x800 +#define SQLITE_DETERMINISTIC 0x000000800 +#define SQLITE_DIRECTONLY 0x000080000 +#define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions @@ -7656,6 +7694,12 @@ struct sqlite3_index_info { ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. +** +** ^If the third parameter (the pointer to the sqlite3_module object) is +** NULL then no new module is create and any existing modules with the +** same name are dropped. +** +** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ @@ -7672,6 +7716,23 @@ SQLITE_API int sqlite3_create_module_v2( ); /* +** CAPI3REF: Remove Unnecessary Virtual Table Implementations +** METHOD: sqlite3 +** +** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** table modules from database connection D except those named on list L. +** The L parameter must be either NULL or a pointer to an array of pointers +** to strings where the array is terminated by a single NULL pointer. +** ^If the L parameter is NULL, then all virtual table modules are removed. +** +** See also: [sqlite3_create_module()] +*/ +SQLITE_API int sqlite3_drop_modules( + sqlite3 *db, /* Remove modules from this connection */ + const char **azKeep /* Except, do not remove the ones named here */ +); + +/* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** @@ -8379,7 +8440,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8402,7 +8463,9 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 -#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_PRNG_SEED 28 +#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 +#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -13099,15 +13162,15 @@ struct fts5_api { ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) @@ -13597,100 +13660,103 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_VIEW 79 #define TK_VIRTUAL 80 #define TK_WITH 81 -#define TK_CURRENT 82 -#define TK_FOLLOWING 83 -#define TK_PARTITION 84 -#define TK_PRECEDING 85 -#define TK_RANGE 86 -#define TK_UNBOUNDED 87 -#define TK_EXCLUDE 88 -#define TK_GROUPS 89 -#define TK_OTHERS 90 -#define TK_TIES 91 -#define TK_REINDEX 92 -#define TK_RENAME 93 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Nov 3 01:52:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EF0917FB7D; Sun, 3 Nov 2019 01:52:51 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Jpq2KCNz4TWs; Sun, 3 Nov 2019 01:52:51 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32A7849F6; Sun, 3 Nov 2019 01:52:51 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA31qouU069806; Sun, 3 Nov 2019 01:52:50 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA31qobW069805; Sun, 3 Nov 2019 01:52:50 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911030152.xA31qobW069805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sun, 3 Nov 2019 01:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354270 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 01:52:51 -0000 Author: bdragon Date: Sun Nov 3 01:52:50 2019 New Revision: 354270 URL: https://svnweb.freebsd.org/changeset/base/354270 Log: powerpc: Fix incorrect disassembly of the cntlzw instruction in ddb. Noticed while comparing disassembly between ddb and objdump. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D22121 Modified: head/sys/powerpc/powerpc/db_disasm.c Modified: head/sys/powerpc/powerpc/db_disasm.c ============================================================================== --- head/sys/powerpc/powerpc/db_disasm.c Sun Nov 3 01:25:46 2019 (r354269) +++ head/sys/powerpc/powerpc/db_disasm.c Sun Nov 3 01:52:50 2019 (r354270) @@ -224,7 +224,7 @@ const struct opcode opcodes_1f[] = { { "ldx", 0xfc0007fe, 0x7c00002a, Op_D | Op_A | Op_B }, { "lwzx", 0xfc0007fe, 0x7c00002e, Op_D | Op_A | Op_B }, { "slw", 0xfc0007fe, 0x7c000030, Op_D | Op_A | Op_B | Op_Rc }, - { "cntlzw", 0xfc0007fe, 0x7c000034, Op_D | Op_A | Op_Rc }, + { "cntlzw", 0xfc0007fe, 0x7c000034, Op_S | Op_A | Op_Rc }, { "sld", 0xfc0007fe, 0x7c000036, Op_D | Op_A | Op_B | Op_Rc }, { "and", 0xfc0007fe, 0x7c000038, Op_D | Op_A | Op_B | Op_Rc }, { "cmplw", 0xfc2007fe, 0x7c000040, Op_crfD | Op_A | Op_B }, From owner-svn-src-all@freebsd.org Sun Nov 3 02:18:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D011A1A18AB; Sun, 3 Nov 2019 02:18:45 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475KNj592fz4Vjs; Sun, 3 Nov 2019 02:18:45 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94B154D9E; Sun, 3 Nov 2019 02:18:45 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA32Ijrp081665; Sun, 3 Nov 2019 02:18:45 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA32IjPa081664; Sun, 3 Nov 2019 02:18:45 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <201911030218.xA32IjPa081664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Sun, 3 Nov 2019 02:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354272 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 354272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 02:18:45 -0000 Author: bdragon Date: Sun Nov 3 02:18:45 2019 New Revision: 354272 URL: https://svnweb.freebsd.org/changeset/base/354272 Log: powerpc: Add display of raw instruction values to x/I in ddb. The "alternate format" character 'I' previously had the same behavior as the "display as an instruction" character 'i'. With this change, it will now prefix each disassembled instruction with the raw hex value. As PowerPC instructions are always 32 bits and always aligned, and there are no alternate modes that would affect instruction decoding or display, this seemed to me to be the obvious interpretation of "alternate format". Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D22223 Modified: head/sys/powerpc/powerpc/db_disasm.c Modified: head/sys/powerpc/powerpc/db_disasm.c ============================================================================== --- head/sys/powerpc/powerpc/db_disasm.c Sun Nov 3 02:17:35 2019 (r354271) +++ head/sys/powerpc/powerpc/db_disasm.c Sun Nov 3 02:18:45 2019 (r354272) @@ -1073,6 +1073,8 @@ db_disasm(db_addr_t loc, bool extended) int class; instr_t opcode; opcode = *(instr_t *)(loc); + if (extended) + db_printf("|%08x| ", opcode); class = opcode >> 26; (opcodes_base[class])(opcode, loc); From owner-svn-src-all@freebsd.org Sun Nov 3 02:52:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 343461A2A3B; Sun, 3 Nov 2019 02:52:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475L7t0dKTz4XRC; Sun, 3 Nov 2019 02:52:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDB6954A7; Sun, 3 Nov 2019 02:52:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA32qf7F004840; Sun, 3 Nov 2019 02:52:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA32qfHU004839; Sun, 3 Nov 2019 02:52:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911030252.xA32qfHU004839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 3 Nov 2019 02:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354273 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 354273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 02:52:42 -0000 Author: markj Date: Sun Nov 3 02:52:41 2019 New Revision: 354273 URL: https://svnweb.freebsd.org/changeset/base/354273 Log: MFC r354215: Fix a typo in r353895. Modified: stable/12/sys/arm64/arm64/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/machdep.c Sun Nov 3 02:18:45 2019 (r354272) +++ stable/12/sys/arm64/arm64/machdep.c Sun Nov 3 02:52:41 2019 (r354273) @@ -704,7 +704,7 @@ init_proc0(vm_offset_t kstack) thread0.td_kstack = kstack; thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack + - thread0.td_kstack_pages * KSTACK_PAGES) - 1; + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; thread0.td_pcb->pcb_vfpcpu = UINT_MAX; From owner-svn-src-all@freebsd.org Sun Nov 3 03:23:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4E701A39CB; Sun, 3 Nov 2019 03:23:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Lpr3vXBz4ZH1; Sun, 3 Nov 2019 03:23:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 692725A77; Sun, 3 Nov 2019 03:23:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA33N0bX024247; Sun, 3 Nov 2019 03:23:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA33N0Bf024246; Sun, 3 Nov 2019 03:23:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911030323.xA33N0Bf024246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 3 Nov 2019 03:23:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r354275 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: markj X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 354275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 03:23:00 -0000 Author: markj Date: Sun Nov 3 03:22:59 2019 New Revision: 354275 URL: https://svnweb.freebsd.org/changeset/base/354275 Log: Add myself to sizelimit.conf, again. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf ============================================================================== --- svnadmin/conf/sizelimit.conf Sun Nov 3 03:16:23 2019 (r354274) +++ svnadmin/conf/sizelimit.conf Sun Nov 3 03:22:59 2019 (r354275) @@ -22,6 +22,7 @@ imp jb jeff jkim +markj mm np obrien From owner-svn-src-all@freebsd.org Sun Nov 3 03:23:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C87001A3A3A; Sun, 3 Nov 2019 03:23:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475LqM5byJz4ZPQ; Sun, 3 Nov 2019 03:23:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2EDE5A7B; Sun, 3 Nov 2019 03:23:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA33NR76024305; Sun, 3 Nov 2019 03:23:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA33NRG6024304; Sun, 3 Nov 2019 03:23:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911030323.xA33NRG6024304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 3 Nov 2019 03:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354276 - in head/sys: contrib/dev/iwm modules/iwmfw/iwm9000fw modules/iwmfw/iwm9260fw X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: contrib/dev/iwm modules/iwmfw/iwm9000fw modules/iwmfw/iwm9260fw X-SVN-Commit-Revision: 354276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 03:23:27 -0000 Author: markj Date: Sun Nov 3 03:23:27 2019 New Revision: 354276 URL: https://svnweb.freebsd.org/changeset/base/354276 Log: Downgrade the firmware images imported in r354201. Version 43 requires further modifications to iwm(4), and this was not caught in some initial testing. Version 34 works and is the version available on Intel's web site. MFC with: r354201 Sponsored by: The FreeBSD Foundation Added: head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu head/sys/contrib/dev/iwm/iwm-9260-34.fw.uu Deleted: head/sys/contrib/dev/iwm/iwm-9000-43.fw.uu head/sys/contrib/dev/iwm/iwm-9260-43.fw.uu Modified: head/sys/modules/iwmfw/iwm9000fw/Makefile head/sys/modules/iwmfw/iwm9260fw/Makefile Added: head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu Sun Nov 3 03:23:27 2019 (r354276) @@ -0,0 +1,59521 @@ +begin 644 iwm-9000-34.fw.uu +M`````$E73`I.+W)E;&5A````"`````````!_,\^='@````@````!```` +M9@(``!X````(`````@```-]N$P`>````"`````,`````````'````!`````` +M````````````````````&P````0````"````(`````0`````L`,`,P````P` +M``````````"```"``0`S````#`````$``````(@``(```#,````,`````@`` +M````0```\`@`$P```+P"````0$``!@```*$```````$``````(:````H`A@@ +M!N0!`$````!``````0```!$;4+H````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````=MVF>*UJ,X$=>E_#W#VH;^Y5X_")L7/N5&48I:=UN +M=OPMR]FQQ%&!P_PF,A#PO7[_+OHX#*W0W$5"LNL7A_V-1"Y%N?O6$_R?,_,Q +MH7!AQ7JCM2"8+L(&I4Q2(YO'@MBVP2/M6BT*$ +MWS3'.%W">-0+NW6P<'ZIQ_]GT*9T>$%]>%ZQ9J`9P0 +MD=26W:3.O3:.C=I+DJBO!S/(O!91O.M[V6-#)B#L6&0TXBL7=G +M9X@.6_26K`M&JWRN,LXA-S@-"P]LO+"VZ$AKL6>KEOQ4%O13B:NU[Q46=^"W +M53'<&XEQ<\.SX^^YYN:99<,S0`\/ST$+DA.L\KJVKUNMF*Y1IVLR!9IWZ@N^ +M>TMC(Y6^OR01P3]2J%J%:MSKO&%[-JGYNT7L'FGZ:NI0O'"/,A.C%?92ZZ:< +MPL==[*>`XX"8_;]G*S4?%%(NAS/M"!;>H?\0=P!&(!^$8'P`( +M8@``&R4!`!LD```%)0$`!20`"`4Y`0`%8H@@P!$"``4D``@%.0$`!6*,(,`1 +M!``%)``(!3D!``5BD"#`$0@`!20`"`4Y`0`%8I0@P!$0``4D``@%.0$`!6*8 +M(,`1(``%)``(!3D!``5BG"#`$4``!20`"`4Y`0`%8J`@P!$```@E```()(@' +MX1F$!^$9/`?`$@$`&W`#``!AZ!W`$!``&S#H'<`1+`?`$@$`&W`%``!A#QP= +M(@0`'2;H'<`0`0`;,.@=P!&V#P!A```;)(``&R7D'<`1"`!?<`D``&'0!L`2 +M``D;*,P&@($``,`7U`;`$@`)&RC(!H"!``#`%Z@/`&',!L`2X`:`@0``P!?( +M!L`2W`:`@0``P!>A#P!A```;)``!&R7D'<`1"`!?<)P/`&$```4EX@0%)-0& +MP!(`"1LH``4;*=P&@($``,`7T`;`$@`)&R@`!1LIX`:`@0``P!>/#P!A```; +M)``"&R7D'<`1"`!?<`P``&'8'<`0__\;,]@=P!'.[@TE@ID-)`\--R)L(,`0 +M#QLW(O__#24._PTD#PTW(GX/`&'8'<`0```;,=@=P!'.[@TE@ID-)`\--R)L +M(,`0#QLW(O__#26._PTD#PTW(G(/`&$```!A```;(S@XP!$```!AW!W`$``` +M'20````A`0`3(P3\S1$#`!,D!"#,$>P*P!),(@=P!#F_Q,R__\3,^@=P!$```$D"``!)0\!8R(!`%(D"``';@(` +M`&$``!4D````(0X``&'H'<`0$/@!)/__`24``1,Y#Q,!(BP'P!(``1,XZ!W` +M$0$`4B1X1<`0`0`3<`(``&$(`&0QX0\`8>0*P!(!`!-N1@``8<[N#24!@`TD +M#PTW(@]<-R(L#("!``#`%@8!$V($",`0!``39`]<`"(*``!```8``*P!(``,T1 +M#TT3(@00Q1$"`!,D\!S`$0$`$R3L',`1```3)'``$R40',`1```3(^`[[ZMWN^^K=[O +MOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=[OOJW>```````````````````````` +M````````````````````````X@0``-`'``````````````$!`0$!`0$!O1\` +M`&,N``#_____``````````````````````(`````````,@`````````````` +M```````````(```````````````````````````````````````````````` +M`````````````````````````````````````````````````````0`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````S +M$`(`$1`````````````````@```````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````$0`@``````````````````````````````````\#(`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````#0XL+ +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````V'D```4```($````\$Z````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````@``````````````````````````````````````````````````` +M``````````````````````````````````````````````````9D```````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````IQ +MR;Z\```````````````````````````````````````````````````````` +M`````````````````/]_````````_W\```````#_?P```````/]_```````` +M_W\```````#_?P```````/]_````````_W\```````#_?P````#_?P`````` +M``````````$```````````````````````````````8``````````````"3@ +M@-(5T@S2%=$3T1+1$-(1TA31@](0T1'1"1$1$0[2`.`!T!+2$])0T`1#`40/ +MT`""(($IX`;0`````#\`/P``````/P`_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````"8'@````"<'@````"D'@````"H'@````#`'@````"X'@`` +M``"\'@``````'0`````@'0````!`'0````!@'0````"`'0````"@'0````#` +M'0````#@'0`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````````$`@` +M``#_`P#L"0```/\%`'`(````_RT`3`@```#_/0"X!P```/\$`-P'````_R4` +M,`@```#_/``8R````/_=```)````_TP`U`D```#_(@"4"````/\F`'0)```` +M_R@`],<````@``#X!P```/\'`"@)````_R`````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````0````$````````````````````````````````````````` +M``````````````````````````````````````````````````````$````" +M`````P````````#_````_P```/\```#_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````!,"*``2`B@ +M`$0(H`"0"8`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````\` +M#P`/``\`#P`/``\`#P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````)@`````!)@`````*)@`````+)@`````#)@`````()@` +M`````0`````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````@```````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````!``$``````,``D`#0```````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````0$(/`,#&+0`#S@,4`P```````````````````)!9`0`%```` +M`````/!.@`````````````````"L6`$`!0````````#P3H``D%D!`*Q8`0`< +M60$`J%@!`.18`0`````````````````````````````````````````````` +M```````````````````!_P`````````````````````````````````````` +M`````````````?\```````````````````````````````````D````-```` +M```````````````````````````````````````````````````````````` +M``````````'_```````````````````````````````````````````````` +M```!_P``````````````````````````````````"0````T````````````` +M```````````````````````````````````````````````````````````` +M`?\```````````````````````````````````````````````````'_```` +M```````````````````````````````)````#0`````````````````````` +M```````````````````````````````````````````````````!_P`````` +M`````````````````````````````````````````````?\````````````` +M``````````````````````D````-````````````````````!`````````#_ +M____6!&`````````````````````````$````-````!`````P`````````!@ +M`@``X`(``-`!``"``0``@````$````!@`````````*`!``#@`@``T`$`@``` +M```````````````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P```````````@```````````````````/\````` +M`````(```````/\```````````(```````````````````#_``````````"` +M``````#_```````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P`````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````8(*``'""@`"@@H``L(*`` +M.""@`"`@H``D(*``,""@`#0@H``\(*``0"&@`$0AH`!H(:``;"&@`'@AH`!( +M(:``3"&@`'`AH`!T(:``?"&@````````````_P`````````````````````` +M``#_`````````````````````````/\`````````````````````````_P`` +M``````````````````````````````````````````````````````!$(``` +M!0````0```#P3H``\$Z``/!.@`"`(:``M""@`&P@H```,````'`````````` +M````%$^``!1/@`"`(:``I""@`#@@H``!````!P``````````````.$^``#A/ +M@`"`(:``J""@`#P@H``0````.```````````````7$^``%Q/@`"`(:``K""@ +M`'@AH`!``0``P`$`````````````@$^``(!/@`"`(:``L""@`'PAH```#``` +M``X`````````````_P```/\````````````````````````````````````` +M````````````````````````````````````````````````````_P`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#__P``__\````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````'``P`#``(``4``P`!H`! +M``(`"(````````````L`(``@``L`"P`+``:``0`"``B````````````*``H` +M"@`*``D`"P`&@`$``@`(@``````````#`````@````````````````````8` +M````````!@````(!``"````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````/\`````````````````````````````````````````6%0!`!!4`0"P +M5`$`9%8!``16`0`,50$`G%4!`-!5`0#D4P$`````````````````3$4```4` +M```$````\$Z``````````````````/Q>```%````!````/!.@``````````` +M``````"`8```!0````0```#P3H`````````````````````````````````` +M`````````````````````````````@(``@("``("`@`"`@("``````0%!00" +M`@``!``'!P<'!P<````````````(+IZ>-D6>GIZ>GHF>;W="9Y>!3)Z>GIZ> +M15]%&9Z/CT)^GIY%16QL;```!`4%!`("``!R96%D(&UE;6]R>2!B;&]C:SH@ +M4D9(7T=%3E]#1D<`2!B;&]C:SH@4D9(7U%?55)"1$-"7U=)1%@`@`X`!X`$`!R`#H`'@`"`P0%``#@(@0` +MI448`,KT)P#*]"<`.@$"`=4`WP`Z`:(`=0!_`,H!2@'B`/D`R@'J`((`F0`! +M`P\'?'Q\?&=G9V<%!0H*``````H4-VYJ`1H!V0#H`&H!N@!Y`(@`=-%%%^BB +MBRX0&*``#!B@``@0$`(0"```$!F@``P9H``0&$`&$"```#``"``-#0T-#@X. +M#@X/#P\/#Q`0$!`1$1$1$A(2$A,3$Q,4%!05%145%A86%Q<7&!@8&1D:&AH; +M&QL<'!T='1X>'Q\@("$A(B(C(R0D)24F)BWQ^@(*$AHB*C(Z0DI26F)J=GZ&CIJBKK;"RM;>Z +MO<#"Q0` +MF`#D`)@`Y`"8`-P"W`)N`=P";@'H`6X!]`!N`?0`;@'T`+(%L@79`K(%V0+, +M`]D"Y@'9`N8!V0+F`40!1`'F`40!Y@&P`>8!'`+F`1P"Y@$<`H@"B`+,`X@" +MS`-@`\P#.`3,`S@$S`,X!,P#S`.R!$AX2'@`!`@$#!@````0(!!`0```H`"@`,``L`"P`*``\`#0`+``L`#P` +M-``P`"P`5`!$`'__!P\?/P$#!0`'`@,$!@8-!04)"0D)"0D)"0D!!P\?/W__ +M____________````@%55554```!`T%Y">V@OH3V:'Q8IM)?0'CB.XS@PG'<1P'`0$!`0$!`0%!P0$!`0$!`0$!0<$! +M`0$!`0$!`4%!`0$!`0$!`0%!P0$!`0$!`0$!04$!`0$!`0$!`4%!`0$!`0$! +M`0%!00$!`0$!`0$!0D)!04%!04%!04%!04%!04%!04)"0D%!04%!0L)"0D-! +M04%!0D)"0T-#04%!04%!04)"0D%!04%"0D)#0T-!04%"0D-#1$3$04%"0D-$ +M1,1&1@$"`P29F0,`G=B)G4[LQ$XT2(,T)W9B)QJD01H3.[$3$1B!$0_\P`\- +MTB`-"[W0"S0`:`!H`-``T``X`3@!.`&@`:`!;`#8`-@`L`&P`8@"B`*(`F`# +M8`/J`-0!U`&H`Z@#?`5\!7P%4`=0!]0!J`.H`U`'4`?X"O@*^`J@#J`.&@`T +M`$X`:`"<`-``Z@`$`3@!6P&&`;$!-@!L`*(`V`!$`;`!Y@$<`H@"T`(J`X0# +M=0#J`%\!U`&^`J@#'022!'P%&`;;!IX'Z@#4`;X"J`-\!5`'.@@D"?@*,`RV +M#3P/"0D%!0D)#0T%!@$"`P0``)*-C(J*BHF(B(B2BHB'AX:&AH:&CHF(AX:& +MAH6%A9*.C8R,C(R,C(PM+34V-S@^0D9&+3,U.S]`0$='1S(V.#HZ04!'1T<] +M/CY(2$=*4%!0#0\%!PD+`0,H`"@`-``P`"P`+`!$`#P`5555`4MH+P%5554% +MXSB.`ZJJJ@)Q',GI[?'Q]?7U^?GY^ +M?W]_?W]_?W^`!`P,"!04!`1`````@``````!`````@````0```!```!````` +M0````#0#4`-[`[H#%02;!/0$_@,?!$@$@P3;!&(%NP6Z!NP&.`>Q!W@(FPE: +M"J$'WP'@<```(``@8&!@8&!@8&!@0`````!O8& +M]O;V&P`(6QM;(0`````````!`````0```````````````0`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````!%R!``0````$````!`````0````$```````````````````````````` +M``````````````````````````````````````````````\`"``&``,``P`` +M```1`!````````````````````````````$``````````````$`````````` +M```````````!````````$`````!``````````````````````0```,R%@``` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````%]?8@`````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````#_ +M______\````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#_______\````````````````````````````````````````````````` +M`````````@`0`````$`````````````````````!````V'B````````````` +M`````````````````````````````0$"`0("`P$"`@,"`P,$``()`0,```#P +M10(`9$$"`"SX`@`L^`(`+/@"`"SX`@`L^`(`^$<"`%CX`@!81P(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`!````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(```````\`/P`"````#P`_``(````/`#\` +M`@````\`/P`"````#P`_``(@```````````$"`P,````````!`@,#``````` +M``0(#`P````````$"`P,!@`-`$(`8P"&`*``_P```*JJJJJJJJJJJJJJ[JJJ +MJJHH_P#,JJH``*JJ`,RJJ@```$``P`!``,``4`#P`%``\``````````````` +M`````````````````````````````````````````````````*JJJJJJJJJJ +MJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ``````````````````````!L;6YO +M<'%R+<"``"E10`@Q$4`+/@"`"SX`@`L^`(` +M$````%B@10#8K$4`,*U%`*3#10`L^`(`+/@"`(2?10`0GT4`+/@"`"SX`@`L +M^`(`+/@"`"SX`@`L^`(`+/@"`%3X`@!8^`(`,/@"`"SX`@`L^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"``0````L^`(`+/@"`"SX`@`L^`(````` +M`````````````````!A,1@!4048`H#Y&`+!(1@`L2T8`K#]&`$!01@`,2$8` +M6/@"`&A"1@"0148`S$=&`*1"1@`H1$8`0$E&`/A01@!<2$8`W$I&`&!"1@`( +M`0``+/@"`"SX`@`L^`(`+/@"``1!1@!02T8`+/@"`"SX`@`!`04!`P$!`0@! +M`@$(``@``0$#`0$!`P`#`0(!!0$!`00````0!48`+/@"`(`!1@`L!$8`+/@" +M`#`"1@`D!D8`!`1&`%CX`@`P^`(`+/@"`"SX`@!<`D8`1`-&`"SX`@`L^`(` +M+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@#\ +M`D8```````\`/P`!````#P`_``$````/`#\``0````\`/P`!````#P`_``$` +M```"`````@````8````&````!0````4````$````!`````,````#`````0`` +M`````````````````*!)10!T244`<$E%`)A)10"<244`+/@"`"SX`@"4244` +M6/@"`)!)10`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`0 +M````+/@"````````````+/@"```````````````````````L^`(`+/@"`.P] +M1@`D/D8`=#Y&`"SX`@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(` +M+/@"`"SX`@`L^`(``.<0YR#G,.<`[Q#O(.\P[P#B`.,`Y`#E`.H`ZP#L`.TL +M^`(`+/@"`%121@`L^`(`+/@"`%A21@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(``0$!``(```"<_QC\``!D`&(```!O`&,` +ML`1P`&T`T`=Q`&\`H`]R`'$`0!]S`'(`$"=T`',`X"YU`&``F#H``)69G:&E +M````_T%55555`0````("`B````"`B(B(B```$0```#16`@`#````?'8"``$` +M```D,0,``````-2I`@`8````)(,"``P```!@?@(`'````(Q?`@`$````,)0` +M`!,```#86P(`&P```!Q7`@`1````<%8"`!@```!`A0(`&0```-"9`@`:```` +M/*,"``<````PB@(``P```"AY`@`,````-($"``0```"$G0``-*D"`#A7`@#D +M5@(`N)H"`-RC`@#47P(`2'T"`/B'`@`X6@(`L)0``*1V`@#46@(`!C!0<(2A +M```&,`````#__P`!`/\```$$```$_P``_@`!`/\!`0((`P$#"0,!`03_`0`& +M"`$!!P$!`0`"`0`!!`(`_P8"`P7_`@("!P("`P<"`@3_`@(``@(``00"`0?_ +M`@`&"`,`__\#`P0%`P(#_P,!!_\#``8(`P,``@,``00``@`````%_P```?\" +M`/\"`@,%_P(`!@$"``$!`P#_`P,#!00#`0/_`P("!0,`!@$#``$!`0#_!P$! +M!P8!`07_`00!_P$#"`@$`/\)!`0%_P0`"`H$!`/_)````"@````L````,``` +M`#0````X````/````$````!$````2````$P```!0````5````%@```!<```` +M8````&0```!H````;````'````!T````>````'P```"`````A````(@```", +M````D````)4```"9````G0```*$```"E````J0```*T```"Q````*@```#H` +M``!*````6@```&H```!Z````B@```)L```"K`````@````0````&`````P`` +M``L````3````&P```",````K````,P```#H```!"`````0`````````$```` +M!0``````````````````````_P```/X!```"_P```_\``0#_`0`!`@$"`O\" +M`/\#`@#^!`(``_\```````````````"@;44`"@````0```#P3H`````````` +M````````M&U%``H````$````\$Z````````````````````````````````` +M```````````````````````>````'H@>B%H```!6````5HA6B`(!``"J```` +MJHBJB/X!``","@``5(Q4C*0?```````````````````H"@(`"@````0```#P +M3H``````````````````K`H"``4````$````\$Z``````````````````-2[ +M10`DOD4`4+U%`-B]10!(N44`'+E%`/`T10#8N$4`C#5%``@S10!@,T4`!$T" +M````````````````````````````````````_PD```#_```'_P`!"0H```K_ +M`0#_!@$"```!`P'_`0,"_P$#`_\!`0W_`0$$_P$"!0`!`0O_`0(,_P$$!@@! +M`0?_`0`(_P$`"O\"`@#_`@,!_P(#`O\"`P/_`@$-`0(!!`$"`@4``@$+`0(" +M#`$"!`8(`@('``(`"`$"``H!`P#_`@,#`/\#`P'_`P,"_P,#`P0#`00%`P$- +M!P,"!0`#`0L%`P(,!0,$!@@#`P?_`P`(!0,`"@4#`/X#!`0`_P0$`?\$!`+_ +M!`0#_P0$#?\$!`3_!`0%_P0$"_\$!`S_!`0&"`0$!P@$``C_!``*_P`````` +M``````#_`````0,``@("``,``@``!?\```;_```$_P``!P0```S_`0#_`0$! +M``,!`@$"`0("`@$`!/\!`0<$`0`,_P("``4"`@(%`@`%_P(`!O\"`@0%`@(' +M!0(#"@("`@D"`@`(_P(`#`4#`P`%`P,!!0,#`@4#`07_`P`&_P,#!`4#`P<% +M`P()`@,#"@(#``L#`P`(_P,`#`4``````!```/8/``#8#P``I@\``&$/```) +M#P``G0X``"`.``"1#0``\0P``$$,``"""P``M`H``-D)``#R"`````@```,' +M``#^!0``\00``-X#``#'`@``K`$``(X```````````````````````````$` +M```!```````````````!`````0````$```````````````$``!CA@``>``'4 +MY@(``0`$T.4"``$`!````/!#@``0``&H#H```@`!``"```$` +M`SA\@``!``&DX(```0`#J."```$``Z3F`@`"``0``"`````@```````````` +M`````````````(A>`P`%```"!````/!.@`#_`````'F``+SK@``````````` +M````````````````````````````````````````````U0#6``$`+0"`!Q`* +M_0#^`"8`@0J""J$(,0L``/\````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````"DJ@(`,S,#````!``R +M504````(`*NJ"@````P`S@````````1J`````` +M``0\H```````"#R@```````8/*```````!P\H```````(#R@```````D/*`` +M`````"@\H```````+#R@```````P/*```````#0\H```````.#R@```````\ +M/*```````$`\H```````1#R@``````!(/*```````$P\H```````4#R@```` +M``!4/*```````%@\H```````7#R@``````!@/*```````&0\H```````:#R@ +M``````!\/*```````'@\H````````````````````````````)C=`0!0W0$` +M`````.A[@`#H>X```````````````````````````````````````,#!@`#` +MP8``P,&``,#!@``````````````````````````````````````````````` +M``#^RJVK`````````````````````"`"`````"$"`````"("`````","```` +M`"0"`````"4"`````"($`````",$`````"0$`````"4$`````"8$`````"<$ +M`````"@$`````"D$`````"H$`````"L$`````"P$`````"T$`````"X$```` +M`"\$`````#`$`````#$$``````D$`````!<``0```!@P8,`````````````` +M`````````````*!O10`*`````````/!.@`````````````````````````#_ +M```!`_\```D!```*_P`#!`(```#_``#^`P$`_P0!`0D%`0$*!0$``?\!`P0" +M`0$"_P$!"/\!``#_`0#^!@(`_P<"`@D(`@(*"`("!PD"``'_`@$#_P(#!`H" +M`@+_`@``"P,#"0P#`PH,`P0%#0,#`@X#```/!`#_$`0$"1$$!`H1!`(&_P0" +M`A($!`C_!```_P0`_A,```````````````#X)$4`"@````````#P3H`````` +M``````#4.D4`8#M%`/0A10!8.T4`O&Y%`"AO10`0;T4`,")%`&PC10#$(D4` +M)")%`&0C10`8(D4``")%``@B10`0(D4`C&M%`/AK10#$:T4`O&M%`/______ +M______________\$````________________`P```/____\``````````/__ +M__\``````````/____\```````````,````0`````P```/\```#_````_P`` +M`/\````#```````````````````````````````````````````````````` +M````````````````_P```/\````>```````````````````````````````` +M``````````````````````````````````````````````!D````9````&0` +M``!D````R````)`!``#H`P``T`<```#_`````````````/\`````!@$#`@`` +M```````#0>```` +M`#@>`````#P>`````$P>`````%`>`````%0>`````%@>`````%P>`````&0> +M`````'@>`````'P>`````(P>`````)`>`````)0>`````)@>`````)P>```` +M`*`>`````,`>`````,0>`````-`>`````-0>``````0?`````-P>`````'0? +M`````'@?`````'P?`````/@?`````"8`````````````````````````$``` +M`!\````````````````````````````````````````````````````````` +M````````````````````````````````$``````````````````````````` +M```````````````0```````````````4```````````````E````Y?____G_ +M__\O````W?____C___\```````````$````````````````````````````` +M`````````````````````````````````````````````````/\````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````/SP```````````````````,`````````_P`````` +M````````````````````````````````````````__\````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````( +M`````````````````````````````````````````````````````````/__ +M________````````````````C`0"``H````$````\$Z`````````````Z`8" +M```(`@`X!P(`0`8"`#`(`@#$!P(`E`8"`/`%`@```0````$$`0$!``(!`0$# +M`0`"!P$!!`0!`04%`0(#_P(!`08"``('B!,````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#_____```````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````(`````````````````` +M````````_____P`````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````"````````````` +M`````````````/____\````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````@``````` +M``````````````````#_____```````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````````````````````(`` +M````````````````````````_____P`````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``"``````````````````````````/\````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Nov 3 07:11:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD8F81A98D3; Sun, 3 Nov 2019 07:11:09 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Rt55T7cz3GXZ; Sun, 3 Nov 2019 07:11:09 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F10481FC; Sun, 3 Nov 2019 07:11:09 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA37B9bT053602; Sun, 3 Nov 2019 07:11:09 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA37B9Ob053599; Sun, 3 Nov 2019 07:11:09 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911030711.xA37B9Ob053599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 07:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354277 - stable/12/sys/cddl/boot/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/sys/cddl/boot/zfs X-SVN-Commit-Revision: 354277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 07:11:09 -0000 Author: tsoome Date: Sun Nov 3 07:11:09 2019 New Revision: 354277 URL: https://svnweb.freebsd.org/changeset/base/354277 Log: MFC: r354127 loader: zio_checksum_verify should check byteswap We do have both native and byteswap checksum callbacks in place but the selection is not wired. Modified: stable/12/sys/cddl/boot/zfs/zfsimpl.h stable/12/sys/cddl/boot/zfs/zfssubr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 03:23:27 2019 (r354276) +++ stable/12/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 07:11:09 2019 (r354277) @@ -442,6 +442,13 @@ _NOTE(CONSTCOND) } while (0) ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ } +#if BYTE_ORDER == _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) #define BPE_NUM_WORDS 14 #define BPE_PAYLOAD_SIZE (BPE_NUM_WORDS * sizeof (uint64_t)) #define BPE_IS_PAYLOADWORD(bp, wp) \ Modified: stable/12/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfssubr.c Sun Nov 3 03:23:27 2019 (r354276) +++ stable/12/sys/cddl/boot/zfs/zfssubr.c Sun Nov 3 07:11:09 2019 (r354277) @@ -318,8 +318,9 @@ zio_checksum_verify(const spa_t *spa, const blkptr_t * byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { + byteswap = BP_SHOULD_BYTESWAP(bp); expected_cksum = bp->blk_cksum; - ci->ci_func[0](data, size, ctx, &actual_cksum); + ci->ci_func[byteswap](data, size, ctx, &actual_cksum); } if (!ZIO_CHECKSUM_EQUAL(actual_cksum, expected_cksum)) { From owner-svn-src-all@freebsd.org Sun Nov 3 09:14:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AABB1AD696; Sun, 3 Nov 2019 09:14:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475VcQ2b5yz3N77; Sun, 3 Nov 2019 09:14:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BBE198FC; Sun, 3 Nov 2019 09:14:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA39EU7o030084; Sun, 3 Nov 2019 09:14:30 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA39EUxj030083; Sun, 3 Nov 2019 09:14:30 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911030914.xA39EUxj030083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 09:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354278 - head/stand/userboot/test X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/userboot/test X-SVN-Commit-Revision: 354278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 09:14:30 -0000 Author: tsoome Date: Sun Nov 3 09:14:29 2019 New Revision: 354278 URL: https://svnweb.freebsd.org/changeset/base/354278 Log: loader: userboot/test should accept more than one disk allow to specify multiple -d options, test -d disk1 -d disk2 .. Modified: head/stand/userboot/test/test.c Modified: head/stand/userboot/test/test.c ============================================================================== --- head/stand/userboot/test/test.c Sun Nov 3 07:11:09 2019 (r354277) +++ head/stand/userboot/test/test.c Sun Nov 3 09:14:29 2019 (r354278) @@ -50,10 +50,11 @@ char *host_base = NULL; struct termios term, oldterm; char *image; size_t image_size; -int disk_fd = -1; uint64_t regs[16]; uint64_t pc; +int *disk_fd; +int disk_index = -1; void test_exit(void *arg, int v); @@ -245,9 +246,9 @@ test_diskread(void *arg, int unit, uint64_t offset, vo { ssize_t n; - if (unit != 0 || disk_fd == -1) + if (unit > disk_index || disk_fd[unit] == -1) return (EIO); - n = pread(disk_fd, dst, size, offset); + n = pread(disk_fd[unit], dst, size, offset); if (n < 0) return (errno); *resid_return = size - n; @@ -259,14 +260,14 @@ test_diskioctl(void *arg, int unit, u_long cmd, void * { struct stat sb; - if (unit != 0 || disk_fd == -1) + if (unit > disk_index || disk_fd[unit] == -1) return (EBADF); switch (cmd) { case DIOCGSECTORSIZE: *(u_int *)data = 512; break; case DIOCGMEDIASIZE: - if (fstat(disk_fd, &sb) == 0) + if (fstat(disk_fd[unit], &sb) == 0) *(off_t *)data = sb.st_size; else return (ENOTTY); @@ -424,7 +425,6 @@ main(int argc, char** argv) void *h; void (*func)(struct loader_callbacks *, void *, int, int) __dead2; int opt; - char *disk_image = NULL; const char *userboot_obj = "/boot/userboot.so"; while ((opt = getopt(argc, argv, "b:d:h:")) != -1) { @@ -434,7 +434,12 @@ main(int argc, char** argv) break; case 'd': - disk_image = optarg; + disk_index++; + disk_fd = reallocarray(disk_fd, disk_index + 1, + sizeof (int)); + disk_fd[disk_index] = open(optarg, O_RDONLY); + if (disk_fd[disk_index] < 0) + err(1, "Can't open disk image '%s'", optarg); break; case 'h': @@ -459,11 +464,6 @@ main(int argc, char** argv) image_size = 128*1024*1024; image = malloc(image_size); - if (disk_image) { - disk_fd = open(disk_image, O_RDONLY); - if (disk_fd < 0) - err(1, "Can't open disk image '%s'", disk_image); - } tcgetattr(0, &term); oldterm = term; @@ -471,5 +471,5 @@ main(int argc, char** argv) term.c_lflag &= ~(ICANON|ECHO); tcsetattr(0, TCSAFLUSH, &term); - func(&cb, NULL, USERBOOT_VERSION_3, disk_fd >= 0); + func(&cb, NULL, USERBOOT_VERSION_3, disk_index + 1); } From owner-svn-src-all@freebsd.org Sun Nov 3 11:09:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D3E81B091D; Sun, 3 Nov 2019 11:09:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Y8f6X21z4070; Sun, 3 Nov 2019 11:09:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C387AAC98; Sun, 3 Nov 2019 11:09:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3B96oF096782; Sun, 3 Nov 2019 11:09:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3B961F096781; Sun, 3 Nov 2019 11:09:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911031109.xA3B961F096781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 11:09:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354279 - in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Commit-Revision: 354279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 11:09:07 -0000 Author: tsoome Date: Sun Nov 3 11:09:06 2019 New Revision: 354279 URL: https://svnweb.freebsd.org/changeset/base/354279 Log: loader: calculate physical vdev psize from asize Since physical device asize is calculated from psize and the asize is stored in pool label, we can use asize to set the value of psize, which is used to calculate the location of the pool labels. MFC after: 1 week Modified: head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 09:14:29 2019 (r354278) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 11:09:06 2019 (r354279) @@ -1102,7 +1102,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde vdev_t **vdevp, int is_newer) { int rc; - uint64_t guid, id, ashift, nparity; + uint64_t guid, id, ashift, asize, nparity; const char *type; const char *path; vdev_t *vdev, *kid; @@ -1181,6 +1181,11 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde } else { vdev->v_ashift = 0; } + if (nvlist_find(nvlist, ZPOOL_CONFIG_ASIZE, + DATA_TYPE_UINT64, NULL, &asize) == 0) { + vdev->v_psize = asize + + VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + } if (nvlist_find(nvlist, ZPOOL_CONFIG_NPARITY, DATA_TYPE_UINT64, NULL, &nparity) == 0) { vdev->v_nparity = nparity; @@ -1547,7 +1552,6 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s uint64_t guid; uint64_t best_txg = 0; uint64_t pool_txg, pool_guid; - uint64_t psize; const char *pool_name; const unsigned char *vdevs; const unsigned char *features; @@ -1562,17 +1566,17 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s memset(&vtmp, 0, sizeof(vtmp)); vtmp.v_phys_read = _read; vtmp.v_read_priv = read_priv; - psize = P2ALIGN(ldi_get_size(read_priv), + vtmp.v_psize = P2ALIGN(ldi_get_size(read_priv), (uint64_t)sizeof (vdev_label_t)); /* Test for minimum pool size. */ - if (psize < SPA_MINDEVSIZE) + if (vtmp.v_psize < SPA_MINDEVSIZE) return (EIO); tmp_label = zfs_alloc(sizeof(vdev_phys_t)); for (l = 0; l < VDEV_LABELS; l++) { - off = vdev_label_offset(psize, l, + off = vdev_label_offset(vtmp.v_psize, l, offsetof(vdev_label_t, vl_vdev_phys)); BP_ZERO(&bp); @@ -1595,8 +1599,20 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s continue; if (best_txg <= pool_txg) { + uint64_t asize; + best_txg = pool_txg; memcpy(vdev_label, tmp_label, sizeof (vdev_phys_t)); + + /* + * Use asize from pool config. We need this + * because we can get bad value from BIOS. + */ + if (nvlist_find(nvlist, ZPOOL_CONFIG_ASIZE, + DATA_TYPE_UINT64, NULL, &asize) == 0) { + vtmp.v_psize = asize + + VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + } } } @@ -1716,6 +1732,7 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s vdev->v_phys_read = _read; vdev->v_read_priv = read_priv; vdev->v_state = VDEV_STATE_HEALTHY; + vdev->v_psize = vtmp.v_psize; } else { printf("ZFS: inconsistent nvlist contents\n"); return (EIO); @@ -1735,7 +1752,7 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s up = (const struct uberblock *)upbuf; for (l = 0; l < VDEV_LABELS; l++) { for (i = 0; i < VDEV_UBERBLOCK_COUNT(vdev); i++) { - off = vdev_label_offset(psize, l, + off = vdev_label_offset(vdev->v_psize, l, VDEV_UBERBLOCK_OFFSET(vdev, i)); BP_ZERO(&bp); DVA_SET_OFFSET(&bp.blk_dva[0], off); Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 09:14:29 2019 (r354278) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 11:09:06 2019 (r354279) @@ -1660,7 +1660,8 @@ typedef struct vdev { vdev_list_t v_children; /* children of this vdev */ const char *v_name; /* vdev name */ uint64_t v_guid; /* vdev guid */ - int v_id; /* index in parent */ + uint64_t v_id; /* index in parent */ + uint64_t v_psize; /* physical device capacity */ int v_ashift; /* offset to block shift */ int v_nparity; /* # parity for raidz */ struct vdev *v_top; /* parent vdev */ From owner-svn-src-all@freebsd.org Sun Nov 3 11:51:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE5521B1CA0; Sun, 3 Nov 2019 11:51:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Z622xPTz42MK; Sun, 3 Nov 2019 11:51:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49B70B54B; Sun, 3 Nov 2019 11:51:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Bpsgk022295; Sun, 3 Nov 2019 11:51:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Bps3a022294; Sun, 3 Nov 2019 11:51:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911031151.xA3Bps3a022294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 3 Nov 2019 11:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354280 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 11:51:54 -0000 Author: kib Date: Sun Nov 3 11:51:53 2019 New Revision: 354280 URL: https://svnweb.freebsd.org/changeset/base/354280 Log: amd64 ddb: Add printing of kernel/user and saved user %cr3 values from pcpu. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/db_interface.c Modified: head/sys/amd64/amd64/db_interface.c ============================================================================== --- head/sys/amd64/amd64/db_interface.c Sun Nov 3 11:09:06 2019 (r354279) +++ head/sys/amd64/amd64/db_interface.c Sun Nov 3 11:51:53 2019 (r354280) @@ -101,6 +101,9 @@ db_show_mdpcpu(struct pcpu *pc) db_printf("tssp = %p\n", pc->pc_tssp); db_printf("commontssp = %p\n", pc->pc_commontssp); db_printf("rsp0 = 0x%lx\n", pc->pc_rsp0); + db_printf("kcr3 = 0x%lx\n", pc->pc_kcr3); + db_printf("ucr3 = 0x%lx\n", pc->pc_ucr3); + db_printf("scr3 = 0x%lx\n", pc->pc_saved_ucr3); db_printf("gs32p = %p\n", pc->pc_gs32p); db_printf("ldt = %p\n", pc->pc_ldt); db_printf("tss = %p\n", pc->pc_tss); From owner-svn-src-all@freebsd.org Sun Nov 3 11:52:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3EBF1B1D82; Sun, 3 Nov 2019 11:52:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475Z773wSzz42dV; Sun, 3 Nov 2019 11:52:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A04BB597; Sun, 3 Nov 2019 11:52:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3BqpcI026636; Sun, 3 Nov 2019 11:52:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Bqpxd026635; Sun, 3 Nov 2019 11:52:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911031152.xA3Bqpxd026635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 3 Nov 2019 11:52:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354281 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 354281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 11:52:51 -0000 Author: kib Date: Sun Nov 3 11:52:50 2019 New Revision: 354281 URL: https://svnweb.freebsd.org/changeset/base/354281 Log: amd64: Store %cr3 into pcpu saved_ucr3 on double fault. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Sun Nov 3 11:51:53 2019 (r354280) +++ head/sys/amd64/amd64/exception.S Sun Nov 3 11:52:50 2019 (r354281) @@ -349,6 +349,8 @@ IDTVEC(dblfault) jz 1f /* already running with kernel GS.base */ swapgs 1: lfence + movq %cr3,%rax + movq %rax,PCPU(SAVED_UCR3) movq PCPU(KCR3),%rax cmpq $~0,%rax je 2f From owner-svn-src-all@freebsd.org Sun Nov 3 13:03:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FF791B45BA; Sun, 3 Nov 2019 13:03:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475bj00vBBz46YX; Sun, 3 Nov 2019 13:03:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02EE6C3B6; Sun, 3 Nov 2019 13:03:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3D3lCl068261; Sun, 3 Nov 2019 13:03:47 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3D3lJp068260; Sun, 3 Nov 2019 13:03:47 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911031303.xA3D3lJp068260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 13:03:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354282 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 13:03:48 -0000 Author: tsoome Date: Sun Nov 3 13:03:47 2019 New Revision: 354282 URL: https://svnweb.freebsd.org/changeset/base/354282 Log: loader: should check malloc in zfs_dev_open malloc can return NULL. Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Sun Nov 3 11:52:50 2019 (r354281) +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 13:03:47 2019 (r354282) @@ -669,6 +669,8 @@ zfs_dev_open(struct open_file *f, ...) if (!spa) return (ENXIO); mount = malloc(sizeof(*mount)); + if (mount == NULL) + return (ENOMEM); rv = zfs_mount(spa, dev->root_guid, mount); if (rv != 0) { free(mount); From owner-svn-src-all@freebsd.org Sun Nov 3 13:25:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FE0B1B4E71; Sun, 3 Nov 2019 13:25:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475cBN0zstz47rM; Sun, 3 Nov 2019 13:25:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06570C75B; Sun, 3 Nov 2019 13:25:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3DPlff080389; Sun, 3 Nov 2019 13:25:47 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3DPl3B080386; Sun, 3 Nov 2019 13:25:47 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911031325.xA3DPl3B080386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 13:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Commit-Revision: 354283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 13:25:48 -0000 Author: tsoome Date: Sun Nov 3 13:25:47 2019 New Revision: 354283 URL: https://svnweb.freebsd.org/changeset/base/354283 Log: loader: we do not support booting from pool with log device If pool has log device, stop there and tell about it. Modified: head/stand/libsa/zfs/zfs.c head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Sun Nov 3 13:03:47 2019 (r354282) +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 13:25:47 2019 (r354283) @@ -668,6 +668,11 @@ zfs_dev_open(struct open_file *f, ...) spa = spa_find_by_guid(dev->pool_guid); if (!spa) return (ENXIO); + if (spa->spa_with_log) { + printf("Reading pool %s is not supported due to log device.\n", + spa->spa_name); + return (ENXIO); + } mount = malloc(sizeof(*mount)); if (mount == NULL) return (ENOMEM); Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:03:47 2019 (r354282) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:25:47 2019 (r354283) @@ -1109,6 +1109,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde const unsigned char *kids; int nkids, i, is_new; uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_present; + uint64_t is_log; if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, NULL, &guid) @@ -1132,17 +1133,20 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde } is_offline = is_removed = is_faulted = is_degraded = isnt_present = 0; + is_log = 0; nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, NULL, - &is_offline); + &is_offline); nvlist_find(nvlist, ZPOOL_CONFIG_REMOVED, DATA_TYPE_UINT64, NULL, - &is_removed); + &is_removed); nvlist_find(nvlist, ZPOOL_CONFIG_FAULTED, DATA_TYPE_UINT64, NULL, - &is_faulted); + &is_faulted); nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, NULL, - &is_degraded); + &is_degraded); nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, NULL, - &isnt_present); + &isnt_present); + nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, NULL, + &is_log); vdev = vdev_find(guid); if (!vdev) { @@ -1217,6 +1221,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vde return (ENOMEM); vdev->v_name = name; } + vdev->v_islog = is_log == 1; } else { is_new = 0; } @@ -1433,6 +1438,12 @@ vdev_status(vdev_t *vdev, int indent) { vdev_t *kid; int ret; + + if (vdev->v_islog) { + (void)pager_output(" logs\n"); + indent++; + } + ret = print_state(indent, vdev->v_name, vdev->v_state); if (ret != 0) return (ret); @@ -1737,6 +1748,12 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s printf("ZFS: inconsistent nvlist contents\n"); return (EIO); } + + /* + * We do not support reading pools with log device. + */ + if (vdev->v_islog) + spa->spa_with_log = vdev->v_islog; /* * Re-evaluate top-level vdev state. Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:03:47 2019 (r354282) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:25:47 2019 (r354283) @@ -1670,6 +1670,7 @@ typedef struct vdev { vdev_phys_read_t *v_phys_read; /* read from raw leaf vdev */ vdev_read_t *v_read; /* read from vdev */ void *v_read_priv; /* private data for read function */ + boolean_t v_islog; struct spa *spa; /* link to spa */ /* * Values stored in the config for an indirect or removing vdev. @@ -1694,6 +1695,7 @@ typedef struct spa { zio_cksum_salt_t spa_cksum_salt; /* secret salt for cksum */ void *spa_cksum_tmpls[ZIO_CHECKSUM_FUNCTIONS]; int spa_inited; /* initialized */ + boolean_t spa_with_log; /* this pool has log */ } spa_t; /* IO related arguments. */ From owner-svn-src-all@freebsd.org Sun Nov 3 14:36:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC1E1B6D10; Sun, 3 Nov 2019 14:36:17 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475dlj45tzz4C9K; Sun, 3 Nov 2019 14:36:17 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B8C9D3C4; Sun, 3 Nov 2019 14:36:17 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3EaHO4022033; Sun, 3 Nov 2019 14:36:17 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3EaHdf022032; Sun, 3 Nov 2019 14:36:17 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911031436.xA3EaHdf022032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 14:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354284 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 14:36:17 -0000 Author: tsoome Date: Sun Nov 3 14:36:16 2019 New Revision: 354284 URL: https://svnweb.freebsd.org/changeset/base/354284 Log: loader: zfs.c is missing malloc checks, fix it malloc() can return NULL, we need to check the return value. Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Sun Nov 3 13:25:47 2019 (r354283) +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 14:36:16 2019 (r354284) @@ -110,9 +110,10 @@ zfs_open(const char *upath, struct open_file *f) return (EINVAL); /* allocate file system specific data structure */ - fp = malloc(sizeof(struct file)); - bzero(fp, sizeof(struct file)); - f->f_fsdata = (void *)fp; + fp = calloc(1, sizeof(struct file)); + if (fp == NULL) + return (ENOMEM); + f->f_fsdata = fp; rc = zfs_lookup(mount, upath, &fp->f_dnode); fp->f_seekp = 0; @@ -129,9 +130,7 @@ zfs_close(struct open_file *f) struct file *fp = (struct file *)f->f_fsdata; dnode_cache_obj = NULL; - f->f_fsdata = (void *)0; - if (fp == (struct file *)0) - return (0); + f->f_fsdata = NULL; free(fp); return (0); @@ -250,7 +249,9 @@ zfs_readdir(struct open_file *f, struct dirent *d) return (rc); fp->f_seekp = bsize; - fp->f_zap_leaf = (zap_leaf_phys_t *)malloc(bsize); + fp->f_zap_leaf = malloc(bsize); + if (fp->f_zap_leaf == NULL) + return (ENOMEM); rc = dnode_read(spa, &fp->f_dnode, fp->f_seekp, fp->f_zap_leaf, @@ -675,8 +676,9 @@ zfs_dev_open(struct open_file *f, ...) } mount = malloc(sizeof(*mount)); if (mount == NULL) - return (ENOMEM); - rv = zfs_mount(spa, dev->root_guid, mount); + rv = ENOMEM; + else + rv = zfs_mount(spa, dev->root_guid, mount); if (rv != 0) { free(mount); return (rv); From owner-svn-src-all@freebsd.org Sun Nov 3 15:42:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DE3B178611; Sun, 3 Nov 2019 15:42:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475gCk3HJ2z4Gtk; Sun, 3 Nov 2019 15:42:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54588DFF3; Sun, 3 Nov 2019 15:42:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3FgAuu061990; Sun, 3 Nov 2019 15:42:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Fg8pq061983; Sun, 3 Nov 2019 15:42:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911031542.xA3Fg8pq061983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 3 Nov 2019 15:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354285 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 354285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 15:42:10 -0000 Author: andrew Date: Sun Nov 3 15:42:08 2019 New Revision: 354285 URL: https://svnweb.freebsd.org/changeset/base/354285 Log: Add support for setting hardware breakpoints from ptrace on arm64. Implement get/fill_dbregs on arm64. This is used by ptrace with the PT_GETDBREGS and PT_SETDBREGS requests. It allows userspace to set hardware breakpoints. The struct dbreg is based on Linux to ease adding hardware breakpoint support to debuggers. Reviewed by: jhb Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22195 Modified: head/sys/arm64/arm64/debug_monitor.c head/sys/arm64/arm64/exception.S head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/trap.c head/sys/arm64/include/armreg.h head/sys/arm64/include/pcb.h head/sys/arm64/include/reg.h Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/arm64/debug_monitor.c Sun Nov 3 15:42:08 2019 (r354285) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,10 @@ static struct debug_monitor_state kernel_monitor = { .dbg_flags = DBGMON_KERNEL }; +/* Called from the exception handlers */ +void dbg_monitor_enter(struct thread *); +void dbg_monitor_exit(struct thread *, struct trapframe *); + /* Watchpoints/breakpoints control register bitfields */ #define DBG_WATCH_CTRL_LEN_1 (0x1 << 5) #define DBG_WATCH_CTRL_LEN_2 (0x3 << 5) @@ -496,4 +501,58 @@ dbg_monitor_init(void) } dbg_enable(); +} + +void +dbg_monitor_enter(struct thread *thread) +{ + int i; + + if ((kernel_monitor.dbg_flags & DBGMON_ENABLED) != 0) { + /* Install the kernel version of the registers */ + dbg_register_sync(&kernel_monitor); + } else if ((thread->td_pcb->pcb_dbg_regs.dbg_flags & DBGMON_ENABLED) != 0) { + /* Disable the user breakpoints until we return to userspace */ + for (i = 0; i < dbg_watchpoint_num; i++) { + dbg_wb_write_reg(DBG_REG_BASE_WCR, i, 0); + dbg_wb_write_reg(DBG_REG_BASE_WVR, i, 0); + } + + for (i = 0; i < dbg_breakpoint_num; ++i) { + dbg_wb_write_reg(DBG_REG_BASE_BCR, i, 0); + dbg_wb_write_reg(DBG_REG_BASE_BVR, i, 0); + } + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) & + ~(DBG_MDSCR_MDE | DBG_MDSCR_KDE)); + isb(); + } +} + +void +dbg_monitor_exit(struct thread *thread, struct trapframe *frame) +{ + int i; + + frame->tf_spsr |= PSR_D; + if ((thread->td_pcb->pcb_dbg_regs.dbg_flags & DBGMON_ENABLED) != 0) { + /* Install the kernel version of the registers */ + dbg_register_sync(&thread->td_pcb->pcb_dbg_regs); + frame->tf_spsr &= ~PSR_D; + } else if ((kernel_monitor.dbg_flags & DBGMON_ENABLED) != 0) { + /* Disable the user breakpoints until we return to userspace */ + for (i = 0; i < dbg_watchpoint_num; i++) { + dbg_wb_write_reg(DBG_REG_BASE_WCR, i, 0); + dbg_wb_write_reg(DBG_REG_BASE_WVR, i, 0); + } + + for (i = 0; i < dbg_breakpoint_num; ++i) { + dbg_wb_write_reg(DBG_REG_BASE_BCR, i, 0); + dbg_wb_write_reg(DBG_REG_BASE_BVR, i, 0); + } + WRITE_SPECIALREG(mdscr_el1, + READ_SPECIALREG(mdscr_el1) & + ~(DBG_MDSCR_MDE | DBG_MDSCR_KDE)); + isb(); + } } Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/arm64/exception.S Sun Nov 3 15:42:08 2019 (r354285) @@ -73,6 +73,9 @@ __FBSDID("$FreeBSD$"); mov w0, #1 blr x1 1: + + ldr x0, [x18, #(PC_CURTHREAD)] + bl dbg_monitor_enter .endif msr daifclr, #8 /* Enable the debug exception */ .endm @@ -87,6 +90,10 @@ __FBSDID("$FreeBSD$"); msr daifset, #10 .endif .if \el == 0 + ldr x0, [x18, #PC_CURTHREAD] + mov x1, sp + bl dbg_monitor_exit + /* Remove the SSBD (CVE-2018-3639) workaround if needed */ ldr x1, [x18, #PC_SSBD] cbz x1, 1f Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/arm64/identcpu.c Sun Nov 3 15:42:08 2019 (r354285) @@ -320,7 +320,7 @@ static struct mrs_field id_aa64dfr0_fields[] = { MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, id_aa64dfr0_ctx_cmps), MRS_FIELD(ID_AA64DFR0, WRPs, false, MRS_EXACT, id_aa64dfr0_wrps), - MRS_FIELD(ID_AA64DFR0, BRPs, false, MRS_EXACT, id_aa64dfr0_brps), + MRS_FIELD(ID_AA64DFR0, BRPs, false, MRS_LOWER, id_aa64dfr0_brps), MRS_FIELD(ID_AA64DFR0, PMUVer, false, MRS_EXACT, id_aa64dfr0_pmuver), MRS_FIELD(ID_AA64DFR0, TraceVer, false, MRS_EXACT, id_aa64dfr0_tracever), Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/arm64/machdep.c Sun Nov 3 15:42:08 2019 (r354285) @@ -281,17 +281,60 @@ set_fpregs(struct thread *td, struct fpreg *regs) int fill_dbregs(struct thread *td, struct dbreg *regs) { + struct debug_monitor_state *monitor; + int count, i; + uint8_t debug_ver, nbkpts; - printf("ARM64TODO: fill_dbregs"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + + extract_user_id_field(ID_AA64DFR0_EL1, ID_AA64DFR0_DebugVer_SHIFT, + &debug_ver); + extract_user_id_field(ID_AA64DFR0_EL1, ID_AA64DFR0_BRPs_SHIFT, + &nbkpts); + + /* + * The BRPs field contains the number of breakpoints - 1. Armv8-A + * allows the hardware to provide 2-16 breakpoints so this won't + * overflow an 8 bit value. + */ + count = nbkpts + 1; + + regs->db_info = debug_ver; + regs->db_info <<= 8; + regs->db_info |= count; + + monitor = &td->td_pcb->pcb_dbg_regs; + if ((monitor->dbg_flags & DBGMON_ENABLED) != 0) { + for (i = 0; i < count; i++) { + regs->db_regs[i].dbr_addr = monitor->dbg_bvr[i]; + regs->db_regs[i].dbr_ctrl = monitor->dbg_bcr[i]; + } + } + + return (0); } int set_dbregs(struct thread *td, struct dbreg *regs) { + struct debug_monitor_state *monitor; + int count; + int i; - printf("ARM64TODO: set_dbregs"); - return (EDOOFUS); + monitor = &td->td_pcb->pcb_dbg_regs; + count = 0; + monitor->dbg_enable_count = 0; + for (i = 0; i < DBG_BRP_MAX; i++) { + /* TODO: Check these values */ + monitor->dbg_bvr[i] = regs->db_regs[i].dbr_addr; + monitor->dbg_bcr[i] = regs->db_regs[i].dbr_ctrl; + if ((monitor->dbg_bcr[i] & 1) != 0) + monitor->dbg_enable_count++; + } + if (monitor->dbg_enable_count > 0) + monitor->dbg_flags |= DBGMON_ENABLED; + + return (0); } #ifdef COMPAT_FREEBSD32 Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/arm64/trap.c Sun Nov 3 15:42:08 2019 (r354285) @@ -482,6 +482,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr); userret(td, frame); break; + case EXCP_BRKPT_EL0: case EXCP_BRK: call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr); userret(td, frame); Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/include/armreg.h Sun Nov 3 15:42:08 2019 (r354285) @@ -163,6 +163,7 @@ #define EXCP_SP_ALIGN 0x26 /* SP slignment fault */ #define EXCP_TRAP_FP 0x2c /* Trapped FP exception */ #define EXCP_SERROR 0x2f /* SError interrupt */ +#define EXCP_BRKPT_EL0 0x30 /* Hardware breakpoint, from same EL */ #define EXCP_SOFTSTP_EL0 0x32 /* Software Step, from lower EL */ #define EXCP_SOFTSTP_EL1 0x33 /* Software Step, from same EL */ #define EXCP_WATCHPT_EL1 0x35 /* Watchpoint, from same EL */ Modified: head/sys/arm64/include/pcb.h ============================================================================== --- head/sys/arm64/include/pcb.h Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/include/pcb.h Sun Nov 3 15:42:08 2019 (r354285) @@ -31,6 +31,7 @@ #ifndef LOCORE +#include #include struct trapframe; @@ -66,6 +67,8 @@ struct pcb { * Place last to simplify the asm to access the rest if the struct. */ struct vfpstate pcb_fpustate; + + struct debug_monitor_state pcb_dbg_regs; }; #ifdef _KERNEL Modified: head/sys/arm64/include/reg.h ============================================================================== --- head/sys/arm64/include/reg.h Sun Nov 3 14:36:16 2019 (r354284) +++ head/sys/arm64/include/reg.h Sun Nov 3 15:42:08 2019 (r354285) @@ -60,7 +60,14 @@ struct fpreg32 { }; struct dbreg { - int dummy; + uint32_t db_info; + uint32_t db_pad; + + struct { + uint64_t dbr_addr; + uint32_t dbr_ctrl; + uint32_t dbr_pad; + } db_regs[16]; }; struct dbreg32 { From owner-svn-src-all@freebsd.org Sun Nov 3 17:42:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7385317DB71; Sun, 3 Nov 2019 17:42:50 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475jtx1Gt1z3CCt; Sun, 3 Nov 2019 17:42:48 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f51.google.com with SMTP id y127so10532386lfc.0; Sun, 03 Nov 2019 09:42:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=e+zRV3ljPagJRtbpi2ebqnRMQNvzP6j1m6f5NKgYE6w=; b=ltJWTq0V6wK7mEv4Ctn563dvmU9RiPPrzGa2WtprEyiW9kRRaaEODv5ptEDKgkfkXW 4e3tflWB/oLMAseTubzGBLXC4c3NxHFwjktHxtyI9E52fxqeaMcOD3Vfnd7PWuJZ5n0m pUmson8XocnzA0UZ8ipaoGKQ1mfx/UHJZl71K1n4chLmQbxH25Q0yN+dz4fhrnH4ai+F zjTXcAiil2E+bafQH1/VwVhJghNi7vO44rfYRPMLeIECnJQQRRenUXoJxvrhFKiJqHx0 /cBSxTFBdA8h37LcopuX6VOsWYR9EaT6rnsKuTGJHAZUNotS/lVT7nKY9R817zpFadVP YsaQ== X-Gm-Message-State: APjAAAVupNVmcL5jcH9XPD+Cuzpb+2jd97k6P0C8pl+zFEmnMlQPLwPn lgCq8gsw/9WGZ8RHxu5tNI5YqSX65Xw= X-Google-Smtp-Source: APXvYqxYUD1IbydmcbAy3ru59n3jz8N4fZ37kVY4sVoWAa68km/sLt3QO483j8vnSjLnyoyfzTvAng== X-Received: by 2002:ac2:5496:: with SMTP id t22mr12079074lfk.31.1572802966896; Sun, 03 Nov 2019 09:42:46 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 190sm7020196ljj.72.2019.11.03.09.42.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Nov 2019 09:42:45 -0800 (PST) Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs To: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911031325.xA3DPl3B080386@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> Date: Sun, 3 Nov 2019 19:42:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201911031325.xA3DPl3B080386@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 475jtx1Gt1z3CCt X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.17 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.17)[ip: (-0.55), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.03), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[51.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[51.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 17:42:50 -0000 On 03/11/2019 15:25, Toomas Soome wrote: > Author: tsoome > Date: Sun Nov 3 13:25:47 2019 > New Revision: 354283 > URL: https://svnweb.freebsd.org/changeset/base/354283 > > Log: > loader: we do not support booting from pool with log device > > If pool has log device, stop there and tell about it. Why? > Modified: > head/stand/libsa/zfs/zfs.c > head/stand/libsa/zfs/zfsimpl.c > head/sys/cddl/boot/zfs/zfsimpl.h -- Andriy Gapon From owner-svn-src-all@freebsd.org Sun Nov 3 17:45:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DE9A17DC36; Sun, 3 Nov 2019 17:45:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475jy60m2zz3CP3; Sun, 3 Nov 2019 17:45:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1ADFF6A4; Sun, 3 Nov 2019 17:45:33 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3HjXd6051384; Sun, 3 Nov 2019 17:45:33 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3HjVeV051369; Sun, 3 Nov 2019 17:45:31 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911031745.xA3HjVeV051369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 3 Nov 2019 17:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354286 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 354286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 17:45:34 -0000 Author: alc Date: Sun Nov 3 17:45:30 2019 New Revision: 354286 URL: https://svnweb.freebsd.org/changeset/base/354286 Log: Utilize ASIDs to reduce both the direct and indirect costs of context switching. The indirect costs being unnecessary TLB misses that are incurred when ASIDs are not used. In fact, currently, when we perform a context switch on one processor, we issue a broadcast TLB invalidation that flushes the TLB contents on every processor. Mark all user-space ("ttbr0") page table entries with the non-global flag so that they are cached in the TLB under their ASID. Correct an error in pmap_pinit0(). The pointer to the root of the page table was being initialized to the root of the kernel-space page table rather than a user-space page table. However, the root of the page table that was being cached in process 0's md_l0addr field correctly pointed to a user-space page table. As long as ASIDs weren't being used, this was harmless, except that it led to some unnecessary page table switches in pmap_switch(). Specifically, other kernel processes besides process 0 would have their md_l0addr field set to the root of the kernel-space page table, and so pmap_switch() would actually change page tables when switching between process 0 and other kernel processes. Implement a workaround for Cavium erratum 27456 affecting ThunderX machines. (I would like to thank andrew@ for providing the code to detect the affected machines.) Address integer overflow in the definition of TCR_ASID_16. Setup TCR according to the PARange and ASIDBits fields from ID_AA64MMFR0_EL1. Previously, TCR_ASID_16 was unconditionally set. Modify build_l1_block_pagetable so that lower attributes, such as ATTR_nG, can be specified as a parameter. Eliminate some unused code. Earlier versions were tested to varying degrees by: andrew, emaste, markj MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D21922 Modified: head/sys/arm64/arm64/cpu_errata.c head/sys/arm64/arm64/cpufunc_asm.S head/sys/arm64/arm64/efirt_machdep.c head/sys/arm64/arm64/genassym.c head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/armreg.h head/sys/arm64/include/cpufunc.h head/sys/arm64/include/pcpu.h head/sys/arm64/include/pmap.h head/sys/arm64/include/proc.h Modified: head/sys/arm64/arm64/cpu_errata.c ============================================================================== --- head/sys/arm64/arm64/cpu_errata.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/cpu_errata.c Sun Nov 3 17:45:30 2019 (r354286) @@ -59,6 +59,7 @@ static enum { static cpu_quirk_install install_psci_bp_hardening; static cpu_quirk_install install_ssbd_workaround; +static cpu_quirk_install install_thunderx_bcast_tlbi_workaround; static struct cpu_quirks cpu_quirks[] = { { @@ -92,6 +93,18 @@ static struct cpu_quirks cpu_quirks[] = { .midr_value = 0, .quirk_install = install_ssbd_workaround, }, + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = + CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDERX, 0, 0), + .quirk_install = install_thunderx_bcast_tlbi_workaround, + }, + { + .midr_mask = CPU_IMPL_MASK | CPU_PART_MASK, + .midr_value = + CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDERX_81XX, 0, 0), + .quirk_install = install_thunderx_bcast_tlbi_workaround, + }, }; static void @@ -135,6 +148,30 @@ install_ssbd_workaround(void) default: PCPU_SET(ssbd, smccc_arch_workaround_2); break; + } +} + +/* + * Workaround Cavium erratum 27456. + * + * Invalidate the local icache when changing address spaces. + */ +static void +install_thunderx_bcast_tlbi_workaround(void) +{ + u_int midr; + + midr = get_midr(); + if (CPU_PART(midr) == CPU_PART_THUNDERX_81XX) + PCPU_SET(bcast_tlbi_workaround, 1); + else if (CPU_PART(midr) == CPU_PART_THUNDERX) { + if (CPU_VAR(midr) == 0) { + /* ThunderX 1.x */ + PCPU_SET(bcast_tlbi_workaround, 1); + } else if (CPU_VAR(midr) == 1 && CPU_REV(midr) <= 1) { + /* ThunderX 2.0 - 2.1 */ + PCPU_SET(bcast_tlbi_workaround, 1); + } } } Modified: head/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- head/sys/arm64/arm64/cpufunc_asm.S Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/cpufunc_asm.S Sun Nov 3 17:45:30 2019 (r354286) @@ -93,14 +93,6 @@ END(arm64_nullop) * Generic functions to read/modify/write the internal coprocessor registers */ -ENTRY(arm64_setttb) - dsb ish - msr ttbr0_el1, x0 - dsb ish - isb - ret -END(arm64_setttb) - ENTRY(arm64_tlb_flushID) dsb ishst #ifdef SMP Modified: head/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- head/sys/arm64/arm64/efirt_machdep.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/efirt_machdep.c Sun Nov 3 17:45:30 2019 (r354286) @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); #include static vm_object_t obj_1t1_pt; -static vm_page_t efi_l0_page; -static pd_entry_t *efi_l0; static vm_pindex_t efi_1t1_idx; +static pd_entry_t *efi_l0; +static uint64_t efi_ttbr0; void efi_destroy_1t1_map(void) @@ -81,8 +81,9 @@ efi_destroy_1t1_map(void) } obj_1t1_pt = NULL; + efi_1t1_idx = 0; efi_l0 = NULL; - efi_l0_page = NULL; + efi_ttbr0 = 0; } static vm_page_t @@ -164,6 +165,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int struct efi_md *p; pt_entry_t *l3, l3_attr; vm_offset_t va; + vm_page_t efi_l0_page; uint64_t idx; int i, mode; @@ -172,10 +174,11 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int L0_ENTRIES * Ln_ENTRIES * Ln_ENTRIES * Ln_ENTRIES, VM_PROT_ALL, 0, NULL); VM_OBJECT_WLOCK(obj_1t1_pt); - efi_1t1_idx = 0; efi_l0_page = efi_1t1_page(); VM_OBJECT_WUNLOCK(obj_1t1_pt); efi_l0 = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(efi_l0_page)); + efi_ttbr0 = ASID_TO_OPERAND(ASID_RESERVED_FOR_EFI) | + VM_PAGE_TO_PHYS(efi_l0_page); for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, descsz)) { @@ -213,7 +216,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int printf("MAP %lx mode %x pages %lu\n", p->md_phys, mode, p->md_pages); l3_attr = ATTR_DEFAULT | ATTR_IDX(mode) | ATTR_AP(ATTR_AP_RW) | - L3_PAGE; + ATTR_nG | L3_PAGE; if (mode == VM_MEMATTR_DEVICE || p->md_attr & EFI_MD_ATTR_XP) l3_attr |= ATTR_UXN | ATTR_PXN; @@ -236,42 +239,37 @@ int efi_arch_enter(void) { - __asm __volatile( - "msr ttbr0_el1, %0 \n" - "isb \n" - "dsb ishst \n" - "tlbi vmalle1is \n" - "dsb ish \n" - "isb \n" - : : "r"(VM_PAGE_TO_PHYS(efi_l0_page))); + CRITICAL_ASSERT(curthread); + /* + * Temporarily switch to EFI's page table. However, we leave curpmap + * unchanged in order to prevent its ASID from being reclaimed before + * we switch back to its page table in efi_arch_leave(). + */ + set_ttbr0(efi_ttbr0); + if (PCPU_GET(bcast_tlbi_workaround) != 0) + invalidate_local_icache(); + return (0); } void efi_arch_leave(void) { - struct thread *td; /* * Restore the pcpu pointer. Some UEFI implementations trash it and * we don't store it before calling into them. To fix this we need * to restore it after returning to the kernel context. As reading - * curthread will access x18 we need to restore it before loading - * the thread pointer. + * curpmap will access x18 we need to restore it before loading + * the pmap pointer. */ __asm __volatile( "mrs x18, tpidr_el1 \n" ); - td = curthread; - __asm __volatile( - "msr ttbr0_el1, %0 \n" - "isb \n" - "dsb ishst \n" - "tlbi vmalle1is \n" - "dsb ish \n" - "isb \n" - : : "r"(td->td_proc->p_md.md_l0addr)); + set_ttbr0(pmap_to_ttbr0(PCPU_GET(curpmap))); + if (PCPU_GET(bcast_tlbi_workaround) != 0) + invalidate_local_icache(); } int Modified: head/sys/arm64/arm64/genassym.c ============================================================================== --- head/sys/arm64/arm64/genassym.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/genassym.c Sun Nov 3 17:45:30 2019 (r354286) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); @@ -53,9 +52,6 @@ ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); - -ASSYM(P_MD, offsetof(struct proc, p_md)); -ASSYM(MD_L0ADDR, offsetof(struct mdproc, md_l0addr)); ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/locore.S Sun Nov 3 17:45:30 2019 (r354286) @@ -392,14 +392,15 @@ create_pagetables: bl link_l0_pagetable /* - * Build the TTBR0 maps. + * Build the TTBR0 maps. As TTBR0 maps, they must specify ATTR_nG. + * They are only needed early on, so the VA = PA map is uncached. */ add x27, x24, #PAGE_SIZE mov x6, x27 /* The initial page table */ #if defined(SOCDEV_PA) && defined(SOCDEV_VA) /* Create a table for the UART */ - mov x7, #DEVICE_MEM + mov x7, #(ATTR_nG | ATTR_IDX(DEVICE_MEM)) mov x8, #(SOCDEV_VA) /* VA start */ mov x9, #(SOCDEV_PA) /* PA start */ mov x10, #1 @@ -407,7 +408,7 @@ create_pagetables: #endif /* Create the VA = PA map */ - mov x7, #NORMAL_UNCACHED /* Uncached as it's only needed early on */ + mov x7, #(ATTR_nG | ATTR_IDX(NORMAL_UNCACHED)) mov x9, x27 mov x8, x9 /* VA start (== PA start) */ mov x10, #1 @@ -497,7 +498,7 @@ link_l1_pagetable: /* * Builds count 1 GiB page table entry * x6 = L1 table - * x7 = Type (0 = Device, 1 = Normal) + * x7 = Variable lower block attributes * x8 = VA start * x9 = PA start (trashed) * x10 = Entry count @@ -512,8 +513,7 @@ build_l1_block_pagetable: and x11, x11, #Ln_ADDR_MASK /* Build the L1 block entry */ - lsl x12, x7, #2 - orr x12, x12, #L1_BLOCK + orr x12, x7, #L1_BLOCK orr x12, x12, #(ATTR_AF) #ifdef SMP orr x12, x12, ATTR_SH(ATTR_SH_IS) @@ -599,11 +599,17 @@ start_mmu: msr mair_el1, x2 /* - * Setup TCR according to PARange bits from ID_AA64MMFR0_EL1. + * Setup TCR according to the PARange and ASIDBits fields + * from ID_AA64MMFR0_EL1. More precisely, set TCR_EL1.AS + * to 1 only if the ASIDBits field equals 0b0010. */ ldr x2, tcr mrs x3, id_aa64mmfr0_el1 bfi x2, x3, #32, #3 + and x3, x3, #0xF0 + cmp x3, #0x20 + cset x3, eq + bfi x2, x3, #36, #1 msr tcr_el1, x2 /* Setup SCTLR */ @@ -624,7 +630,7 @@ mair: MAIR_ATTR(MAIR_NORMAL_WB, 2) | \ MAIR_ATTR(MAIR_NORMAL_WT, 3) tcr: - .quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_ASID_16 | TCR_TG1_4K | \ + .quad (TCR_TxSZ(64 - VIRT_BITS) | TCR_TG1_4K | \ TCR_CACHE_ATTRS | TCR_SMP_ATTRS) sctlr_set: /* Bits to set */ Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/machdep.c Sun Nov 3 17:45:30 2019 (r354286) @@ -797,9 +797,6 @@ init_proc0(vm_offset_t kstack) thread0.td_pcb->pcb_vfpcpu = UINT_MAX; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; - - /* Set the base address of translation table 0. */ - thread0.td_proc->p_md.md_l0addr = READ_SPECIALREG(ttbr0_el1); } typedef struct { Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/mp_machdep.c Sun Nov 3 17:45:30 2019 (r354286) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -192,6 +193,7 @@ void init_secondary(uint64_t cpu) { struct pcpu *pcpup; + pmap_t pmap0; pcpup = &__pcpu[cpu]; /* @@ -210,6 +212,12 @@ init_secondary(uint64_t cpu) KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; pcpup->pc_curpcb = pcpup->pc_idlethread->td_pcb; + + /* Initialize curpmap to match TTBR0's current setting. */ + pmap0 = vmspace_pmap(&vmspace0); + KASSERT(pmap_to_ttbr0(pmap0) == READ_SPECIALREG(ttbr0_el1), + ("pmap0 doesn't match cpu %ld's ttbr0", cpu)); + pcpup->pc_curpmap = pmap0; /* * Identify current CPU. This is necessary to setup Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/pmap.c Sun Nov 3 17:45:30 2019 (r354286) @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -276,6 +277,48 @@ static u_int physmap_idx; static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +/* + * This ASID allocator uses a bit vector ("asid_set") to remember which ASIDs + * that it has currently allocated to a pmap, a cursor ("asid_next") to + * optimize its search for a free ASID in the bit vector, and an epoch number + * ("asid_epoch") to indicate when it has reclaimed all previously allocated + * ASIDs that are not currently active on a processor. + * + * The current epoch number is always in the range [0, INT_MAX). Negative + * numbers and INT_MAX are reserved for special cases that are described + * below. + */ +static SYSCTL_NODE(_vm_pmap, OID_AUTO, asid, CTLFLAG_RD, 0, "ASID allocator"); +static int asid_bits; +SYSCTL_INT(_vm_pmap_asid, OID_AUTO, bits, CTLFLAG_RD, &asid_bits, 0, + "The number of bits in an ASID"); +static bitstr_t *asid_set; +static int asid_set_size; +static int asid_next; +SYSCTL_INT(_vm_pmap_asid, OID_AUTO, next, CTLFLAG_RD, &asid_next, 0, + "The last allocated ASID plus one"); +static int asid_epoch; +SYSCTL_INT(_vm_pmap_asid, OID_AUTO, epoch, CTLFLAG_RD, &asid_epoch, 0, + "The current epoch number"); +static struct mtx asid_set_mutex; + +/* + * A pmap's cookie encodes an ASID and epoch number. Cookies for reserved + * ASIDs have a negative epoch number, specifically, INT_MIN. Cookies for + * dynamically allocated ASIDs have a non-negative epoch number. + * + * An invalid ASID is represented by -1. + * + * There are two special-case cookie values: (1) COOKIE_FROM(-1, INT_MIN), + * which indicates that an ASID should never be allocated to the pmap, and + * (2) COOKIE_FROM(-1, INT_MAX), which indicates that an ASID should be + * allocated when the pmap is next activated. + */ +#define COOKIE_FROM(asid, epoch) ((long)((u_int)(asid) | \ + ((u_long)(epoch) << 32))) +#define COOKIE_TO_ASID(cookie) ((int)(cookie)) +#define COOKIE_TO_EPOCH(cookie) ((int)((u_long)(cookie) >> 32)) + static int superpages_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &superpages_enabled, 0, @@ -295,6 +338,8 @@ static void pmap_pvh_free(struct md_page *pvh, pmap_t static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static bool pmap_activate_int(pmap_t pmap); +static void pmap_alloc_asid(pmap_t pmap); static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode); static pt_entry_t *pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va); static pt_entry_t *pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, @@ -308,6 +353,7 @@ static int pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, pd_entry_t l1e, struct spglist *free, struct rwlock **lockp); static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t sva, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp); +static void pmap_reset_asid_set(void); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m, struct rwlock **lockp); @@ -786,6 +832,10 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ uint64_t kern_delta; int i; + /* Verify that the ASID is set through TTBR0. */ + KASSERT((READ_SPECIALREG(tcr_el1) & TCR_A1) == 0, + ("pmap_bootstrap: TCR_EL1.A1 != 0")); + kern_delta = KERNBASE - kernstart; printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen); @@ -795,6 +845,8 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ /* Set this early so we can use the pagetable walking functions */ kernel_pmap_store.pm_l0 = (pd_entry_t *)l0pt; PMAP_LOCK_INIT(kernel_pmap); + kernel_pmap->pm_l0_paddr = l0pt - kern_delta; + kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); /* Assume the address we were loaded to is a valid physical address */ min_pa = KERNBASE - kern_delta; @@ -908,6 +960,11 @@ pmap_init(void) int i, pv_npg; /* + * Determine whether an ASID is 8 or 16 bits in size. + */ + asid_bits = (READ_SPECIALREG(tcr_el1) & TCR_ASID_16) != 0 ? 16 : 8; + + /* * Are large page mappings enabled? */ TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled); @@ -918,6 +975,18 @@ pmap_init(void) } /* + * Initialize the ASID allocator. At this point, we are still too + * early in the overall initialization process to use bit_alloc(). + */ + asid_set_size = 1 << asid_bits; + asid_set = (bitstr_t *)kmem_malloc(bitstr_size(asid_set_size), + M_WAITOK | M_ZERO); + for (i = 0; i < ASID_FIRST_AVAILABLE; i++) + bit_set(asid_set, i); + asid_next = ASID_FIRST_AVAILABLE; + mtx_init(&asid_set_mutex, "asid set", NULL, MTX_SPIN); + + /* * Initialize the pv chunk list mutex. */ mtx_init(&pv_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF); @@ -971,30 +1040,42 @@ SYSCTL_ULONG(_vm_pmap_l2, OID_AUTO, promotions, CTLFLA static __inline void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { + uint64_t r; sched_pin(); - __asm __volatile( - "dsb ishst \n" - "tlbi vaae1is, %0 \n" - "dsb ish \n" - "isb \n" - : : "r"(va >> PAGE_SHIFT)); + dsb(ishst); + if (pmap == kernel_pmap) { + r = atop(va); + __asm __volatile("tlbi vaae1is, %0" : : "r" (r)); + } else { + r = ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)) | atop(va); + __asm __volatile("tlbi vae1is, %0" : : "r" (r)); + } + dsb(ish); + isb(); sched_unpin(); } static __inline void pmap_invalidate_range_nopin(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - vm_offset_t addr; + uint64_t end, r, start; dsb(ishst); - for (addr = sva; addr < eva; addr += PAGE_SIZE) { - __asm __volatile( - "tlbi vaae1is, %0" : : "r"(addr >> PAGE_SHIFT)); + if (pmap == kernel_pmap) { + start = atop(sva); + end = atop(eva); + for (r = start; r < end; r++) + __asm __volatile("tlbi vaae1is, %0" : : "r" (r)); + } else { + start = end = ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)); + start |= atop(sva); + end |= atop(eva); + for (r = start; r < end; r++) + __asm __volatile("tlbi vae1is, %0" : : "r" (r)); } - __asm __volatile( - "dsb ish \n" - "isb \n"); + dsb(ish); + isb(); } static __inline void @@ -1009,13 +1090,18 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm static __inline void pmap_invalidate_all(pmap_t pmap) { + uint64_t r; sched_pin(); - __asm __volatile( - "dsb ishst \n" - "tlbi vmalle1is \n" - "dsb ish \n" - "isb \n"); + dsb(ishst); + if (pmap == kernel_pmap) { + __asm __volatile("tlbi vmalle1is"); + } else { + r = ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)); + __asm __volatile("tlbi aside1is, %0" : : "r" (r)); + } + dsb(ish); + isb(); sched_unpin(); } @@ -1446,14 +1532,17 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); - pmap->pm_l0 = kernel_pmap->pm_l0; + pmap->pm_l0_paddr = READ_SPECIALREG(ttbr0_el1); + pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); pmap->pm_root.rt_root = 0; + pmap->pm_cookie = COOKIE_FROM(ASID_RESERVED_FOR_PID_0, INT_MIN); + + PCPU_SET(curpmap, pmap); } int pmap_pinit(pmap_t pmap) { - vm_paddr_t l0phys; vm_page_t l0pt; /* @@ -1463,14 +1552,15 @@ pmap_pinit(pmap_t pmap) VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) vm_wait(NULL); - l0phys = VM_PAGE_TO_PHYS(l0pt); - pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(l0phys); + pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(l0pt); + pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); if ((l0pt->flags & PG_ZERO) == 0) pagezero(pmap->pm_l0); pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); + pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); return (1); } @@ -1712,6 +1802,7 @@ void pmap_release(pmap_t pmap) { vm_page_t m; + int asid; KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", @@ -1719,8 +1810,16 @@ pmap_release(pmap_t pmap) KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); - m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l0)); + mtx_lock_spin(&asid_set_mutex); + if (COOKIE_TO_EPOCH(pmap->pm_cookie) == asid_epoch) { + asid = COOKIE_TO_ASID(pmap->pm_cookie); + KASSERT(asid >= ASID_FIRST_AVAILABLE && asid < asid_set_size, + ("pmap_release: pmap cookie has out-of-range asid")); + bit_clear(asid_set, asid); + } + mtx_unlock_spin(&asid_set_mutex); + m = PHYS_TO_VM_PAGE(pmap->pm_l0_paddr); vm_page_unwire_noq(m); vm_page_free_zero(m); } @@ -3198,6 +3297,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; else new_l3 |= ATTR_UXN; + if (pmap != kernel_pmap) + new_l3 |= ATTR_nG; if ((m->oflags & VPO_UNMANAGED) == 0) { new_l3 |= ATTR_SW_MANAGED; if ((prot & VM_PROT_WRITE) != 0) { @@ -3462,6 +3563,8 @@ pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page new_l2 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; else new_l2 |= ATTR_UXN; + if (pmap != kernel_pmap) + new_l2 |= ATTR_nG; return (pmap_enter_l2(pmap, va, new_l2, PMAP_ENTER_NOSLEEP | PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp) == KERN_SUCCESS); @@ -3762,6 +3865,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v l3_val |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; else l3_val |= ATTR_UXN; + if (pmap != kernel_pmap) + l3_val |= ATTR_nG; /* * Now validate mapping with RO protection @@ -4299,6 +4404,8 @@ pmap_remove_pages(pmap_t pmap) int allfree, field, freed, idx, lvl; vm_paddr_t pa; + KASSERT(pmap == PCPU_GET(curpmap), ("non-current pmap %p", pmap)); + lock = NULL; SLIST_INIT(&free); @@ -5671,24 +5778,134 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t return (val); } +/* + * Garbage collect every ASID that is neither active on a processor nor + * reserved. + */ +static void +pmap_reset_asid_set(void) +{ + pmap_t pmap; + int asid, cpuid, epoch; + + mtx_assert(&asid_set_mutex, MA_OWNED); + + /* + * Ensure that the store to asid_epoch is globally visible before the + * loads from pc_curpmap are performed. + */ + epoch = asid_epoch + 1; + if (epoch == INT_MAX) + epoch = 0; + asid_epoch = epoch; + dsb(ishst); + __asm __volatile("tlbi vmalle1is"); + dsb(ish); + bit_nclear(asid_set, ASID_FIRST_AVAILABLE, asid_set_size - 1); + CPU_FOREACH(cpuid) { + if (cpuid == curcpu) + continue; + pmap = pcpu_find(cpuid)->pc_curpmap; + asid = COOKIE_TO_ASID(pmap->pm_cookie); + if (asid == -1) + continue; + bit_set(asid_set, asid); + pmap->pm_cookie = COOKIE_FROM(asid, epoch); + } +} + +/* + * Allocate a new ASID for the specified pmap. + */ +static void +pmap_alloc_asid(pmap_t pmap) +{ + int new_asid; + + mtx_lock_spin(&asid_set_mutex); + + /* + * While this processor was waiting to acquire the asid set mutex, + * pmap_reset_asid_set() running on another processor might have + * updated this pmap's cookie to the current epoch. In which case, we + * don't need to allocate a new ASID. + */ + if (COOKIE_TO_EPOCH(pmap->pm_cookie) == asid_epoch) + goto out; + + bit_ffc_at(asid_set, asid_next, asid_set_size, &new_asid); + if (new_asid == -1) { + bit_ffc_at(asid_set, ASID_FIRST_AVAILABLE, asid_next, + &new_asid); + if (new_asid == -1) { + pmap_reset_asid_set(); + bit_ffc_at(asid_set, ASID_FIRST_AVAILABLE, + asid_set_size, &new_asid); + KASSERT(new_asid != -1, ("ASID allocation failure")); + } + } + bit_set(asid_set, new_asid); + asid_next = new_asid + 1; + pmap->pm_cookie = COOKIE_FROM(new_asid, asid_epoch); +out: + mtx_unlock_spin(&asid_set_mutex); +} + +/* + * Compute the value that should be stored in ttbr0 to activate the specified + * pmap. This value may change from time to time. + */ +uint64_t +pmap_to_ttbr0(pmap_t pmap) +{ + + return (ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)) | + pmap->pm_l0_paddr); +} + +static bool +pmap_activate_int(pmap_t pmap) +{ + int epoch; + + KASSERT(PCPU_GET(curpmap) != NULL, ("no active pmap")); + KASSERT(pmap != kernel_pmap, ("kernel pmap activation")); + if (pmap == PCPU_GET(curpmap)) + return (false); + + /* + * Ensure that the store to curpmap is globally visible before the + * load from asid_epoch is performed. + */ + PCPU_SET(curpmap, pmap); + dsb(ish); + epoch = COOKIE_TO_EPOCH(pmap->pm_cookie); + if (epoch >= 0 && epoch != asid_epoch) + pmap_alloc_asid(pmap); + + set_ttbr0(pmap_to_ttbr0(pmap)); + if (PCPU_GET(bcast_tlbi_workaround) != 0) + invalidate_local_icache(); + return (true); +} + void pmap_activate(struct thread *td) { pmap_t pmap; - critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); - td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); - __asm __volatile( - "msr ttbr0_el1, %0 \n" - "isb \n" - : : "r"(td->td_proc->p_md.md_l0addr)); - pmap_invalidate_all(pmap); + critical_enter(); + (void)pmap_activate_int(pmap); critical_exit(); } +/* + * To eliminate the unused parameter "old", we would have to add an instruction + * to cpu_switch(). + */ struct pcb * -pmap_switch(struct thread *old, struct thread *new) +pmap_switch(struct thread *old __unused, struct thread *new) { pcpu_bp_harden bp_harden; struct pcb *pcb; @@ -5705,20 +5922,7 @@ pmap_switch(struct thread *old, struct thread *new) * to a user process. */ - if (old == NULL || - old->td_proc->p_md.md_l0addr != new->td_proc->p_md.md_l0addr) { - __asm __volatile( - /* Switch to the new pmap */ - "msr ttbr0_el1, %0 \n" - "isb \n" - - /* Invalidate the TLB */ - "dsb ishst \n" - "tlbi vmalle1is \n" - "dsb ish \n" - "isb \n" - : : "r"(new->td_proc->p_md.md_l0addr)); - + if (pmap_activate_int(vmspace_pmap(new->td_proc->p_vmspace))) { /* * Stop userspace from training the branch predictor against * other processes. This will call into a CPU specific Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/arm64/vm_machdep.c Sun Nov 3 17:45:30 2019 (r354286) @@ -91,9 +91,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t td2->td_pcb = pcb2; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - td2->td_proc->p_md.md_l0addr = - vtophys(vmspace_pmap(td2->td_proc->p_vmspace)->pm_l0); - tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1); bcopy(td1->td_frame, tf, sizeof(*tf)); tf->tf_x[0] = 0; Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/include/armreg.h Sun Nov 3 17:45:30 2019 (r354286) @@ -619,7 +619,7 @@ #define PSR_FLAGS 0xf0000000 /* TCR_EL1 - Translation Control Register */ -#define TCR_ASID_16 (1 << 36) +#define TCR_ASID_16 (0x1UL << 36) #define TCR_IPS_SHIFT 32 #define TCR_IPS_32BIT (0 << TCR_IPS_SHIFT) @@ -640,6 +640,8 @@ #define TCR_ORGN1_WBWA (0x1UL << TCR_ORGN1_SHIFT) #define TCR_IRGN1_SHIFT 24 #define TCR_IRGN1_WBWA (0x1UL << TCR_IRGN1_SHIFT) +#define TCR_A1_SHIFT 22 +#define TCR_A1 (0x1UL << TCR_A1_SHIFT) #define TCR_SH0_SHIFT 12 #define TCR_SH0_IS (0x3UL << TCR_SH0_SHIFT) #define TCR_ORGN0_SHIFT 10 Modified: head/sys/arm64/include/cpufunc.h ============================================================================== --- head/sys/arm64/include/cpufunc.h Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/include/cpufunc.h Sun Nov 3 17:45:30 2019 (r354286) @@ -178,6 +178,27 @@ clrex(void) __asm __volatile("clrex" : : : "memory"); } +static __inline void +set_ttbr0(uint64_t ttbr0) +{ + + __asm __volatile( + "msr ttbr0_el1, %0 \n" + "isb \n" + : + : "r" (ttbr0)); +} + +static __inline void +invalidate_local_icache(void) +{ + + __asm __volatile( + "ic iallu \n" + "dsb nsh \n" + "isb \n"); +} + extern int64_t dcache_line_size; extern int64_t icache_line_size; extern int64_t idcache_line_size; @@ -185,7 +206,6 @@ extern int64_t dczva_line_size; #define cpu_nullop() arm64_nullop() #define cpufunc_nullop() arm64_nullop() -#define cpu_setttb(a) arm64_setttb(a) #define cpu_tlb_flushID() arm64_tlb_flushID() @@ -198,7 +218,6 @@ extern int64_t dczva_line_size; #define cpu_icache_sync_range_checked(a, s) arm64_icache_sync_range_checked((a), (s)) void arm64_nullop(void); -void arm64_setttb(vm_offset_t); void arm64_tlb_flushID(void); void arm64_icache_sync_range(vm_offset_t, vm_size_t); int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t); Modified: head/sys/arm64/include/pcpu.h ============================================================================== --- head/sys/arm64/include/pcpu.h Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/include/pcpu.h Sun Nov 3 17:45:30 2019 (r354286) @@ -40,12 +40,14 @@ typedef int (*pcpu_ssbd)(int); struct debug_monitor_state; #define PCPU_MD_FIELDS \ - u_int pc_acpi_id; /* ACPI CPU id */ \ - u_int pc_midr; /* stored MIDR value */ \ + u_int pc_acpi_id; /* ACPI CPU id */ \ + u_int pc_midr; /* stored MIDR value */ \ uint64_t pc_clock; \ pcpu_bp_harden pc_bp_harden; \ pcpu_ssbd pc_ssbd; \ - char __pad[225] + struct pmap *pc_curpmap; \ + u_int pc_bcast_tlbi_workaround; \ + char __pad[213] #ifdef _KERNEL Modified: head/sys/arm64/include/pmap.h ============================================================================== --- head/sys/arm64/include/pmap.h Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/include/pmap.h Sun Nov 3 17:45:30 2019 (r354286) @@ -79,10 +79,12 @@ struct pv_addr { struct pmap { struct mtx pm_mtx; - struct pmap_statistics pm_stats; /* pmap statictics */ + struct pmap_statistics pm_stats; /* pmap statistics */ + vm_paddr_t pm_l0_paddr; pd_entry_t *pm_l0; TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ struct vm_radix pm_root; /* spare page table pages */ + long pm_cookie; /* encodes the pmap's ASID */ }; typedef struct pmap *pmap_t; @@ -132,6 +134,15 @@ extern struct pmap kernel_pmap_store; #define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) +#define ASID_RESERVED_FOR_PID_0 0 +#define ASID_RESERVED_FOR_EFI 1 +#define ASID_FIRST_AVAILABLE (ASID_RESERVED_FOR_EFI + 1) +#define ASID_TO_OPERAND_SHIFT 48 +#define ASID_TO_OPERAND(asid) ({ \ + KASSERT((asid) != -1, ("invalid ASID")); \ + (uint64_t)(asid) << ASID_TO_OPERAND_SHIFT; \ +}) + extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; @@ -152,6 +163,7 @@ void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); bool pmap_page_is_mapped(vm_page_t m); bool pmap_ps_enabled(pmap_t pmap); +uint64_t pmap_to_ttbr0(pmap_t pmap); void *pmap_mapdev(vm_offset_t, vm_size_t); void *pmap_mapbios(vm_paddr_t, vm_size_t); Modified: head/sys/arm64/include/proc.h ============================================================================== --- head/sys/arm64/include/proc.h Sun Nov 3 15:42:08 2019 (r354285) +++ head/sys/arm64/include/proc.h Sun Nov 3 17:45:30 2019 (r354286) @@ -40,7 +40,7 @@ struct mdthread { }; struct mdproc { - vm_offset_t md_l0addr; + long md_dummy; }; #define KINFO_PROC_SIZE 1088 From owner-svn-src-all@freebsd.org Sun Nov 3 18:53:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14A6017F6EF; Sun, 3 Nov 2019 18:53:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475lSk6pj7z3HGk; Sun, 3 Nov 2019 18:53:42 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD12E1832F; Sun, 3 Nov 2019 18:53:42 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3IrgDI092763; Sun, 3 Nov 2019 18:53:42 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3IrgIU092762; Sun, 3 Nov 2019 18:53:42 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911031853.xA3IrgIU092762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 3 Nov 2019 18:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354287 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 18:53:43 -0000 Author: vmaffione Date: Sun Nov 3 18:53:42 2019 New Revision: 354287 URL: https://svnweb.freebsd.org/changeset/base/354287 Log: bhyve: fix mistake introduced by r352841 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20973 Modified: head/usr.sbin/bhyve/net_backends.c Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Sun Nov 3 17:45:30 2019 (r354286) +++ head/usr.sbin/bhyve/net_backends.c Sun Nov 3 18:53:42 2019 (r354287) @@ -860,12 +860,12 @@ void netbe_rx_disable(struct net_backend *be) { - return be->recv_enable(be); + return be->recv_disable(be); } void netbe_rx_enable(struct net_backend *be) { - return be->recv_disable(be); + return be->recv_enable(be); } From owner-svn-src-all@freebsd.org Sun Nov 3 18:59:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 996EF17F889 for ; Sun, 3 Nov 2019 18:59:41 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10011401.me.com (pv50p00im-zteg10011401.me.com [17.58.6.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475lbc6MbNz3HQx for ; Sun, 3 Nov 2019 18:59:40 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-zteg10011401.me.com (Postfix) with ESMTPSA id D63BF901008; Sun, 3 Nov 2019 18:59:36 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3594.4.19\)) Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs From: Toomas Soome In-Reply-To: <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> Date: Sun, 3 Nov 2019 20:59:34 +0200 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <25055587-72FD-47BE-946D-4A0D2D70B2EF@me.com> References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> To: Andriy Gapon , Alexander Motin X-Mailer: Apple Mail (2.3594.4.19) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-03_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=630 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911030199 X-Rspamd-Queue-Id: 475lbc6MbNz3HQx X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[41.6.58.17.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[me.com]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-5.13), ipnet: 17.58.0.0/20(-2.50), asn: 714(-2.56), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 18:59:41 -0000 > On 3. Nov 2019, at 19:42, Andriy Gapon wrote: >=20 > On 03/11/2019 15:25, Toomas Soome wrote: >> Author: tsoome >> Date: Sun Nov 3 13:25:47 2019 >> New Revision: 354283 >> URL: https://svnweb.freebsd.org/changeset/base/354283 >>=20 >> Log: >> loader: we do not support booting from pool with log device >>=20 >> If pool has log device, stop there and tell about it. >=20 > Why? >=20 because it is not implemented? We already return EIO from vdev_probe() = for LOG device. I mean I does not have to stay this way, but also we = have some weird unexplained error cases=E2=80=A6=20 anyhow, it is trivial to undo the disable, and definitely open to ideas = about handling the reading the log. rgds, toomas= From owner-svn-src-all@freebsd.org Sun Nov 3 19:02:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01EC317FAEE; Sun, 3 Nov 2019 19:02:34 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475lfx68mKz3Hq1; Sun, 3 Nov 2019 19:02:33 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7CB3184EA; Sun, 3 Nov 2019 19:02:33 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3J2XIm098576; Sun, 3 Nov 2019 19:02:33 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3J2WA1098571; Sun, 3 Nov 2019 19:02:32 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911031902.xA3J2WA1098571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 3 Nov 2019 19:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354288 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 19:02:34 -0000 Author: vmaffione Date: Sun Nov 3 19:02:32 2019 New Revision: 354288 URL: https://svnweb.freebsd.org/changeset/base/354288 Log: bhyve: add backend rx backpressure to virtio-net If a VM is flooded with more ingress packets than the guest OS can handle, the current virtio-net code will keep reading those packets and drop most of them as no space is available in the receive queue. This is an undesirable receive livelock, which is a waste of CPU and memory resources and potentially opens to DoS attacks. With this change, virtio-net uses the new netbe_rx_disable() function to disable ingress operation in the backend while the guest is short on RX buffers. Once the guest makes more buffers available to the RX virtqueue, ingress operation is enabled again by calling netbe_rx_enable(). Reviewed by: bryanv, jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20987 Modified: head/usr.sbin/bhyve/mevent.c head/usr.sbin/bhyve/mevent.h head/usr.sbin/bhyve/net_backends.c head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/mevent.c ============================================================================== --- head/usr.sbin/bhyve/mevent.c Sun Nov 3 18:53:42 2019 (r354287) +++ head/usr.sbin/bhyve/mevent.c Sun Nov 3 19:02:32 2019 (r354288) @@ -321,6 +321,14 @@ mevent_add(int tfd, enum ev_type type, return mevent_add_state(tfd, type, func, param, MEV_ADD); } +struct mevent * +mevent_add_disabled(int tfd, enum ev_type type, + void (*func)(int, enum ev_type, void *), void *param) +{ + + return mevent_add_state(tfd, type, func, param, MEV_ADD_DISABLED); +} + static int mevent_update(struct mevent *evp, int newstate) { Modified: head/usr.sbin/bhyve/mevent.h ============================================================================== --- head/usr.sbin/bhyve/mevent.h Sun Nov 3 18:53:42 2019 (r354287) +++ head/usr.sbin/bhyve/mevent.h Sun Nov 3 19:02:32 2019 (r354288) @@ -43,6 +43,9 @@ struct mevent; struct mevent *mevent_add(int fd, enum ev_type type, void (*func)(int, enum ev_type, void *), void *param); +struct mevent *mevent_add_disabled(int fd, enum ev_type type, + void (*func)(int, enum ev_type, void *), + void *param); int mevent_enable(struct mevent *evp); int mevent_disable(struct mevent *evp); int mevent_delete(struct mevent *evp); Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Sun Nov 3 18:53:42 2019 (r354287) +++ head/usr.sbin/bhyve/net_backends.c Sun Nov 3 19:02:32 2019 (r354288) @@ -220,7 +220,7 @@ tap_init(struct net_backend *be, const char *devname, errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); goto error; @@ -432,7 +432,7 @@ netmap_init(struct net_backend *be, const char *devnam priv->cb_param = param; be->fd = priv->nmd->fd; - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); return (-1); Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Sun Nov 3 18:53:42 2019 (r354287) +++ head/usr.sbin/bhyve/pci_e82545.c Sun Nov 3 19:02:32 2019 (r354288) @@ -2351,6 +2351,8 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi, net_genmac(pi, sc->esc_mac.octet); } + netbe_rx_enable(sc->esc_be); + /* H/w initiated reset */ e82545_reset(sc, 0); Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Sun Nov 3 18:53:42 2019 (r354287) +++ head/usr.sbin/bhyve/pci_virtio_net.c Sun Nov 3 19:02:32 2019 (r354288) @@ -101,7 +101,6 @@ struct pci_vtnet_softc { net_backend_t *vsc_be; - int vsc_rx_ready; int resetting; /* protected by tx_mtx */ uint64_t vsc_features; /* negotiated features */ @@ -156,7 +155,6 @@ pci_vtnet_reset(void *vsc) pthread_mutex_lock(&sc->tx_mtx); } - sc->vsc_rx_ready = 0; sc->rx_merge = 1; sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr); @@ -180,30 +178,29 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) int len, n; uint16_t idx; - if (!sc->vsc_rx_ready) { - /* - * The rx ring has not yet been set up. - * Drop the packet and try later. - */ - netbe_rx_discard(sc->vsc_be); - return; - } - - /* - * Check for available rx buffers - */ vq = &sc->vsc_queues[VTNET_RXQ]; - if (!vq_has_descs(vq)) { + for (;;) { /* - * No available rx buffers. Drop the packet and try later. - * Interrupt on empty, if that's negotiated. + * Check for available rx buffers. */ - netbe_rx_discard(sc->vsc_be); - vq_endchains(vq, /*used_all_avail=*/1); - return; - } + if (!vq_has_descs(vq)) { + /* No rx buffers. Enable RX kicks and double check. */ + vq_kick_enable(vq); + if (!vq_has_descs(vq)) { + /* + * Still no buffers. Interrupt if needed + * (including for NOTIFY_ON_EMPTY), and + * disable the backend until the next kick. + */ + vq_endchains(vq, /*used_all_avail=*/1); + netbe_rx_disable(sc->vsc_be); + return; + } - do { + /* More rx buffers found, so keep going. */ + vq_kick_disable(vq); + } + /* * Get descriptor chain. */ @@ -215,7 +212,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) if (len <= 0) { /* * No more packets (len == 0), or backend errored - * (err < 0). Return unused available buffers. + * (err < 0). Return unused available buffers + * and stop. */ vq_retchain(vq); /* Interrupt if needed/appropriate and stop. */ @@ -225,10 +223,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) /* Publish the info to the guest */ vq_relchain(vq, idx, (uint32_t)len); - } while (vq_has_descs(vq)); + } - /* Interrupt if needed, including for NOTIFY_ON_EMPTY. */ - vq_endchains(vq, /*used_all_avail=*/1); } /* @@ -254,13 +250,11 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq) struct pci_vtnet_softc *sc = vsc; /* - * A qnotify means that the rx process can now begin + * A qnotify means that the rx process can now begin. */ pthread_mutex_lock(&sc->rx_mtx); - if (sc->vsc_rx_ready == 0) { - sc->vsc_rx_ready = 1; - vq_kick_disable(vq); - } + vq_kick_disable(vq); + netbe_rx_enable(sc->vsc_be); pthread_mutex_unlock(&sc->rx_mtx); } From owner-svn-src-all@freebsd.org Sun Nov 3 19:33:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92B851A11F9; Sun, 3 Nov 2019 19:33:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475mM234Npz46ZZ; Sun, 3 Nov 2019 19:33:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CE1118A55; Sun, 3 Nov 2019 19:33:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3JXoEQ017182; Sun, 3 Nov 2019 19:33:50 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3JXoNn017181; Sun, 3 Nov 2019 19:33:50 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911031933.xA3JXoNn017181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 3 Nov 2019 19:33:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354289 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 19:33:50 -0000 Author: cem Date: Sun Nov 3 19:33:49 2019 New Revision: 354289 URL: https://svnweb.freebsd.org/changeset/base/354289 Log: armv6: Switch to LLD by default This could just be ${__TT} == "arm", except armv5 isn't slated for death until EOY. arm tinderbox builds. Let's see what else shakes out. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sun Nov 3 19:02:32 2019 (r354288) +++ head/share/mk/src.opts.mk Sun Nov 3 19:33:49 2019 (r354289) @@ -335,8 +335,8 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv7" || \ - ${__T} == "i386" +.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv6" || \ + ${__T} == "armv7" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD From owner-svn-src-all@freebsd.org Sun Nov 3 19:36:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1EAF1A1246; Sun, 3 Nov 2019 19:36:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475mQB5S4Bz49wf; Sun, 3 Nov 2019 19:36:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B54818A57; Sun, 3 Nov 2019 19:36:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3JaY8n017353; Sun, 3 Nov 2019 19:36:34 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3JaYrH017352; Sun, 3 Nov 2019 19:36:34 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911031936.xA3JaYrH017352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 3 Nov 2019 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354290 - head X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 19:36:35 -0000 Author: cem Date: Sun Nov 3 19:36:34 2019 New Revision: 354290 URL: https://svnweb.freebsd.org/changeset/base/354290 Log: Take arm.arm (armv5) out of universe It's on the chopping block in two months, the CI tinderbox doesn't bother with it anymore either, and buildworld fails today due to an issue linking clang. It's not worth investigating and it just eats up CPU cycles running universe builds. Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Sun Nov 3 19:33:49 2019 (r354289) +++ head/Makefile Sun Nov 3 19:36:34 2019 (r354290) @@ -496,7 +496,8 @@ _OBSOLETE_GCC_TARGETS+=powerpc .endif TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS} _UNIVERSE_TARGETS= ${TARGETS} -TARGET_ARCHES_arm?= arm armv6 armv7 +# arm (armv5) excluded due to broken buildworld +TARGET_ARCHES_arm?= armv6 armv7 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe From owner-svn-src-all@freebsd.org Sun Nov 3 20:39:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E4481A209B; Sun, 3 Nov 2019 20:39:48 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nq76gBzz3G6B; Sun, 3 Nov 2019 20:39:47 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C44F2194E0; Sun, 3 Nov 2019 20:39:47 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KdliA053175; Sun, 3 Nov 2019 20:39:47 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KdktH053170; Sun, 3 Nov 2019 20:39:46 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032039.xA3KdktH053170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354291 - in head/sys/dev: chromebook_platform ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/sys/dev: chromebook_platform ichiic X-SVN-Commit-Revision: 354291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:39:48 -0000 Author: wulf Date: Sun Nov 3 20:39:46 2019 New Revision: 354291 URL: https://svnweb.freebsd.org/changeset/base/354291 Log: [ig4] Give common name to PCI and ACPI device drivers They share common device driver code with different bus attachments This commit starts a bunch of changes which have following properties: Reviewed by: imp (previous version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22016 Modified: head/sys/dev/chromebook_platform/chromebook_platform.c head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/chromebook_platform/chromebook_platform.c ============================================================================== --- head/sys/dev/chromebook_platform/chromebook_platform.c Sun Nov 3 19:36:34 2019 (r354290) +++ head/sys/dev/chromebook_platform/chromebook_platform.c Sun Nov 3 20:39:46 2019 (r354291) @@ -69,7 +69,7 @@ chromebook_i2c_identify(driver_t *driver, device_t bus * See http://lxr.free-electrons.com/source/drivers/platform/chrome/chromeos_laptop.c */ controller = device_get_parent(bus); - if (strcmp(device_get_name(controller), "ig4iic_pci") != 0) + if (strcmp(device_get_name(controller), "ig4iic") != 0) return; for (i = 0; i < nitems(slaves); i++) { Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 19:36:34 2019 (r354290) +++ head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:39:46 2019 (r354291) @@ -163,15 +163,10 @@ static device_method_t ig4iic_acpi_methods[] = { }; static driver_t ig4iic_acpi_driver = { - "ig4iic_acpi", + "ig4iic", ig4iic_acpi_methods, sizeof(struct ig4iic_softc), }; -static devclass_t ig4iic_acpi_devclass; -DRIVER_MODULE(ig4iic_acpi, acpi, ig4iic_acpi_driver, ig4iic_acpi_devclass, 0, 0); - -MODULE_DEPEND(ig4iic_acpi, acpi, 1, 1, 1); -MODULE_DEPEND(ig4iic_acpi, pci, 1, 1, 1); -MODULE_DEPEND(ig4iic_acpi, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); -MODULE_VERSION(ig4iic_acpi, 1); +DRIVER_MODULE(ig4iic, acpi, ig4iic_acpi_driver, ig4iic_devclass, 0, 0); +MODULE_DEPEND(ig4iic, acpi, 1, 1, 1); Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 19:36:34 2019 (r354290) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:39:46 2019 (r354291) @@ -797,5 +797,8 @@ ig4iic_dump(ig4iic_softc_t *sc) } #undef REGDUMP -DRIVER_MODULE(iicbus, ig4iic_acpi, iicbus_driver, iicbus_devclass, NULL, NULL); -DRIVER_MODULE(iicbus, ig4iic_pci, iicbus_driver, iicbus_devclass, NULL, NULL); +devclass_t ig4iic_devclass; + +DRIVER_MODULE(iicbus, ig4iic, iicbus_driver, iicbus_devclass, NULL, NULL); +MODULE_DEPEND(ig4iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(ig4iic, 1); Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 19:36:34 2019 (r354290) +++ head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 20:39:46 2019 (r354291) @@ -220,17 +220,13 @@ static device_method_t ig4iic_pci_methods[] = { }; static driver_t ig4iic_pci_driver = { - "ig4iic_pci", + "ig4iic", ig4iic_pci_methods, sizeof(struct ig4iic_softc) }; -static devclass_t ig4iic_pci_devclass; - -DRIVER_MODULE_ORDERED(ig4iic_pci, pci, ig4iic_pci_driver, ig4iic_pci_devclass, 0, 0, +DRIVER_MODULE_ORDERED(ig4iic, pci, ig4iic_pci_driver, ig4iic_devclass, 0, 0, SI_ORDER_ANY); -MODULE_DEPEND(ig4iic_pci, pci, 1, 1, 1); -MODULE_DEPEND(ig4iic_pci, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); -MODULE_VERSION(ig4iic_pci, 1); -MODULE_PNP_INFO("W32:vendor/device", pci, ig4iic_pci, ig4iic_pci_devices, +MODULE_DEPEND(ig4iic, pci, 1, 1, 1); +MODULE_PNP_INFO("W32:vendor/device", pci, ig4iic, ig4iic_pci_devices, nitems(ig4iic_pci_devices)); Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 19:36:34 2019 (r354290) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:39:46 2019 (r354291) @@ -101,6 +101,8 @@ struct ig4iic_softc { typedef struct ig4iic_softc ig4iic_softc_t; +extern devclass_t ig4iic_devclass; + /* Attach/Detach called from ig4iic_pci_*() */ int ig4iic_attach(ig4iic_softc_t *sc); int ig4iic_detach(ig4iic_softc_t *sc); From owner-svn-src-all@freebsd.org Sun Nov 3 20:39:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACBF01A20C7 for ; Sun, 3 Nov 2019 20:39:53 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nqD6C3Pz3GMZ for ; Sun, 3 Nov 2019 20:39:52 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-il1-x136.google.com with SMTP id d83so13031213ilk.7 for ; Sun, 03 Nov 2019 12:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6Qi8U1b2F/Zv7jQ1j5e7o+v8JOtLH4fA3sO36zkP1jY=; b=JvjxWE1fy6RNO3+yesZFFVbYIegGrzFYRiqPTyvixD8UoXo7bfGjqbsilcRfNTiT3/ +j6uW4BYFt1TuB79JzxjAP1ELmkb5a2oXmXSxqVtwW5vIYby6FzlabZJeyjb3mgPVbsu SD3IIJ7X8W7wUozCh5muRn/USstlUh1xOtnuI= 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=6Qi8U1b2F/Zv7jQ1j5e7o+v8JOtLH4fA3sO36zkP1jY=; b=BQMAT/4mtMOXXac0F8LUBOM7ts7Uj5LyoR4l0QYG1mebsb1A5JMmmFcQpwz3pKgI55 L9DfhP0LtcbzTAyBUluiZG3ob5nc9bymZFM72vjDBoXQltDWv7k6YkY+LmvzM739OBiQ mhDTWE2eGHRerVvKoGOBzmy73gmCsJMaakD5x8rQPDlWcePkFdRPONYB6QmSIqpsT9yG B2B8dD75gLrAm1S7PI7VGJjesaTKOA4w8OLmHjWrzk4konhLk90Br7WToGWgHek9LHsp StzXuhDFrILbaxFQ3sqa5vfknHuhi2zmBkbDdqXZSuHpUv+oxZAsPYNZV/7WBGaO4taj PDZw== X-Gm-Message-State: APjAAAUfPXmiGL64MfR6zIV/9LN2lFkdf1YpDvOKDb3Oqi/MnFsNFB5Z zRx/mmqSPRFk/JTiDyVf/gWtErYf4hiQClOezpQSEQ== X-Google-Smtp-Source: APXvYqyJC4DMFHR9h/zD9OozVG4AkJVb7v2OOvSCmq7ts8Mp7RvoJXnZ9WUna/c+g/def+Pb+y5UARKZQcQpiJqAq18= X-Received: by 2002:a92:d0a:: with SMTP id 10mr25367483iln.238.1572813591476; Sun, 03 Nov 2019 12:39:51 -0800 (PST) MIME-Version: 1.0 References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> In-Reply-To: <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> From: Kevin Bowling Date: Sun, 3 Nov 2019 13:39:40 -0700 Message-ID: Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs To: Andriy Gapon Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 475nqD6C3Pz3GMZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none (invalid DKIM record) header.d=kev009.com header.s=google header.b=JvjxWE1f; dmarc=none; spf=pass (mx1.freebsd.org: domain of kevin.bowling@kev009.com designates 2607:f8b0:4864:20::136 as permitted sender) smtp.mailfrom=kevin.bowling@kev009.com X-Spamd-Result: default: False [-4.87 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[kev009.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[kev009.com:~]; RCVD_IN_DNSWL_NONE(0.00)[6.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_DKIM_PERMFAIL(0.00)[kev009.com:s=google]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.57)[ip: (-8.39), ipnet: 2607:f8b0::/32(-2.38), asn: 15169(-2.03), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:39:53 -0000 I believe this is/was a common configuration, at least the few spinning disk based systems I have left have a slog. On Sun, Nov 3, 2019 at 10:55 AM Andriy Gapon wrote: > > On 03/11/2019 15:25, Toomas Soome wrote: > > Author: tsoome > > Date: Sun Nov 3 13:25:47 2019 > > New Revision: 354283 > > URL: https://svnweb.freebsd.org/changeset/base/354283 > > > > Log: > > loader: we do not support booting from pool with log device > > > > If pool has log device, stop there and tell about it. > > Why? > > > Modified: > > head/stand/libsa/zfs/zfs.c > > head/stand/libsa/zfs/zfsimpl.c > > head/sys/cddl/boot/zfs/zfsimpl.h > > > > -- > Andriy Gapon > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Sun Nov 3 20:40:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CD4B1A2286; Sun, 3 Nov 2019 20:40:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nrS30yGz3JcM; Sun, 3 Nov 2019 20:40:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BBD719511; Sun, 3 Nov 2019 20:40:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KeuTU053307; Sun, 3 Nov 2019 20:40:56 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Keu1N053306; Sun, 3 Nov 2019 20:40:56 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032040.xA3Keu1N053306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354292 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:40:56 -0000 Author: wulf Date: Sun Nov 3 20:40:55 2019 New Revision: 354292 URL: https://svnweb.freebsd.org/changeset/base/354292 Log: [ig4] Handle controller startup errors Fail the attach on controller startup errors. For some reason the dell xps 13 says there's I2C controller, but the controller appears to be permanente disabled and will refuse to enable. Obtained from: DragonflyBSD (509820b) Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:39:46 2019 (r354291) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:40:55 2019 (r354292) @@ -629,10 +629,18 @@ ig4iic_attach(ig4iic_softc_t *sc) #endif mtx_lock(&sc->io_lock); - if (set_controller(sc, 0)) + if (set_controller(sc, 0)) { device_printf(sc->dev, "controller error during attach-1\n"); - if (set_controller(sc, IG4_I2C_ENABLE)) + mtx_unlock(&sc->io_lock); + error = ENXIO; + goto done; + } + if (set_controller(sc, IG4_I2C_ENABLE)) { device_printf(sc->dev, "controller error during attach-2\n"); + mtx_unlock(&sc->io_lock); + error = ENXIO; + goto done; + } mtx_unlock(&sc->io_lock); error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ig4iic_intr, sc, &sc->intr_handle); From owner-svn-src-all@freebsd.org Sun Nov 3 20:42:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA90C1A22ED; Sun, 3 Nov 2019 20:42:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nsn5V1Jz3MS6; Sun, 3 Nov 2019 20:42:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A135B1967B; Sun, 3 Nov 2019 20:42:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Kg5wt057921; Sun, 3 Nov 2019 20:42:05 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Kg5km057919; Sun, 3 Nov 2019 20:42:05 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032042.xA3Kg5km057919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354293 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:42:05 -0000 Author: wulf Date: Sun Nov 3 20:42:04 2019 New Revision: 354293 URL: https://svnweb.freebsd.org/changeset/base/354293 Log: [ig4] Only enable interrupts when we want them. Otherwise keep mask at 0. This avoids possible interrupt storms, depending on the state of the I2C controller before the driver attached. During attaching this clears the interrupt mask. Revert r338215 as this change makes it no-op. Obtained from: DragonflyBSD (d7c8555) Modified: head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:40:55 2019 (r354292) +++ head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:42:04 2019 (r354293) @@ -69,18 +69,15 @@ static int ig4iic_acpi_probe(device_t dev) { ig4iic_softc_t *sc; - char *hid; int rv; sc = device_get_softc(dev); if (acpi_disabled("ig4iic")) return (ENXIO); - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids, &hid); + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids, NULL); if (rv > 0) return (rv); - if (strcmp("AMDI0010", hid) == 0) - sc->access_intr_mask = 1; device_set_desc(dev, "Designware I2C Controller"); return (rv); } Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:40:55 2019 (r354292) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:42:04 2019 (r354293) @@ -98,6 +98,15 @@ reg_read(ig4iic_softc_t *sc, uint32_t reg) return (value); } +static void +set_intr_mask(ig4iic_softc_t *sc, uint32_t val) +{ + if (sc->intr_mask != val) { + reg_write(sc, IG4_REG_INTR_MASK, val); + sc->intr_mask = val; + } +} + /* * Enable or disable the controller and wait for the controller to acknowledge * the state change. @@ -113,12 +122,9 @@ set_controller(ig4iic_softc_t *sc, uint32_t ctl) * When the controller is enabled, interrupt on STOP detect * or receive character ready and clear pending interrupts. */ - if (ctl & IG4_I2C_ENABLE) { - reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET | - IG4_INTR_RX_FULL); + set_intr_mask(sc, 0); + if (ctl & IG4_I2C_ENABLE) reg_read(sc, IG4_REG_CLR_INTR); - } else - reg_write(sc, IG4_REG_INTR_MASK, 0); reg_write(sc, IG4_REG_I2C_EN, ctl); error = IIC_ETIMEOUT; @@ -196,8 +202,10 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) * work, otherwise poll with the lock held. */ if (status & IG4_STATUS_RX_NOTEMPTY) { + set_intr_mask(sc, IG4_INTR_STOP_DET | IG4_INTR_RX_FULL); mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ + set_intr_mask(sc, 0); count_us += 10000; } else { DELAY(25); @@ -579,6 +587,10 @@ ig4iic_attach(ig4iic_softc_t *sc) v = reg_read(sc, IG4_REG_SS_SCL_LCNT); reg_write(sc, IG4_REG_FS_SCL_LCNT, v); + reg_read(sc, IG4_REG_CLR_INTR); + reg_write(sc, IG4_REG_INTR_MASK, 0); + sc->intr_mask = 0; + /* * Program based on a 25000 Hz clock. This is a bit of a * hack (obviously). The defaults are 400 and 470 for standard @@ -725,7 +737,7 @@ ig4iic_intr(void *cookie) uint32_t status; mtx_lock(&sc->io_lock); -/* reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET);*/ + set_intr_mask(sc, 0); reg_read(sc, IG4_REG_CLR_INTR); status = reg_read(sc, IG4_REG_I2C_STA); while (status & IG4_STATUS_RX_NOTEMPTY) { @@ -733,18 +745,6 @@ ig4iic_intr(void *cookie) (uint8_t)reg_read(sc, IG4_REG_DATA_CMD); ++sc->rnext; status = reg_read(sc, IG4_REG_I2C_STA); - } - - /* - * Workaround to trigger pending interrupt if IG4_REG_INTR_STAT - * is changed after clearing it - */ - if (sc->access_intr_mask != 0) { - status = reg_read(sc, IG4_REG_INTR_MASK); - if (status != 0) { - reg_write(sc, IG4_REG_INTR_MASK, 0); - reg_write(sc, IG4_REG_INTR_MASK, status); - } } wakeup(sc); Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:40:55 2019 (r354292) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:42:04 2019 (r354293) @@ -65,6 +65,7 @@ struct ig4iic_softc { int rnext; int rpos; char rbuf[IG4_RBUFSIZE]; + uint32_t intr_mask; int error; uint8_t last_slave; int platform_attached : 1; @@ -72,7 +73,6 @@ struct ig4iic_softc { int slave_valid : 1; int read_started : 1; int write_started : 1; - int access_intr_mask : 1; /* * Locking semantics: From owner-svn-src-all@freebsd.org Sun Nov 3 20:43:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E75621A2311; Sun, 3 Nov 2019 20:43:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475ntt5LqKz3Pdj; Sun, 3 Nov 2019 20:43:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B42E196A6; Sun, 3 Nov 2019 20:43:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Kh2jo058714; Sun, 3 Nov 2019 20:43:02 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Kh2hd058713; Sun, 3 Nov 2019 20:43:02 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032043.xA3Kh2hd058713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354294 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:43:03 -0000 Author: wulf Date: Sun Nov 3 20:43:02 2019 New Revision: 354294 URL: https://svnweb.freebsd.org/changeset/base/354294 Log: [ig4] Drop driver's internal RX FIFO There is no need to read all controller's RX FIFO data to clear RX_FULL bit in interrupt handler as interrupts are masked permanently since previous commit. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:42:04 2019 (r354293) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:43:02 2019 (r354294) @@ -168,17 +168,6 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) } /* - * When waiting for receive data break-out if the interrupt - * loaded data into the FIFO. - */ - if (status & IG4_STATUS_RX_NOTEMPTY) { - if (sc->rpos != sc->rnext) { - error = 0; - break; - } - } - - /* * When waiting for the transmit FIFO to become empty, * reset the timeout if we see a change in the transmit * FIFO level as progress is being made. @@ -217,25 +206,6 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) } /* - * Read I2C data. The data might have already been read by - * the interrupt code, otherwise it is sitting in the data - * register. - */ -static uint8_t -data_read(ig4iic_softc_t *sc) -{ - uint8_t c; - - if (sc->rpos == sc->rnext) { - c = (uint8_t)reg_read(sc, IG4_REG_DATA_CMD); - } else { - c = sc->rbuf[sc->rpos & IG4_RBUFMASK]; - ++sc->rpos; - } - return (c); -} - -/* * Set the slave address. The controller must be disabled when * changing the address. * @@ -334,7 +304,7 @@ ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); if (error) break; - buf[i] = data_read(sc); + buf[i] = (uint8_t)reg_read(sc, IG4_REG_DATA_CMD); } (void)reg_read(sc, IG4_REG_TX_ABRT_SOURCE); @@ -455,16 +425,6 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui */ reg_read(sc, IG4_REG_CLR_TX_ABORT); - /* - * Clean out any previously received data. - */ - if (sc->rpos != sc->rnext && bootverbose) { - device_printf(sc->dev, "discarding %d bytes of spurious data\n", - sc->rnext - sc->rpos); - } - sc->rpos = 0; - sc->rnext = 0; - rpstart = false; error = 0; for (i = 0; i < nmsgs; i++) { @@ -734,19 +694,10 @@ static void ig4iic_intr(void *cookie) { ig4iic_softc_t *sc = cookie; - uint32_t status; mtx_lock(&sc->io_lock); set_intr_mask(sc, 0); reg_read(sc, IG4_REG_CLR_INTR); - status = reg_read(sc, IG4_REG_I2C_STA); - while (status & IG4_STATUS_RX_NOTEMPTY) { - sc->rbuf[sc->rnext & IG4_RBUFMASK] = - (uint8_t)reg_read(sc, IG4_REG_DATA_CMD); - ++sc->rnext; - status = reg_read(sc, IG4_REG_I2C_STA); - } - wakeup(sc); mtx_unlock(&sc->io_lock); } Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:42:04 2019 (r354293) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:43:02 2019 (r354294) @@ -43,9 +43,6 @@ #include "pci_if.h" #include "iicbus_if.h" -#define IG4_RBUFSIZE 128 -#define IG4_RBUFMASK (IG4_RBUFSIZE - 1) - enum ig4_op { IG4_IDLE, IG4_READ, IG4_WRITE }; enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL }; @@ -62,9 +59,6 @@ struct ig4iic_softc { enum ig4_vers version; enum ig4_op op; int cmd; - int rnext; - int rpos; - char rbuf[IG4_RBUFSIZE]; uint32_t intr_mask; int error; uint8_t last_slave; @@ -81,19 +75,6 @@ struct ig4iic_softc { * with the controller acquire an exclusive lock on call_lock * to prevent interleaving of calls to the interface and a lock on * io_lock right afterwards, to synchronize controller I/O activity. - * - * The interrupt handler can only read data while no iicbus call - * is in progress or while io_lock is dropped during mtx_sleep in - * wait_status and set_controller. It is safe to drop io_lock in those - * places, because the interrupt handler only accesses those registers: - * - * - IG4_REG_I2C_STA (I2C Status) - * - IG4_REG_DATA_CMD (Data Buffer and Command) - * - IG4_REG_CLR_INTR (Clear Interrupt) - * - * Locking outside of those places is required to make the content - * of rpos/rnext predictable (e.g. whenever data_read is called and in - * ig4iic_transfer). */ struct sx call_lock; struct mtx io_lock; From owner-svn-src-all@freebsd.org Sun Nov 3 20:44:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 074D41A2343; Sun, 3 Nov 2019 20:44:17 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nwJ6MHMz3xVB; Sun, 3 Nov 2019 20:44:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD86F196A7; Sun, 3 Nov 2019 20:44:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KiG6J058833; Sun, 3 Nov 2019 20:44:16 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KiGTb058832; Sun, 3 Nov 2019 20:44:16 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032044.xA3KiGTb058832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354295 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:44:17 -0000 Author: wulf Date: Sun Nov 3 20:44:16 2019 New Revision: 354295 URL: https://svnweb.freebsd.org/changeset/base/354295 Log: [ig4] Do not wait for interrupts in set_controller() routine Specs shows no dedicated interrupt firing on disable of the controller. Remove io lock acquisitions around set_controller() calls as they are not needed anymore. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:43:02 2019 (r354294) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:44:16 2019 (r354295) @@ -135,10 +135,7 @@ set_controller(ig4iic_softc_t *sc, uint32_t ctl) error = 0; break; } - if (cold) - DELAY(1000); - else - mtx_sleep(sc, &sc->io_lock, 0, "i2cslv", 1); + pause("i2cslv", 1); } return (error); } @@ -600,20 +597,16 @@ ig4iic_attach(ig4iic_softc_t *sc) } #endif - mtx_lock(&sc->io_lock); if (set_controller(sc, 0)) { device_printf(sc->dev, "controller error during attach-1\n"); - mtx_unlock(&sc->io_lock); error = ENXIO; goto done; } if (set_controller(sc, IG4_I2C_ENABLE)) { device_printf(sc->dev, "controller error during attach-2\n"); - mtx_unlock(&sc->io_lock); error = ENXIO; goto done; } - mtx_unlock(&sc->io_lock); error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ig4iic_intr, sc, &sc->intr_handle); if (error) { From owner-svn-src-all@freebsd.org Sun Nov 3 20:45:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E84B81A2377; Sun, 3 Nov 2019 20:45:25 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nxd5mzjz4178; Sun, 3 Nov 2019 20:45:25 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA6EF196A8; Sun, 3 Nov 2019 20:45:25 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KjPHh058947; Sun, 3 Nov 2019 20:45:25 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KjPaX058945; Sun, 3 Nov 2019 20:45:25 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032045.xA3KjPaX058945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354296 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:45:26 -0000 Author: wulf Date: Sun Nov 3 20:45:25 2019 New Revision: 354296 URL: https://svnweb.freebsd.org/changeset/base/354296 Log: [ig4] Reduce scope of io_lock Now io_lock is used as condition variable to synchronize active process with the interrupt handler. It is not used for tasks other than waiting for interrupt and passing parameters to and from it's handler. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:44:16 2019 (r354295) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:45:25 2019 (r354296) @@ -188,10 +188,12 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) * work, otherwise poll with the lock held. */ if (status & IG4_STATUS_RX_NOTEMPTY) { + mtx_lock(&sc->io_lock); set_intr_mask(sc, IG4_INTR_STOP_DET | IG4_INTR_RX_FULL); mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ set_intr_mask(sc, 0); + mtx_unlock(&sc->io_lock); count_us += 10000; } else { DELAY(25); @@ -405,7 +407,6 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui } sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); /* Debugging - dump registers. */ if (ig4_dump) { @@ -453,7 +454,6 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui rpstart = !stop; } - mtx_unlock(&sc->io_lock); sx_unlock(&sc->call_lock); return (error); } @@ -464,7 +464,6 @@ ig4iic_reset(device_t dev, u_char speed, u_char addr, ig4iic_softc_t *sc = device_get_softc(dev); sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); /* TODO handle speed configuration? */ if (oldaddr != NULL) @@ -473,7 +472,6 @@ ig4iic_reset(device_t dev, u_char speed, u_char addr, if (addr == IIC_UNKNOWN) sc->slave_valid = false; - mtx_unlock(&sc->io_lock); sx_unlock(&sc->call_lock); return (0); } @@ -664,14 +662,12 @@ ig4iic_detach(ig4iic_softc_t *sc) bus_teardown_intr(sc->dev, sc->intr_res, sc->intr_handle); sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); sc->iicbus = NULL; sc->intr_handle = NULL; reg_write(sc, IG4_REG_INTR_MASK, 0); set_controller(sc, 0); - mtx_unlock(&sc->io_lock); sx_xunlock(&sc->call_lock); mtx_destroy(&sc->io_lock); Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:44:16 2019 (r354295) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:45:25 2019 (r354296) @@ -73,8 +73,12 @@ struct ig4iic_softc { * * Functions implementing the icbus interface that interact * with the controller acquire an exclusive lock on call_lock - * to prevent interleaving of calls to the interface and a lock on - * io_lock right afterwards, to synchronize controller I/O activity. + * to prevent interleaving of calls to the interface. + * + * io_lock is used as condition variable to synchronize active process + * with the interrupt handler. It should not be used for tasks other + * than waiting for interrupt and passing parameters to and from + * it's handler. */ struct sx call_lock; struct mtx io_lock; From owner-svn-src-all@freebsd.org Sun Nov 3 20:46:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 048271A239A; Sun, 3 Nov 2019 20:46:21 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475nyh65zgz43Jt; Sun, 3 Nov 2019 20:46:20 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6091196A9; Sun, 3 Nov 2019 20:46:20 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KkKCY059029; Sun, 3 Nov 2019 20:46:20 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KkKaD059028; Sun, 3 Nov 2019 20:46:20 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032046.xA3KkKaD059028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354297 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:46:21 -0000 Author: wulf Date: Sun Nov 3 20:46:20 2019 New Revision: 354297 URL: https://svnweb.freebsd.org/changeset/base/354297 Log: [ig4] Ignore stray interrupts Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:45:25 2019 (r354296) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:46:20 2019 (r354297) @@ -685,9 +685,12 @@ ig4iic_intr(void *cookie) ig4iic_softc_t *sc = cookie; mtx_lock(&sc->io_lock); - set_intr_mask(sc, 0); - reg_read(sc, IG4_REG_CLR_INTR); - wakeup(sc); + /* Ignore stray interrupts */ + if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) { + set_intr_mask(sc, 0); + reg_read(sc, IG4_REG_CLR_INTR); + wakeup(sc); + } mtx_unlock(&sc->io_lock); } From owner-svn-src-all@freebsd.org Sun Nov 3 20:47:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD14A1A23DD; Sun, 3 Nov 2019 20:47:49 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p0P5NFDz46wj; Sun, 3 Nov 2019 20:47:49 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D5FB196AB; Sun, 3 Nov 2019 20:47:49 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Klns8059138; Sun, 3 Nov 2019 20:47:49 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KlnFQ059137; Sun, 3 Nov 2019 20:47:49 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032047.xA3KlnFQ059137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354298 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:47:49 -0000 Author: wulf Date: Sun Nov 3 20:47:49 2019 New Revision: 354298 URL: https://svnweb.freebsd.org/changeset/base/354298 Log: [ig4] We actually need to set the Rx threshold register one smaller. Setting the IG4_REG_RX_TL register to 1 was actually generating an interrupt after 2 bytes were available in the Rx fifo. We need to set the register to 0 to get an interrupt for 1 byte already. Obtained from: DragonflyBSD (02f0bf2) Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:46:20 2019 (r354297) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:47:49 2019 (r354298) @@ -567,7 +567,7 @@ ig4iic_attach(ig4iic_softc_t *sc) * * See ig4_var.h for details on interrupt handler synchronization. */ - reg_write(sc, IG4_REG_RX_TL, 1); + reg_write(sc, IG4_REG_RX_TL, 0); reg_write(sc, IG4_REG_CTL, IG4_CTL_MASTER | From owner-svn-src-all@freebsd.org Sun Nov 3 20:49:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49DF91A2416; Sun, 3 Nov 2019 20:49:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p1s0dL3z4BRc; Sun, 3 Nov 2019 20:49:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECDF3196AE; Sun, 3 Nov 2019 20:49:04 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Kn4Rv059234; Sun, 3 Nov 2019 20:49:04 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Kn4kO059233; Sun, 3 Nov 2019 20:49:04 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032049.xA3Kn4kO059233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354299 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:49:05 -0000 Author: wulf Date: Sun Nov 3 20:49:04 2019 New Revision: 354299 URL: https://svnweb.freebsd.org/changeset/base/354299 Log: [ig4] Stop I2C controller after checking that it's kind of functional. Obtained from: DragonfliBSD (0b3eedb) Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:47:49 2019 (r354298) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:49:04 2019 (r354299) @@ -605,6 +605,11 @@ ig4iic_attach(ig4iic_softc_t *sc) error = ENXIO; goto done; } + if (set_controller(sc, 0)) { + device_printf(sc->dev, "controller error during attach-3\n"); + error = ENXIO; + goto done; + } error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ig4iic_intr, sc, &sc->intr_handle); if (error) { From owner-svn-src-all@freebsd.org Sun Nov 3 20:50:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F33C1A2459; Sun, 3 Nov 2019 20:50:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p325pVvz4DgZ; Sun, 3 Nov 2019 20:50:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB3FE196B3; Sun, 3 Nov 2019 20:50:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Ko65e059363; Sun, 3 Nov 2019 20:50:06 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Ko6tr059362; Sun, 3 Nov 2019 20:50:06 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032050.xA3Ko6tr059362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354300 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:50:07 -0000 Author: wulf Date: Sun Nov 3 20:50:06 2019 New Revision: 354300 URL: https://svnweb.freebsd.org/changeset/base/354300 Log: [ig4] disable controller before initialization of clock counters It is required by controller specifications. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:49:04 2019 (r354299) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:50:06 2019 (r354300) @@ -531,6 +531,13 @@ ig4iic_attach(ig4iic_softc_t *sc) goto done; } } + + if (set_controller(sc, 0)) { + device_printf(sc->dev, "controller error during attach-1\n"); + error = ENXIO; + goto done; + } + v = reg_read(sc, IG4_REG_SS_SCL_HCNT); v = reg_read(sc, IG4_REG_SS_SCL_LCNT); v = reg_read(sc, IG4_REG_FS_SCL_HCNT); @@ -595,11 +602,6 @@ ig4iic_attach(ig4iic_softc_t *sc) } #endif - if (set_controller(sc, 0)) { - device_printf(sc->dev, "controller error during attach-1\n"); - error = ENXIO; - goto done; - } if (set_controller(sc, IG4_I2C_ENABLE)) { device_printf(sc->dev, "controller error during attach-2\n"); error = ENXIO; From owner-svn-src-all@freebsd.org Sun Nov 3 20:51:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE83A1A25B1; Sun, 3 Nov 2019 20:51:22 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p4V4Z0Nz4Hh0; Sun, 3 Nov 2019 20:51:22 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 819A5197ED; Sun, 3 Nov 2019 20:51:22 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KpM9V060161; Sun, 3 Nov 2019 20:51:22 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KpM00060160; Sun, 3 Nov 2019 20:51:22 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032051.xA3KpM00060160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354301 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:51:22 -0000 Author: wulf Date: Sun Nov 3 20:51:22 2019 New Revision: 354301 URL: https://svnweb.freebsd.org/changeset/base/354301 Log: [ig4] Add support for polled mode Currently ig4 internally depends on it's own interrupts and uses mtx_sleep() to wait for them. That means it can not be used from any context where sleeping is disallowed e.g. on cold boot, from DDB/KDB, from other device driver's interrupt handlers and so on. This change replaces sleeps with busy loops in cold boot and DDB cases. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:50:06 2019 (r354300) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:51:22 2019 (r354301) @@ -48,8 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -70,6 +72,8 @@ __FBSDID("$FreeBSD$"); #define TRANS_PCALL 2 #define TRANS_BLOCK 3 +#define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED()) + static void ig4iic_start(void *xdev); static void ig4iic_intr(void *cookie); static void ig4iic_dump(ig4iic_softc_t *sc); @@ -187,7 +191,7 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) * When waiting for receive data let the interrupt do its * work, otherwise poll with the lock held. */ - if (status & IG4_STATUS_RX_NOTEMPTY) { + if ((status & IG4_STATUS_RX_NOTEMPTY) && !DO_POLL(sc)) { mtx_lock(&sc->io_lock); set_intr_mask(sc, IG4_INTR_STOP_DET | IG4_INTR_RX_FULL); mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", From owner-svn-src-all@freebsd.org Sun Nov 3 20:53:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC9761A2604; Sun, 3 Nov 2019 20:53:14 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p6f4yQZz4MkP; Sun, 3 Nov 2019 20:53:14 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E7C01986B; Sun, 3 Nov 2019 20:53:14 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KrEnO065049; Sun, 3 Nov 2019 20:53:14 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KrDLq065045; Sun, 3 Nov 2019 20:53:13 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032053.xA3KrDLq065045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354302 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:53:14 -0000 Author: wulf Date: Sun Nov 3 20:53:13 2019 New Revision: 354302 URL: https://svnweb.freebsd.org/changeset/base/354302 Log: [ig4] Allow enabling of polled mode from iicbus allocation callback If controller is allocated with IIC_NOWAIT option ig4 enables polled mode for a period of allocation that makes possible to start I2C transfers from the contexts where sleeping is not allowed e.g. from ithreads or callouts. Modified: head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:51:22 2019 (r354301) +++ head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:53:13 2019 (r354302) @@ -154,7 +154,7 @@ static device_method_t ig4iic_acpi_methods[] = { /* iicbus interface */ DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), - DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_callback, ig4iic_callback), DEVMETHOD_END }; Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:51:22 2019 (r354301) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:53:13 2019 (r354302) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #define TRANS_PCALL 2 #define TRANS_BLOCK 3 -#define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED()) +#define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED() || sc->poll) static void ig4iic_start(void *xdev); static void ig4iic_intr(void *cookie); @@ -350,6 +350,7 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui int unit; bool rpstart; bool stop; + bool allocated; /* * The hardware interface imposes limits on allowed I2C messages. @@ -410,7 +411,10 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui return (IIC_ENOTSUPP); } - sx_xlock(&sc->call_lock); + /* Check if device is already allocated with iicbus_request_bus() */ + allocated = sx_xlocked(&sc->call_lock) != 0; + if (!allocated) + sx_xlock(&sc->call_lock); /* Debugging - dump registers. */ if (ig4_dump) { @@ -458,7 +462,8 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui rpstart = !stop; } - sx_unlock(&sc->call_lock); + if (!allocated) + sx_unlock(&sc->call_lock); return (error); } @@ -466,8 +471,11 @@ int ig4iic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { ig4iic_softc_t *sc = device_get_softc(dev); + bool allocated; - sx_xlock(&sc->call_lock); + allocated = sx_xlocked(&sc->call_lock) != 0; + if (!allocated) + sx_xlock(&sc->call_lock); /* TODO handle speed configuration? */ if (oldaddr != NULL) @@ -476,8 +484,41 @@ ig4iic_reset(device_t dev, u_char speed, u_char addr, if (addr == IIC_UNKNOWN) sc->slave_valid = false; - sx_unlock(&sc->call_lock); + if (!allocated) + sx_unlock(&sc->call_lock); return (0); +} + +int +ig4iic_callback(device_t dev, int index, caddr_t data) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + int error = 0; + int how; + + switch (index) { + case IIC_REQUEST_BUS: + /* force polling if ig4iic is requested with IIC_DONTWAIT */ + how = *(int *)data; + if ((how & IIC_WAIT) == 0) { + if (sx_try_xlock(&sc->call_lock) == 0) + error = IIC_EBUSBSY; + else + sc->poll = true; + } else + sx_xlock(&sc->call_lock); + break; + + case IIC_RELEASE_BUS: + sc->poll = false; + sx_unlock(&sc->call_lock); + break; + + default: + error = errno2iic(EINVAL); + } + + return (error); } /* Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 20:51:22 2019 (r354301) +++ head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 20:53:13 2019 (r354302) @@ -214,7 +214,7 @@ static device_method_t ig4iic_pci_methods[] = { DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), - DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_callback, ig4iic_callback), DEVMETHOD_END }; Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:51:22 2019 (r354301) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:53:13 2019 (r354302) @@ -67,6 +67,7 @@ struct ig4iic_softc { int slave_valid : 1; int read_started : 1; int write_started : 1; + int poll: 1; /* * Locking semantics: @@ -95,5 +96,6 @@ int ig4iic_detach(ig4iic_softc_t *sc); /* iicbus methods */ extern iicbus_transfer_t ig4iic_transfer; extern iicbus_reset_t ig4iic_reset; +extern iicbus_callback_t ig4iic_callback; #endif /* _ICHIIC_IG4_VAR_H_ */ From owner-svn-src-all@freebsd.org Sun Nov 3 20:54:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC4921A2624; Sun, 3 Nov 2019 20:54:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p7t3zdhz4QGZ; Sun, 3 Nov 2019 20:54:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D5ED1986D; Sun, 3 Nov 2019 20:54:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KsIqc065139; Sun, 3 Nov 2019 20:54:18 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KsImx065137; Sun, 3 Nov 2019 20:54:18 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032054.xA3KsImx065137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354303 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:54:18 -0000 Author: wulf Date: Sun Nov 3 20:54:17 2019 New Revision: 354303 URL: https://svnweb.freebsd.org/changeset/base/354303 Log: [ig4] Do not wait until interrupts are enabled at attach stage as the driver is fully functional on a cold boot through utilization of polled mode. As a side effect, ig4 children probe and attach methods can be called earlier in the boot sequence, so now it is up to the child drivers to wait for a kernel initialization completion if it is required. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:53:13 2019 (r354302) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:54:17 2019 (r354303) @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED() || sc->poll) -static void ig4iic_start(void *xdev); static void ig4iic_intr(void *cookie); static void ig4iic_dump(ig4iic_softc_t *sc); @@ -664,38 +663,14 @@ ig4iic_attach(ig4iic_softc_t *sc) "Unable to setup irq: error %d\n", error); } - sc->enum_hook.ich_func = ig4iic_start; - sc->enum_hook.ich_arg = sc->dev; - - /* - * We have to wait until interrupts are enabled. I2C read and write - * only works if the interrupts are available. - */ - if (config_intrhook_establish(&sc->enum_hook) != 0) - error = ENOMEM; - else - error = 0; - -done: - return (error); -} - -void -ig4iic_start(void *xdev) -{ - int error; - ig4iic_softc_t *sc; - device_t dev = (device_t)xdev; - - sc = device_get_softc(dev); - - config_intrhook_disestablish(&sc->enum_hook); - error = bus_generic_attach(sc->dev); if (error) { device_printf(sc->dev, "failed to attach child: error %d\n", error); } + +done: + return (error); } int Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:53:13 2019 (r354302) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:54:17 2019 (r354303) @@ -48,7 +48,6 @@ enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG struct ig4iic_softc { device_t dev; - struct intr_config_hook enum_hook; device_t iicbus; struct resource *regs_res; int regs_rid; From owner-svn-src-all@freebsd.org Sun Nov 3 20:55:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A30F81A2657; Sun, 3 Nov 2019 20:55:29 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475p9F3lvdz4Tg6; Sun, 3 Nov 2019 20:55:29 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64E891986F; Sun, 3 Nov 2019 20:55:29 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KtTid065271; Sun, 3 Nov 2019 20:55:29 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KtTbL065270; Sun, 3 Nov 2019 20:55:29 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032055.xA3KtTbL065270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:55:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354304 - head/sys/dev/cyapa X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/cyapa X-SVN-Commit-Revision: 354304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:55:29 -0000 Author: wulf Date: Sun Nov 3 20:55:28 2019 New Revision: 354304 URL: https://svnweb.freebsd.org/changeset/base/354304 Log: [cyapa] Postpone start of the polling thread until sleep is available After recent ig4 changes cyapa driver can be attached before timers initialization is completed. Start polling thread from config_intrhook to avoid busy loops in that case. Modified: head/sys/dev/cyapa/cyapa.c Modified: head/sys/dev/cyapa/cyapa.c ============================================================================== --- head/sys/dev/cyapa/cyapa.c Sun Nov 3 20:54:17 2019 (r354303) +++ head/sys/dev/cyapa/cyapa.c Sun Nov 3 20:55:28 2019 (r354304) @@ -152,6 +152,7 @@ struct cyapa_softc { struct cdev *devnode; struct selinfo selinfo; struct mtx mutex; + struct intr_config_hook intr_hook; int cap_resx; int cap_resy; @@ -419,6 +420,27 @@ done: return (error); } +/* + * Start the polling thread + */ +static void +cyapa_start(void *xdev) +{ + struct cyapa_softc *sc; + device_t dev = xdev; + + sc = device_get_softc(dev); + + config_intrhook_disestablish(&sc->intr_hook); + + /* Setup input event tracking */ + cyapa_set_power_mode(sc, CMD_POWER_MODE_IDLE); + + /* Start the polling thread */ + kthread_add(cyapa_poll_thread, sc, NULL, NULL, + 0, 0, "cyapa-poll"); +} + static int cyapa_probe(device_t); static int cyapa_attach(device_t); static int cyapa_detach(device_t); @@ -536,12 +558,14 @@ cyapa_attach(device_t dev) sc->mode.level = 0; sc->mode.packetsize = MOUSE_PS2_PACKETSIZE; - /* Setup input event tracking */ - cyapa_set_power_mode(sc, CMD_POWER_MODE_IDLE); + sc->intr_hook.ich_func = cyapa_start; + sc->intr_hook.ich_arg = sc->dev; - /* Start the polling thread */ - kthread_add(cyapa_poll_thread, sc, NULL, NULL, - 0, 0, "cyapa-poll"); + /* Postpone start of the polling thread until sleep is available */ + if (config_intrhook_establish(&sc->intr_hook) != 0) { + mtx_destroy(&sc->mutex); + return (ENOMEM); + } sc->devnode = make_dev(&cyapa_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, "cyapa%d", unit); From owner-svn-src-all@freebsd.org Sun Nov 3 20:56:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE6FF1A2678; Sun, 3 Nov 2019 20:56:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pBs5y4Sz4Y2Z; Sun, 3 Nov 2019 20:56:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B000F19871; Sun, 3 Nov 2019 20:56:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3KurV9065374; Sun, 3 Nov 2019 20:56:53 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3KurkB065373; Sun, 3 Nov 2019 20:56:53 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032056.xA3KurkB065373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354305 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:56:54 -0000 Author: wulf Date: Sun Nov 3 20:56:53 2019 New Revision: 354305 URL: https://svnweb.freebsd.org/changeset/base/354305 Log: [ig4] dump IG4_REG_COMP_PARAM1 and IG4_REG_COMP_VER registers unconditionally They appeared to be supported (although undocumented) on SkyLakes+ too. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_reg.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:55:28 2019 (r354304) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:56:53 2019 (r354305) @@ -751,10 +751,8 @@ ig4iic_dump(ig4iic_softc_t *sc) REGDUMP(sc, IG4_REG_DMA_RDLR); REGDUMP(sc, IG4_REG_SDA_SETUP); REGDUMP(sc, IG4_REG_ENABLE_STATUS); - if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { - REGDUMP(sc, IG4_REG_COMP_PARAM1); - REGDUMP(sc, IG4_REG_COMP_VER); - } + REGDUMP(sc, IG4_REG_COMP_PARAM1); + REGDUMP(sc, IG4_REG_COMP_VER); if (sc->version == IG4_ATOM) { REGDUMP(sc, IG4_REG_COMP_TYPE); REGDUMP(sc, IG4_REG_CLK_PARMS); Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:55:28 2019 (r354304) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:56:53 2019 (r354305) @@ -112,7 +112,7 @@ #define IG4_REG_SDA_SETUP 0x0094 /* RW SDA Setup */ #define IG4_REG_ACK_GENERAL_CALL 0x0098 /* RW I2C ACK General Call */ #define IG4_REG_ENABLE_STATUS 0x009C /* RO Enable Status */ -/* Available at least on Atom SoCs and Haswell mobile. */ +/* Available at least on Atom SoCs, Haswell mobile and some Skylakes. */ #define IG4_REG_COMP_PARAM1 0x00F4 /* RO Component Parameter */ #define IG4_REG_COMP_VER 0x00F8 /* RO Component Version */ /* Available at least on Atom SoCs */ From owner-svn-src-all@freebsd.org Sun Nov 3 20:58:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67BC41A26A9; Sun, 3 Nov 2019 20:58:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pD81pm6z4cHQ; Sun, 3 Nov 2019 20:58:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2304819872; Sun, 3 Nov 2019 20:58:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Kw074065470; Sun, 3 Nov 2019 20:58:00 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Kvxf8065462; Sun, 3 Nov 2019 20:57:59 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032057.xA3Kvxf8065462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354306 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:58:00 -0000 Author: wulf Date: Sun Nov 3 20:57:59 2019 New Revision: 354306 URL: https://svnweb.freebsd.org/changeset/base/354306 Log: [ig4] Set clock registers based on controller model IC clock rates are varied between different controller models so we have to adjust timing registers in each case individually. Borrow intresting constants and formulas from Intel specs, i2c-designware and lpss_intel drivers and apply them to FreeBSD supported controller models. Implement fetching of timing data via ACPI methods execution if available. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_reg.h head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:56:53 2019 (r354305) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:57:59 2019 (r354306) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); * See ig4_var.h for locking semantics. */ +#include "opt_acpi.h" + #include #include #include @@ -60,6 +62,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DEV_ACPI +#include +#include +#include +#endif + #include #include #include @@ -74,6 +82,43 @@ __FBSDID("$FreeBSD$"); #define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED() || sc->poll) +/* + * tLOW, tHIGH periods of the SCL clock and maximal falling time of both + * lines are taken from I2C specifications. + */ +#define IG4_SPEED_STD_THIGH 4000 /* nsec */ +#define IG4_SPEED_STD_TLOW 4700 /* nsec */ +#define IG4_SPEED_STD_TF_MAX 300 /* nsec */ +#define IG4_SPEED_FAST_THIGH 600 /* nsec */ +#define IG4_SPEED_FAST_TLOW 1300 /* nsec */ +#define IG4_SPEED_FAST_TF_MAX 300 /* nsec */ + +/* + * Ig4 hardware parameters except Haswell are taken from intel_lpss driver + */ +static const struct ig4_hw ig4iic_hw[] = { + [IG4_HASWELL] = { + .ic_clock_rate = 100, /* MHz */ + .sda_hold_time = 90, /* nsec */ + }, + [IG4_ATOM] = { + .ic_clock_rate = 100, + .sda_fall_time = 280, + .scl_fall_time = 240, + .sda_hold_time = 60, + }, + [IG4_SKYLAKE] = { + .ic_clock_rate = 120, + .sda_hold_time = 230, + }, + [IG4_APL] = { + .ic_clock_rate = 133, + .sda_fall_time = 171, + .scl_fall_time = 208, + .sda_hold_time = 207, + }, +}; + static void ig4iic_intr(void *cookie); static void ig4iic_dump(ig4iic_softc_t *sc); @@ -82,6 +127,17 @@ SYSCTL_INT(_debug, OID_AUTO, ig4_dump, CTLFLAG_RW, &ig4_dump, 0, "Dump controller registers"); /* + * Clock registers initialization control + * 0 - Try read clock registers from ACPI and fallback to p.1. + * 1 - Calculate values based on controller type (IC clock rate). + * 2 - Use values inherited from DragonflyBSD driver (old behavior). + * 3 - Keep clock registers intact. + */ +static int ig4_timings; +SYSCTL_INT(_debug, OID_AUTO, ig4_timings, CTLFLAG_RDTUN, &ig4_timings, 0, + "Controller timings 0=ACPI, 1=predefined, 2=legacy, 3=do not change"); + +/* * Low-level inline support functions */ static __inline void @@ -521,6 +577,166 @@ ig4iic_callback(device_t dev, int index, caddr_t data) } /* + * Clock register values can be calculated with following rough equations: + * SCL_HCNT = ceil(IC clock rate * tHIGH) + * SCL_LCNT = ceil(IC clock rate * tLOW) + * SDA_HOLD = ceil(IC clock rate * SDA hold time) + * Precise equations take signal's falling, rising and spike suppression + * times in to account. They can be found in Synopsys or Intel documentation. + * + * Here we snarf formulas and defaults from Linux driver to be able to use + * timing values provided by Intel LPSS driver "as is". + */ +static int +ig4iic_clk_params(const struct ig4_hw *hw, int speed, + uint16_t *scl_hcnt, uint16_t *scl_lcnt, uint16_t *sda_hold) +{ + uint32_t thigh, tlow, tf_max; /* nsec */ + uint32_t sda_fall_time; /* nsec */ + uint32_t scl_fall_time; /* nsec */ + + switch (speed) { + case IG4_CTL_SPEED_STD: + thigh = IG4_SPEED_STD_THIGH; + tlow = IG4_SPEED_STD_TLOW; + tf_max = IG4_SPEED_STD_TF_MAX; + break; + + case IG4_CTL_SPEED_FAST: + thigh = IG4_SPEED_FAST_THIGH; + tlow = IG4_SPEED_FAST_TLOW; + tf_max = IG4_SPEED_FAST_TF_MAX; + break; + + default: + return (EINVAL); + } + + /* Use slowest falling time defaults to be on the safe side */ + sda_fall_time = hw->sda_fall_time == 0 ? tf_max : hw->sda_fall_time; + *scl_hcnt = (uint16_t) + ((hw->ic_clock_rate * (thigh + sda_fall_time) + 500) / 1000 - 3); + + scl_fall_time = hw->scl_fall_time == 0 ? tf_max : hw->scl_fall_time; + *scl_lcnt = (uint16_t) + ((hw->ic_clock_rate * (tlow + scl_fall_time) + 500) / 1000 - 1); + + /* + * There is no "known good" default value for tHD;DAT so keep SDA_HOLD + * intact if sda_hold_time value is not provided. + */ + if (hw->sda_hold_time != 0) + *sda_hold = (uint16_t) + ((hw->ic_clock_rate * hw->sda_hold_time + 500) / 1000); + + return (0); +} + +#ifdef DEV_ACPI +static ACPI_STATUS +ig4iic_acpi_params(ACPI_HANDLE handle, char *method, + uint16_t *scl_hcnt, uint16_t *scl_lcnt, uint16_t *sda_hold) +{ + ACPI_BUFFER buf; + ACPI_OBJECT *obj, *elems; + ACPI_STATUS status; + + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; + + status = AcpiEvaluateObject(handle, method, NULL, &buf); + if (ACPI_FAILURE(status)) + return (status); + + status = AE_TYPE; + obj = (ACPI_OBJECT *)buf.Pointer; + if (obj->Type == ACPI_TYPE_PACKAGE && obj->Package.Count == 3) { + elems = obj->Package.Elements; + *scl_hcnt = elems[0].Integer.Value & IG4_SCL_CLOCK_MASK; + *scl_lcnt = elems[1].Integer.Value & IG4_SCL_CLOCK_MASK; + *sda_hold = elems[2].Integer.Value & IG4_SDA_TX_HOLD_MASK; + status = AE_OK; + } + + AcpiOsFree(obj); + + return (status); +} +#endif /* DEV_ACPI */ + +static void +ig4iic_get_config(ig4iic_softc_t *sc) +{ + const struct ig4_hw *hw; +#ifdef DEV_ACPI + ACPI_HANDLE handle; +#endif + /* Fetch default hardware config from controller */ + sc->cfg.version = reg_read(sc, IG4_REG_COMP_VER); + sc->cfg.bus_speed = reg_read(sc, IG4_REG_CTL) & IG4_CTL_SPEED_MASK; + sc->cfg.ss_scl_hcnt = + reg_read(sc, IG4_REG_SS_SCL_HCNT) & IG4_SCL_CLOCK_MASK; + sc->cfg.ss_scl_lcnt = + reg_read(sc, IG4_REG_SS_SCL_LCNT) & IG4_SCL_CLOCK_MASK; + sc->cfg.fs_scl_hcnt = + reg_read(sc, IG4_REG_FS_SCL_HCNT) & IG4_SCL_CLOCK_MASK; + sc->cfg.fs_scl_lcnt = + reg_read(sc, IG4_REG_FS_SCL_LCNT) & IG4_SCL_CLOCK_MASK; + sc->cfg.ss_sda_hold = sc->cfg.fs_sda_hold = + reg_read(sc, IG4_REG_SDA_HOLD) & IG4_SDA_TX_HOLD_MASK; + + if (sc->cfg.bus_speed != IG4_CTL_SPEED_STD) + sc->cfg.bus_speed = IG4_CTL_SPEED_FAST; + + /* Override hardware config with IC_clock-based counter values */ + if (ig4_timings < 2 && sc->version < nitems(ig4iic_hw)) { + hw = &ig4iic_hw[sc->version]; + sc->cfg.bus_speed = IG4_CTL_SPEED_FAST; + ig4iic_clk_params(hw, IG4_CTL_SPEED_STD, &sc->cfg.ss_scl_hcnt, + &sc->cfg.ss_scl_lcnt, &sc->cfg.ss_sda_hold); + ig4iic_clk_params(hw, IG4_CTL_SPEED_FAST, &sc->cfg.fs_scl_hcnt, + &sc->cfg.fs_scl_lcnt, &sc->cfg.fs_sda_hold); + } else if (ig4_timings == 2) { + /* + * Timings of original ig4 driver: + * Program based on a 25000 Hz clock. This is a bit of a + * hack (obviously). The defaults are 400 and 470 for standard + * and 60 and 130 for fast. The defaults for standard fail + * utterly (presumably cause an abort) because the clock time + * is ~18.8ms by default. This brings it down to ~4ms. + */ + sc->cfg.bus_speed = IG4_CTL_SPEED_STD; + sc->cfg.ss_scl_hcnt = sc->cfg.fs_scl_hcnt = 100; + sc->cfg.ss_scl_lcnt = sc->cfg.fs_scl_lcnt = 125; + if (sc->version == IG4_SKYLAKE) + sc->cfg.ss_sda_hold = sc->cfg.fs_sda_hold = 28; + } + +#ifdef DEV_ACPI + /* Evaluate SSCN and FMCN ACPI methods to fetch timings */ + if (ig4_timings == 0 && (handle = acpi_get_handle(sc->dev)) != NULL) { + ig4iic_acpi_params(handle, "SSCN", &sc->cfg.ss_scl_hcnt, + &sc->cfg.ss_scl_lcnt, &sc->cfg.ss_sda_hold); + ig4iic_acpi_params(handle, "FMCN", &sc->cfg.fs_scl_hcnt, + &sc->cfg.fs_scl_lcnt, &sc->cfg.fs_sda_hold); + } +#endif + + if (bootverbose) { + device_printf(sc->dev, "Controller parameters:\n"); + printf(" Speed: %s\n", + sc->cfg.bus_speed == IG4_CTL_SPEED_STD ? "Std" : "Fast"); + printf(" Regs: HCNT :LCNT :SDAHLD\n"); + printf(" Std: 0x%04hx:0x%04hx:0x%04hx\n", + sc->cfg.ss_scl_hcnt, sc->cfg.ss_scl_lcnt, + sc->cfg.ss_sda_hold); + printf(" Fast: 0x%04hx:0x%04hx:0x%04hx\n", + sc->cfg.fs_scl_hcnt, sc->cfg.fs_scl_lcnt, + sc->cfg.fs_sda_hold); + } +} + +/* * Called from ig4iic_pci_attach/detach() */ int @@ -532,6 +748,8 @@ ig4iic_attach(ig4iic_softc_t *sc) mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); sx_init(&sc->call_lock, "IG4 call lock"); + ig4iic_get_config(sc); + v = reg_read(sc, IG4_REG_DEVIDLE_CTRL); if (sc->version == IG4_SKYLAKE && (v & IG4_RESTORE_REQUIRED) ) { reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE | IG4_RESTORE_REQUIRED); @@ -582,34 +800,17 @@ ig4iic_attach(ig4iic_softc_t *sc) goto done; } - v = reg_read(sc, IG4_REG_SS_SCL_HCNT); - v = reg_read(sc, IG4_REG_SS_SCL_LCNT); - v = reg_read(sc, IG4_REG_FS_SCL_HCNT); - v = reg_read(sc, IG4_REG_FS_SCL_LCNT); - v = reg_read(sc, IG4_REG_SDA_HOLD); - - v = reg_read(sc, IG4_REG_SS_SCL_HCNT); - reg_write(sc, IG4_REG_FS_SCL_HCNT, v); - v = reg_read(sc, IG4_REG_SS_SCL_LCNT); - reg_write(sc, IG4_REG_FS_SCL_LCNT, v); - reg_read(sc, IG4_REG_CLR_INTR); reg_write(sc, IG4_REG_INTR_MASK, 0); sc->intr_mask = 0; - /* - * Program based on a 25000 Hz clock. This is a bit of a - * hack (obviously). The defaults are 400 and 470 for standard - * and 60 and 130 for fast. The defaults for standard fail - * utterly (presumably cause an abort) because the clock time - * is ~18.8ms by default. This brings it down to ~4ms (for now). - */ - reg_write(sc, IG4_REG_SS_SCL_HCNT, 100); - reg_write(sc, IG4_REG_SS_SCL_LCNT, 125); - reg_write(sc, IG4_REG_FS_SCL_HCNT, 100); - reg_write(sc, IG4_REG_FS_SCL_LCNT, 125); - if (sc->version == IG4_SKYLAKE) - reg_write(sc, IG4_REG_SDA_HOLD, 28); + reg_write(sc, IG4_REG_SS_SCL_HCNT, sc->cfg.ss_scl_hcnt); + reg_write(sc, IG4_REG_SS_SCL_LCNT, sc->cfg.ss_scl_lcnt); + reg_write(sc, IG4_REG_FS_SCL_HCNT, sc->cfg.fs_scl_hcnt); + reg_write(sc, IG4_REG_FS_SCL_LCNT, sc->cfg.fs_scl_lcnt); + reg_write(sc, IG4_REG_SDA_HOLD, + (sc->cfg.bus_speed & IG4_CTL_SPEED_MASK) == IG4_CTL_SPEED_STD ? + sc->cfg.ss_sda_hold : sc->cfg.fs_sda_hold); /* * Use a threshold of 1 so we get interrupted on each character, @@ -624,7 +825,7 @@ ig4iic_attach(ig4iic_softc_t *sc) IG4_CTL_MASTER | IG4_CTL_SLAVE_DISABLE | IG4_CTL_RESTARTEN | - IG4_CTL_SPEED_STD); + (sc->cfg.bus_speed & IG4_CTL_SPEED_MASK)); sc->iicbus = device_add_child(sc->dev, "iicbus", -1); if (sc->iicbus == NULL) { Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:56:53 2019 (r354305) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:57:59 2019 (r354306) @@ -154,9 +154,12 @@ #define IG4_CTL_SLAVE_DISABLE 0x0040 /* snarfed from linux */ #define IG4_CTL_RESTARTEN 0x0020 /* Allow Restart when master */ #define IG4_CTL_10BIT 0x0010 /* ctlr accepts 10-bit addresses */ +#define IG4_CTL_SPEED_MASK 0x0006 /* speed at which the I2C operates */ +#define IG4_CTL_MASTER 0x0001 /* snarfed from linux */ + +#define IG4_CTL_SPEED_HIGH 0x0006 /* snarfed from linux */ #define IG4_CTL_SPEED_FAST 0x0004 /* snarfed from linux */ #define IG4_CTL_SPEED_STD 0x0002 /* snarfed from linux */ -#define IG4_CTL_MASTER 0x0001 /* snarfed from linux */ /* * TAR_ADD - Target Address Register 22.2.2 @@ -413,7 +416,7 @@ * * Set the SDA hold time length register in I2C clocks. */ -#define IG4_SDA_HOLD_MASK 0x00FF +#define IG4_SDA_TX_HOLD_MASK 0x0000FFFF /* * TX_ABRT_SOURCE- (RO) Transmit Abort Source Register 22.2.27 Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:56:53 2019 (r354305) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:57:59 2019 (r354306) @@ -46,6 +46,24 @@ enum ig4_op { IG4_IDLE, IG4_READ, IG4_WRITE }; enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL }; +struct ig4_hw { + uint32_t ic_clock_rate; /* MHz */ + uint32_t sda_fall_time; /* nsec */ + uint32_t scl_fall_time; /* nsec */ + uint32_t sda_hold_time; /* nsec */ +}; + +struct ig4_cfg { + uint32_t version; + uint32_t bus_speed; + uint16_t ss_scl_hcnt; + uint16_t ss_scl_lcnt; + uint16_t ss_sda_hold; + uint16_t fs_scl_hcnt; + uint16_t fs_scl_lcnt; + uint16_t fs_sda_hold; +}; + struct ig4iic_softc { device_t dev; device_t iicbus; @@ -57,6 +75,7 @@ struct ig4iic_softc { int intr_type; enum ig4_vers version; enum ig4_op op; + struct ig4_cfg cfg; int cmd; uint32_t intr_mask; int error; From owner-svn-src-all@freebsd.org Sun Nov 3 20:59:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B5D81A26CE; Sun, 3 Nov 2019 20:59:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pFP0k1xz4fJ7; Sun, 3 Nov 2019 20:59:05 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F01D619874; Sun, 3 Nov 2019 20:59:04 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3Kx4rS065561; Sun, 3 Nov 2019 20:59:04 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3Kx4WA065557; Sun, 3 Nov 2019 20:59:04 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032059.xA3Kx4WA065557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 20:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354307 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 20:59:05 -0000 Author: wulf Date: Sun Nov 3 20:59:04 2019 New Revision: 354307 URL: https://svnweb.freebsd.org/changeset/base/354307 Log: [ig4] Implement burst mode for data reads In this mode DATA_CMD register reads and writes are performed in TX/RX FIFO-sized bursts to increase I2C bus utilization. That reduces read time from 60us to 30us per byte when read data is fit in to RX FIFO buffer in FAST speed mode in my setup. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_reg.h head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:57:59 2019 (r354306) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:59:04 2019 (r354307) @@ -100,12 +100,16 @@ static const struct ig4_hw ig4iic_hw[] = { [IG4_HASWELL] = { .ic_clock_rate = 100, /* MHz */ .sda_hold_time = 90, /* nsec */ + .txfifo_depth = 32, + .rxfifo_depth = 32, }, [IG4_ATOM] = { .ic_clock_rate = 100, .sda_fall_time = 280, .scl_fall_time = 240, .sda_hold_time = 60, + .txfifo_depth = 32, + .rxfifo_depth = 32, }, [IG4_SKYLAKE] = { .ic_clock_rate = 120, @@ -330,41 +334,67 @@ ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave) return (0); } +/* + * Amount of unread data before next burst to get better I2C bus utilization. + * 2 bytes is enough in FAST mode. 8 bytes is better in FAST+ and HIGH modes. + * Intel-recommended value is 16 for DMA transfers with 64-byte depth FIFOs. + */ +#define IG4_FIFO_LOWAT 2 + static int ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t len, bool repeated_start, bool stop) { uint32_t cmd; - uint16_t i; + int requested = 0; + int received = 0; + int burst, target, lowat = 0; int error; if (len == 0) return (0); - cmd = IG4_DATA_COMMAND_RD; - cmd |= repeated_start ? IG4_DATA_RESTART : 0; - cmd |= stop && len == 1 ? IG4_DATA_STOP : 0; - - /* Issue request for the first byte (could be last as well). */ - reg_write(sc, IG4_REG_DATA_CMD, cmd); - - for (i = 0; i < len; i++) { - /* - * Maintain a pipeline by queueing the allowance for the next - * read before waiting for the current read. - */ - cmd = IG4_DATA_COMMAND_RD; - if (i < len - 1) { + while (received < len) { + burst = sc->cfg.txfifo_depth - + (reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK); + /* Ensure we have enough free space in RXFIFO */ + burst = MIN(burst, sc->cfg.rxfifo_depth - lowat); + if (burst <= 0) { + error = wait_status(sc, IG4_STATUS_TX_NOTFULL); + if (error) + break; + burst = 1; + } + target = MIN(requested + burst, (int)len); + while (requested < target) { cmd = IG4_DATA_COMMAND_RD; - cmd |= stop && i == len - 2 ? IG4_DATA_STOP : 0; + if (repeated_start && requested == 0) + cmd |= IG4_DATA_RESTART; + if (stop && requested == len - 1) + cmd |= IG4_DATA_STOP; reg_write(sc, IG4_REG_DATA_CMD, cmd); + requested++; } - error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); - if (error) - break; - buf[i] = (uint8_t)reg_read(sc, IG4_REG_DATA_CMD); + /* Leave some data queued to maintain the hardware pipeline */ + lowat = 0; + if (requested != len && requested - received > IG4_FIFO_LOWAT) + lowat = IG4_FIFO_LOWAT; + /* After TXFLR fills up, clear it by reading available data */ + while (received < requested - lowat) { + burst = MIN((int)len - received, + reg_read(sc, IG4_REG_RXFLR) & IG4_FIFOLVL_MASK); + if (burst > 0) { + while (burst--) + buf[received++] = 0xFF & + reg_read(sc, IG4_REG_DATA_CMD); + } else { + error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); + if (error) + goto out; + } + } } - +out: (void)reg_read(sc, IG4_REG_TX_ABRT_SOURCE); return (error); } @@ -668,6 +698,7 @@ static void ig4iic_get_config(ig4iic_softc_t *sc) { const struct ig4_hw *hw; + uint32_t v; #ifdef DEV_ACPI ACPI_HANDLE handle; #endif @@ -688,6 +719,32 @@ ig4iic_get_config(ig4iic_softc_t *sc) if (sc->cfg.bus_speed != IG4_CTL_SPEED_STD) sc->cfg.bus_speed = IG4_CTL_SPEED_FAST; + /* REG_COMP_PARAM1 is not documented in latest Intel specs */ + if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { + v = reg_read(sc, IG4_REG_COMP_PARAM1); + if (IG4_PARAM1_TXFIFO_DEPTH(v) != 0) + sc->cfg.txfifo_depth = IG4_PARAM1_TXFIFO_DEPTH(v); + if (IG4_PARAM1_RXFIFO_DEPTH(v) != 0) + sc->cfg.rxfifo_depth = IG4_PARAM1_RXFIFO_DEPTH(v); + } else { + /* + * Hardware does not allow FIFO Threshold Levels value to be + * set larger than the depth of the buffer. If an attempt is + * made to do that, the actual value set will be the maximum + * depth of the buffer. + */ + v = reg_read(sc, IG4_REG_TX_TL); + reg_write(sc, IG4_REG_TX_TL, v | IG4_FIFO_MASK); + sc->cfg.txfifo_depth = + (reg_read(sc, IG4_REG_TX_TL) & IG4_FIFO_MASK) + 1; + reg_write(sc, IG4_REG_TX_TL, v); + v = reg_read(sc, IG4_REG_RX_TL); + reg_write(sc, IG4_REG_RX_TL, v | IG4_FIFO_MASK); + sc->cfg.rxfifo_depth = + (reg_read(sc, IG4_REG_RX_TL) & IG4_FIFO_MASK) + 1; + reg_write(sc, IG4_REG_RX_TL, v); + } + /* Override hardware config with IC_clock-based counter values */ if (ig4_timings < 2 && sc->version < nitems(ig4iic_hw)) { hw = &ig4iic_hw[sc->version]; @@ -696,6 +753,10 @@ ig4iic_get_config(ig4iic_softc_t *sc) &sc->cfg.ss_scl_lcnt, &sc->cfg.ss_sda_hold); ig4iic_clk_params(hw, IG4_CTL_SPEED_FAST, &sc->cfg.fs_scl_hcnt, &sc->cfg.fs_scl_lcnt, &sc->cfg.fs_sda_hold); + if (hw->txfifo_depth != 0) + sc->cfg.txfifo_depth = hw->txfifo_depth; + if (hw->rxfifo_depth != 0) + sc->cfg.rxfifo_depth = hw->rxfifo_depth; } else if (ig4_timings == 2) { /* * Timings of original ig4 driver: @@ -733,6 +794,8 @@ ig4iic_get_config(ig4iic_softc_t *sc) printf(" Fast: 0x%04hx:0x%04hx:0x%04hx\n", sc->cfg.fs_scl_hcnt, sc->cfg.fs_scl_lcnt, sc->cfg.fs_sda_hold); + printf(" FIFO: RX:0x%04x: TX:0x%04x\n", + sc->cfg.rxfifo_depth, sc->cfg.txfifo_depth); } } Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:57:59 2019 (r354306) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 20:59:04 2019 (r354307) @@ -409,7 +409,7 @@ * FIFOs. Note that for some reason the mask is 9 bits instead of * the 8 bits the fill level controls. */ -#define IG4_FIFOLVL_MASK 0x001F +#define IG4_FIFOLVL_MASK 0x01FF /* * SDA_HOLD - (RW) SDA Hold Time Length Register 22.2.26 @@ -533,8 +533,8 @@ * * DATAW - Indicates the internal bus width in bits. */ -#define IG4_PARAM1_TXFIFO_DEPTH(v) (((v) >> 16) & 0xFF) -#define IG4_PARAM1_RXFIFO_DEPTH(v) (((v) >> 8) & 0xFF) +#define IG4_PARAM1_TXFIFO_DEPTH(v) ((((v) >> 16) & 0xFF) + 1) +#define IG4_PARAM1_RXFIFO_DEPTH(v) ((((v) >> 8) & 0xFF) + 1) #define IG4_PARAM1_CONFIG_VALID 0x00000080 #define IG4_PARAM1_CONFIG_HASDMA 0x00000040 #define IG4_PARAM1_CONFIG_INTR_IO 0x00000020 Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:57:59 2019 (r354306) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:59:04 2019 (r354307) @@ -51,6 +51,8 @@ struct ig4_hw { uint32_t sda_fall_time; /* nsec */ uint32_t scl_fall_time; /* nsec */ uint32_t sda_hold_time; /* nsec */ + int txfifo_depth; + int rxfifo_depth; }; struct ig4_cfg { @@ -62,6 +64,8 @@ struct ig4_cfg { uint16_t fs_scl_hcnt; uint16_t fs_scl_lcnt; uint16_t fs_sda_hold; + int txfifo_depth; + int rxfifo_depth; }; struct ig4iic_softc { From owner-svn-src-all@freebsd.org Sun Nov 3 21:00:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B7921A2A88; Sun, 3 Nov 2019 21:00:57 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pHY2qDsz3GvY; Sun, 3 Nov 2019 21:00:57 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 366C319980; Sun, 3 Nov 2019 21:00:57 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L0vQP066514; Sun, 3 Nov 2019 21:00:57 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L0uoM066509; Sun, 3 Nov 2019 21:00:56 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032100.xA3L0uoM066509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354308 - in head/sys/dev: ichiic iicbus X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/sys/dev: ichiic iicbus X-SVN-Commit-Revision: 354308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:00:57 -0000 Author: wulf Date: Sun Nov 3 21:00:55 2019 New Revision: 354308 URL: https://svnweb.freebsd.org/changeset/base/354308 Log: [ig4] Add suspend/resume support That is done with re-execution of controller initialization procedure from resume handler. PR: 238037 Modified: head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_var.h head/sys/dev/iicbus/iicbus.c Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 20:59:04 2019 (r354307) +++ head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 21:00:55 2019 (r354308) @@ -145,11 +145,29 @@ ig4iic_acpi_detach(device_t dev) return (0); } +static int +ig4iic_acpi_suspend(device_t dev) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + + return (ig4iic_suspend(sc)); +} + +static int +ig4iic_acpi_resume(device_t dev) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + + return (ig4iic_resume(sc)); +} + static device_method_t ig4iic_acpi_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ig4iic_acpi_probe), DEVMETHOD(device_attach, ig4iic_acpi_attach), DEVMETHOD(device_detach, ig4iic_acpi_detach), + DEVMETHOD(device_suspend, ig4iic_acpi_suspend), + DEVMETHOD(device_resume, ig4iic_acpi_resume), /* iicbus interface */ DEVMETHOD(iicbus_transfer, ig4iic_transfer), Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 20:59:04 2019 (r354307) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:00:55 2019 (r354308) @@ -799,20 +799,11 @@ ig4iic_get_config(ig4iic_softc_t *sc) } } -/* - * Called from ig4iic_pci_attach/detach() - */ -int -ig4iic_attach(ig4iic_softc_t *sc) +static int +ig4iic_set_config(ig4iic_softc_t *sc) { - int error; uint32_t v; - mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); - sx_init(&sc->call_lock, "IG4 call lock"); - - ig4iic_get_config(sc); - v = reg_read(sc, IG4_REG_DEVIDLE_CTRL); if (sc->version == IG4_SKYLAKE && (v & IG4_RESTORE_REQUIRED) ) { reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE | IG4_RESTORE_REQUIRED); @@ -851,16 +842,13 @@ ig4iic_attach(ig4iic_softc_t *sc) if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { v = reg_read(sc, IG4_REG_COMP_VER); - if (v < IG4_COMP_MIN_VER) { - error = ENXIO; - goto done; - } + if (v < IG4_COMP_MIN_VER) + return(ENXIO); } if (set_controller(sc, 0)) { device_printf(sc->dev, "controller error during attach-1\n"); - error = ENXIO; - goto done; + return (ENXIO); } reg_read(sc, IG4_REG_CLR_INTR); @@ -890,6 +878,26 @@ ig4iic_attach(ig4iic_softc_t *sc) IG4_CTL_RESTARTEN | (sc->cfg.bus_speed & IG4_CTL_SPEED_MASK)); + return (0); +} + +/* + * Called from ig4iic_pci_attach/detach() + */ +int +ig4iic_attach(ig4iic_softc_t *sc) +{ + int error; + + mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); + sx_init(&sc->call_lock, "IG4 call lock"); + + ig4iic_get_config(sc); + + error = ig4iic_set_config(sc); + if (error) + goto done; + sc->iicbus = device_add_child(sc->dev, "iicbus", -1); if (sc->iicbus == NULL) { device_printf(sc->dev, "iicbus driver not found\n"); @@ -965,6 +973,49 @@ ig4iic_detach(ig4iic_softc_t *sc) sx_destroy(&sc->call_lock); return (0); +} + +int +ig4iic_suspend(ig4iic_softc_t *sc) +{ + int error; + + /* suspend all children */ + error = bus_generic_suspend(sc->dev); + + sx_xlock(&sc->call_lock); + set_controller(sc, 0); + if (sc->version == IG4_SKYLAKE) { + /* + * Place the device in the idle state, just to be safe + */ + reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE); + /* + * Controller can become dysfunctional if I2C lines are pulled + * down when suspend procedure turns off power to I2C device. + * Place device in the reset state to avoid this. + */ + reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL); + } + sx_xunlock(&sc->call_lock); + + return (error); +} + +int ig4iic_resume(ig4iic_softc_t *sc) +{ + int error; + + sx_xlock(&sc->call_lock); + if (ig4iic_set_config(sc)) + device_printf(sc->dev, "controller error during resume\n"); + /* Force setting of the target address on the next transfer */ + sc->slave_valid = 0; + sx_xunlock(&sc->call_lock); + + error = bus_generic_resume(sc->dev); + + return (error); } /* Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 20:59:04 2019 (r354307) +++ head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 21:00:55 2019 (r354308) @@ -206,11 +206,29 @@ ig4iic_pci_detach(device_t dev) return (0); } +static int +ig4iic_pci_suspend(device_t dev) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + + return (ig4iic_suspend(sc)); +} + +static int +ig4iic_pci_resume(device_t dev) +{ + ig4iic_softc_t *sc = device_get_softc(dev); + + return (ig4iic_resume(sc)); +} + static device_method_t ig4iic_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ig4iic_pci_probe), DEVMETHOD(device_attach, ig4iic_pci_attach), DEVMETHOD(device_detach, ig4iic_pci_detach), + DEVMETHOD(device_suspend, ig4iic_pci_suspend), + DEVMETHOD(device_resume, ig4iic_pci_resume), DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 20:59:04 2019 (r354307) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:00:55 2019 (r354308) @@ -114,6 +114,8 @@ extern devclass_t ig4iic_devclass; /* Attach/Detach called from ig4iic_pci_*() */ int ig4iic_attach(ig4iic_softc_t *sc); int ig4iic_detach(ig4iic_softc_t *sc); +int ig4iic_suspend(ig4iic_softc_t *sc); +int ig4iic_resume(ig4iic_softc_t *sc); /* iicbus methods */ extern iicbus_transfer_t ig4iic_transfer; Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Sun Nov 3 20:59:04 2019 (r354307) +++ head/sys/dev/iicbus/iicbus.c Sun Nov 3 21:00:55 2019 (r354308) @@ -330,6 +330,8 @@ static device_method_t iicbus_methods[] = { DEVMETHOD(device_probe, iicbus_probe), DEVMETHOD(device_attach, iicbus_attach), DEVMETHOD(device_detach, iicbus_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), /* bus interface */ DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), From owner-svn-src-all@freebsd.org Sun Nov 3 21:01:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F48D1A2C5E; Sun, 3 Nov 2019 21:01:54 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pJf1W5vz3LYg; Sun, 3 Nov 2019 21:01:54 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 173E119A1E; Sun, 3 Nov 2019 21:01:54 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L1ruK069197; Sun, 3 Nov 2019 21:01:53 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L1rPJ069195; Sun, 3 Nov 2019 21:01:53 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032101.xA3L1rPJ069195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354309 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:01:54 -0000 Author: wulf Date: Sun Nov 3 21:01:53 2019 New Revision: 354309 URL: https://svnweb.freebsd.org/changeset/base/354309 Log: [ig4] Remove dead code inherited from DragonflyBSD Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:00:55 2019 (r354308) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:01:53 2019 (r354309) @@ -68,18 +68,12 @@ __FBSDID("$FreeBSD$"); #include #endif -#include -#include #include #include #include #include -#define TRANS_NORMAL 1 -#define TRANS_PCALL 2 -#define TRANS_BLOCK 3 - #define DO_POLL(sc) (cold || kdb_active || SCHEDULER_STOPPED() || sc->poll) /* @@ -290,21 +284,7 @@ set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) /* * Wait for TXFIFO to drain before disabling the controller. - * - * If a write message has not been completed it's really a - * programming error, but for now in that case issue an extra - * byte + STOP. - * - * If a read message has not been completed it's also a programming - * error, for now just ignore it. */ - wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (sc->write_started) { - reg_write(sc, IG4_REG_DATA_CMD, IG4_DATA_STOP); - sc->write_started = 0; - } - if (sc->read_started) - sc->read_started = 0; wait_status(sc, IG4_STATUS_TX_EMPTY); set_controller(sc, 0); Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:00:55 2019 (r354308) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:01:53 2019 (r354309) @@ -43,7 +43,6 @@ #include "pci_if.h" #include "iicbus_if.h" -enum ig4_op { IG4_IDLE, IG4_READ, IG4_WRITE }; enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL }; struct ig4_hw { @@ -78,17 +77,12 @@ struct ig4iic_softc { void *intr_handle; int intr_type; enum ig4_vers version; - enum ig4_op op; struct ig4_cfg cfg; - int cmd; uint32_t intr_mask; - int error; uint8_t last_slave; int platform_attached : 1; int use_10bit : 1; int slave_valid : 1; - int read_started : 1; - int write_started : 1; int poll: 1; /* From owner-svn-src-all@freebsd.org Sun Nov 3 21:03:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C29321A2C95; Sun, 3 Nov 2019 21:03:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pL448h0z3QPB; Sun, 3 Nov 2019 21:03:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72FD219B77; Sun, 3 Nov 2019 21:03:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L38r2071749; Sun, 3 Nov 2019 21:03:08 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L38F2071748; Sun, 3 Nov 2019 21:03:08 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032103.xA3L38F2071748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354310 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:03:08 -0000 Author: wulf Date: Sun Nov 3 21:03:07 2019 New Revision: 354310 URL: https://svnweb.freebsd.org/changeset/base/354310 Log: [ig4] Rewrite ig4iic_write routine to use TX_EMPTY status flag rather than TX_NOTFULL. It makes possible interrupt utilization while waiting for empty space in TX FIFO. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:01:53 2019 (r354309) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:03:07 2019 (r354310) @@ -384,21 +384,31 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ bool repeated_start, bool stop) { uint32_t cmd; - uint16_t i; + int sent = 0; + int burst, target; int error; if (len == 0) return (0); - cmd = repeated_start ? IG4_DATA_RESTART : 0; - for (i = 0; i < len; i++) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - break; - cmd |= buf[i]; - cmd |= stop && i == len - 1 ? IG4_DATA_STOP : 0; - reg_write(sc, IG4_REG_DATA_CMD, cmd); - cmd = 0; + while (sent < len) { + burst = sc->cfg.txfifo_depth - + (reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK); + target = MIN(sent + burst, (int)len); + while(sent < target) { + cmd = buf[sent]; + if (repeated_start && sent == 0) + cmd |= IG4_DATA_RESTART; + if (stop && sent == len - 1) + cmd |= IG4_DATA_STOP; + reg_write(sc, IG4_REG_DATA_CMD, cmd); + sent++; + } + if (sent < len) { + error = wait_status(sc, IG4_STATUS_TX_EMPTY); + if (error) + break; + } } (void)reg_read(sc, IG4_REG_TX_ABRT_SOURCE); From owner-svn-src-all@freebsd.org Sun Nov 3 21:03:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B40261A2CE3; Sun, 3 Nov 2019 21:03:55 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pLz4DmJz3xMH; Sun, 3 Nov 2019 21:03:55 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75D5319B82; Sun, 3 Nov 2019 21:03:55 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L3td5071823; Sun, 3 Nov 2019 21:03:55 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L3t0H071822; Sun, 3 Nov 2019 21:03:55 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032103.xA3L3t0H071822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354311 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:03:55 -0000 Author: wulf Date: Sun Nov 3 21:03:55 2019 New Revision: 354311 URL: https://svnweb.freebsd.org/changeset/base/354311 Log: [ig4] Convert last remaining usage of TX_NOTFULL status to TX_EMPTY in ig4iic_read routine. It makes possible interrupt utilization while waiting for empty space in TX FIFO. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:03:07 2019 (r354310) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:03:55 2019 (r354311) @@ -337,14 +337,14 @@ ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t while (received < len) { burst = sc->cfg.txfifo_depth - (reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK); - /* Ensure we have enough free space in RXFIFO */ - burst = MIN(burst, sc->cfg.rxfifo_depth - lowat); if (burst <= 0) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); + error = wait_status(sc, IG4_STATUS_TX_EMPTY); if (error) break; - burst = 1; + burst = sc->cfg.txfifo_depth; } + /* Ensure we have enough free space in RXFIFO */ + burst = MIN(burst, sc->cfg.rxfifo_depth - lowat); target = MIN(requested + burst, (int)len); while (requested < target) { cmd = IG4_DATA_COMMAND_RD; From owner-svn-src-all@freebsd.org Sun Nov 3 21:04:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8A411A2D0B; Sun, 3 Nov 2019 21:04:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pN344Scz427f; Sun, 3 Nov 2019 21:04:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EDFB19B83; Sun, 3 Nov 2019 21:04:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L4ptq071906; Sun, 3 Nov 2019 21:04:51 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L4p5I071905; Sun, 3 Nov 2019 21:04:51 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032104.xA3L4p5I071905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354312 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:04:51 -0000 Author: wulf Date: Sun Nov 3 21:04:51 2019 New Revision: 354312 URL: https://svnweb.freebsd.org/changeset/base/354312 Log: [ig4] Use interrupts for waiting for empty TX FIFO Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:03:55 2019 (r354311) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:04:51 2019 (r354312) @@ -252,6 +252,14 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) set_intr_mask(sc, 0); mtx_unlock(&sc->io_lock); count_us += 10000; + } else if ((status & IG4_STATUS_TX_EMPTY) && !DO_POLL(sc)) { + mtx_lock(&sc->io_lock); + set_intr_mask(sc, IG4_INTR_TX_EMPTY); + mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", + (hz + 99) / 100); /* sleep up to 10ms */ + set_intr_mask(sc, 0); + mtx_unlock(&sc->io_lock); + count_us += 10000; } else { DELAY(25); count_us += 25; @@ -861,6 +869,7 @@ ig4iic_set_config(ig4iic_softc_t *sc) * See ig4_var.h for details on interrupt handler synchronization. */ reg_write(sc, IG4_REG_RX_TL, 0); + reg_write(sc, IG4_REG_TX_TL, 0); reg_write(sc, IG4_REG_CTL, IG4_CTL_MASTER | From owner-svn-src-all@freebsd.org Sun Nov 3 21:06:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABEAF1A2D3C; Sun, 3 Nov 2019 21:06:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pPV4320z45Tp; Sun, 3 Nov 2019 21:06:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F7A019B85; Sun, 3 Nov 2019 21:06:06 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L66Ul072019; Sun, 3 Nov 2019 21:06:06 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L666M072018; Sun, 3 Nov 2019 21:06:06 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032106.xA3L666M072018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354313 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:06:06 -0000 Author: wulf Date: Sun Nov 3 21:06:06 2019 New Revision: 354313 URL: https://svnweb.freebsd.org/changeset/base/354313 Log: [ig4] Convert polling loop from status-based to interrupt-based INTR_STAT register exposes more useful informaton then STA register does e.g. it exposes error and I2C bus STOP conditions. Make it a main source of I2C transfer state. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:04:51 2019 (r354312) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:06:06 2019 (r354313) @@ -198,10 +198,10 @@ set_controller(ig4iic_softc_t *sc, uint32_t ctl) } /* - * Wait up to 25ms for the requested status using a 25uS polling loop. + * Wait up to 25ms for the requested interrupt using a 25uS polling loop. */ static int -wait_status(ig4iic_softc_t *sc, uint32_t status) +wait_intr(ig4iic_softc_t *sc, uint32_t intr) { uint32_t v; int error; @@ -215,8 +215,8 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) /* * Check requested status */ - v = reg_read(sc, IG4_REG_I2C_STA); - if (v & status) { + v = reg_read(sc, IG4_REG_RAW_INTR_STAT); + if (v & intr) { error = 0; break; } @@ -226,7 +226,7 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) * reset the timeout if we see a change in the transmit * FIFO level as progress is being made. */ - if (status & IG4_STATUS_TX_EMPTY) { + if (intr & IG4_INTR_TX_EMPTY) { v = reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK; if (txlvl != v) { txlvl = v; @@ -241,25 +241,16 @@ wait_status(ig4iic_softc_t *sc, uint32_t status) break; /* - * When waiting for receive data let the interrupt do its - * work, otherwise poll with the lock held. + * When polling is not requested let the interrupt do its work. */ - if ((status & IG4_STATUS_RX_NOTEMPTY) && !DO_POLL(sc)) { + if (!DO_POLL(sc)) { mtx_lock(&sc->io_lock); - set_intr_mask(sc, IG4_INTR_STOP_DET | IG4_INTR_RX_FULL); + set_intr_mask(sc, intr); mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ set_intr_mask(sc, 0); mtx_unlock(&sc->io_lock); count_us += 10000; - } else if ((status & IG4_STATUS_TX_EMPTY) && !DO_POLL(sc)) { - mtx_lock(&sc->io_lock); - set_intr_mask(sc, IG4_INTR_TX_EMPTY); - mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", - (hz + 99) / 100); /* sleep up to 10ms */ - set_intr_mask(sc, 0); - mtx_unlock(&sc->io_lock); - count_us += 10000; } else { DELAY(25); count_us += 25; @@ -293,7 +284,7 @@ set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) /* * Wait for TXFIFO to drain before disabling the controller. */ - wait_status(sc, IG4_STATUS_TX_EMPTY); + wait_intr(sc, IG4_INTR_TX_EMPTY); set_controller(sc, 0); ctl = reg_read(sc, IG4_REG_CTL); @@ -346,7 +337,7 @@ ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t burst = sc->cfg.txfifo_depth - (reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK); if (burst <= 0) { - error = wait_status(sc, IG4_STATUS_TX_EMPTY); + error = wait_intr(sc, IG4_INTR_TX_EMPTY); if (error) break; burst = sc->cfg.txfifo_depth; @@ -376,7 +367,7 @@ ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t buf[received++] = 0xFF & reg_read(sc, IG4_REG_DATA_CMD); } else { - error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); + error = wait_intr(sc, IG4_INTR_RX_FULL); if (error) goto out; } @@ -413,7 +404,7 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ sent++; } if (sent < len) { - error = wait_status(sc, IG4_STATUS_TX_EMPTY); + error = wait_intr(sc, IG4_INTR_TX_EMPTY); if (error) break; } From owner-svn-src-all@freebsd.org Sun Nov 3 21:07:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D8BF1A2D5C; Sun, 3 Nov 2019 21:07:13 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pQn32Lxz49gM; Sun, 3 Nov 2019 21:07:13 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C07319B86; Sun, 3 Nov 2019 21:07:13 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L7D97072119; Sun, 3 Nov 2019 21:07:13 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L7CqC072117; Sun, 3 Nov 2019 21:07:12 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032107.xA3L7CqC072117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354314 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:07:13 -0000 Author: wulf Date: Sun Nov 3 21:07:12 2019 New Revision: 354314 URL: https://svnweb.freebsd.org/changeset/base/354314 Log: [ig4] Improve error detection Handle error bits of INTR_STAT and TX_ABORT registers. Move interrupt clearing from interrupt handler to polling loop to get common execution path with polled mode. Do not clear interrupts with reading of IG4_REG_CLR_INTR register as interrupts, triggered during the period from reg_read(IG4_REG_INTR_STAT) to reg_read(IG4_REG_CLR_INTR) will be missed. Instead, read each IG4_REG_CLR_* register separately. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_reg.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:06:06 2019 (r354313) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:07:12 2019 (r354314) @@ -164,6 +164,55 @@ set_intr_mask(ig4iic_softc_t *sc, uint32_t val) } } +static int +intrstat2iic(ig4iic_softc_t *sc, uint32_t val) +{ + uint32_t src; + + if (val & IG4_INTR_RX_UNDER) + reg_read(sc, IG4_REG_CLR_RX_UNDER); + if (val & IG4_INTR_RX_OVER) + reg_read(sc, IG4_REG_CLR_RX_OVER); + if (val & IG4_INTR_TX_OVER) + reg_read(sc, IG4_REG_CLR_TX_OVER); + + if (val & IG4_INTR_TX_ABRT) { + src = reg_read(sc, IG4_REG_TX_ABRT_SOURCE); + reg_read(sc, IG4_REG_CLR_TX_ABORT); + /* User-requested abort. Not really a error */ + if (src & IG4_ABRTSRC_TRANSFER) + return (IIC_ESTATUS); + /* Master has lost arbitration */ + if (src & IG4_ABRTSRC_ARBLOST) + return (IIC_EBUSBSY); + /* Did not receive an acknowledge from the remote slave */ + if (src & (IG4_ABRTSRC_TXNOACK_ADDR7 | + IG4_ABRTSRC_TXNOACK_ADDR10_1 | + IG4_ABRTSRC_TXNOACK_ADDR10_2 | + IG4_ABRTSRC_TXNOACK_DATA | + IG4_ABRTSRC_GENCALL_NOACK)) + return (IIC_ENOACK); + /* Programming errors */ + if (src & (IG4_ABRTSRC_GENCALL_READ | + IG4_ABRTSRC_NORESTART_START | + IG4_ABRTSRC_NORESTART_10)) + return (IIC_ENOTSUPP); + /* Other errors */ + if (src & IG4_ABRTSRC_ACKED_START) + return (IIC_EBUSERR); + } + /* + * TX_OVER, RX_OVER and RX_UNDER are caused by wrong RX/TX FIFO depth + * detection or driver's read/write pipelining errors. + */ + if (val & (IG4_INTR_TX_OVER | IG4_INTR_RX_OVER)) + return (IIC_EOVERFLOW); + if (val & IG4_INTR_RX_UNDER) + return (IIC_EUNDERFLOW); + + return (IIC_NOERR); +} + /* * Enable or disable the controller and wait for the controller to acknowledge * the state change. @@ -209,17 +258,14 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) u_int count_us = 0; u_int limit_us = 25000; /* 25ms */ - error = IIC_ETIMEOUT; - for (;;) { /* * Check requested status */ v = reg_read(sc, IG4_REG_RAW_INTR_STAT); - if (v & intr) { - error = 0; + error = intrstat2iic(sc, v & IG4_INTR_ERR_MASK); + if (error || (v & intr)) break; - } /* * When waiting for the transmit FIFO to become empty, @@ -237,15 +283,17 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) /* * Stop if we've run out of time. */ - if (count_us >= limit_us) + if (count_us >= limit_us) { + error = IIC_ETIMEOUT; break; + } /* * When polling is not requested let the interrupt do its work. */ if (!DO_POLL(sc)) { mtx_lock(&sc->io_lock); - set_intr_mask(sc, intr); + set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ set_intr_mask(sc, 0); @@ -307,9 +355,17 @@ set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) * IICBUS API FUNCTIONS */ static int -ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave) +ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave, bool repeated_start) { set_slave_addr(sc, slave >> 1); + + if (!repeated_start) { + /* + * Clear any previous TX/RX FIFOs overflow/underflow bits. + */ + reg_read(sc, IG4_REG_CLR_INTR); + } + return (0); } @@ -374,7 +430,6 @@ ig4iic_read(ig4iic_softc_t *sc, uint8_t *buf, uint16_t } } out: - (void)reg_read(sc, IG4_REG_TX_ABRT_SOURCE); return (error); } @@ -410,7 +465,6 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ } } - (void)reg_read(sc, IG4_REG_TX_ABRT_SOURCE); return (error); } @@ -509,7 +563,7 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui error = 0; for (i = 0; i < nmsgs; i++) { if ((msgs[i].flags & IIC_M_NOSTART) == 0) { - error = ig4iic_xfer_start(sc, msgs[i].slave); + error = ig4iic_xfer_start(sc, msgs[i].slave, rpstart); } else { if (!sc->slave_valid || (msgs[i].slave >> 1) != sc->last_slave) { @@ -1019,8 +1073,8 @@ ig4iic_intr(void *cookie) mtx_lock(&sc->io_lock); /* Ignore stray interrupts */ if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) { + /* Interrupt bits are cleared in wait_intr() loop */ set_intr_mask(sc, 0); - reg_read(sc, IG4_REG_CLR_INTR); wakeup(sc); } mtx_unlock(&sc->io_lock); Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:06:06 2019 (r354313) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:07:12 2019 (r354314) @@ -328,6 +328,9 @@ #define IG4_INTR_RX_OVER 0x0002 #define IG4_INTR_RX_UNDER 0x0001 +#define IG4_INTR_ERR_MASK (IG4_INTR_TX_ABRT | IG4_INTR_TX_OVER | \ + IG4_INTR_RX_OVER | IG4_INTR_RX_UNDER) + /* * RX_TL - (RW) Receive FIFO Threshold Register 22.2.11 * TX_TL - (RW) Transmit FIFO Threshold Register 22.2.12 @@ -435,8 +438,8 @@ #define IG4_ABRTSRC_NORESTART_10 0x00000400 /* RESTART disabled */ #define IG4_ABRTSRC_NORESTART_START 0x00000200 /* RESTART disabled */ #define IG4_ABRTSRC_ACKED_START 0x00000080 /* Improper acked START */ -#define IG4_ABRTSRC_GENCALL_NOACK 0x00000020 /* Improper GENCALL */ -#define IG4_ABRTSRC_GENCALL_READ 0x00000010 /* Nobody acked GENCALL */ +#define IG4_ABRTSRC_GENCALL_READ 0x00000020 /* Improper GENCALL */ +#define IG4_ABRTSRC_GENCALL_NOACK 0x00000010 /* Nobody acked GENCALL */ #define IG4_ABRTSRC_TXNOACK_DATA 0x00000008 /* data phase no ACK */ #define IG4_ABRTSRC_TXNOACK_ADDR10_2 0x00000004 /* addr10/1 phase no ACK */ #define IG4_ABRTSRC_TXNOACK_ADDR10_1 0x00000002 /* addr10/2 phase no ACK */ From owner-svn-src-all@freebsd.org Sun Nov 3 21:08:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87D691A2F72; Sun, 3 Nov 2019 21:08:27 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pSC2rgnz4FlN; Sun, 3 Nov 2019 21:08:27 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 458C319B87; Sun, 3 Nov 2019 21:08:27 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3L8RPN072215; Sun, 3 Nov 2019 21:08:27 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3L8Quq072214; Sun, 3 Nov 2019 21:08:26 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032108.xA3L8Quq072214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354315 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:08:27 -0000 Author: wulf Date: Sun Nov 3 21:08:26 2019 New Revision: 354315 URL: https://svnweb.freebsd.org/changeset/base/354315 Log: [ig4] Set STOP condition and flush TX/RX FIFOs on error if controller has not it done for us yet. Reset controller when transfer abort is failed. Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_reg.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:07:12 2019 (r354314) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:08:26 2019 (r354315) @@ -117,6 +117,7 @@ static const struct ig4_hw ig4iic_hw[] = { }, }; +static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); static void ig4iic_intr(void *cookie); static void ig4iic_dump(ig4iic_softc_t *sc); @@ -272,7 +273,7 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) * reset the timeout if we see a change in the transmit * FIFO level as progress is being made. */ - if (intr & IG4_INTR_TX_EMPTY) { + if (intr & (IG4_INTR_TX_EMPTY | IG4_INTR_STOP_DET)) { v = reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK; if (txlvl != v) { txlvl = v; @@ -369,6 +370,34 @@ ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave, return (0); } +static bool +ig4iic_xfer_is_started(ig4iic_softc_t *sc) +{ + /* + * It requires that no IG4_REG_CLR_INTR or IG4_REG_CLR_START/STOP_DET + * register reads is issued after START condition. + */ + return ((reg_read(sc, IG4_REG_RAW_INTR_STAT) & + (IG4_INTR_START_DET | IG4_INTR_STOP_DET)) == IG4_INTR_START_DET); +} + +static int +ig4iic_xfer_abort(ig4iic_softc_t *sc) +{ + int error; + + /* Request send of STOP condition and flush of TX FIFO */ + set_controller(sc, IG4_I2C_ABORT | IG4_I2C_ENABLE); + /* + * Wait for the TX_ABRT interrupt with ABRTSRC_TRANSFER + * bit set in TX_ABRT_SOURCE register. + */ + error = wait_intr(sc, IG4_INTR_STOP_DET); + set_controller(sc, IG4_I2C_ENABLE); + + return (error == IIC_ESTATUS ? 0 : error); +} + /* * Amount of unread data before next burst to get better I2C bus utilization. * 2 bytes is enough in FAST mode. 8 bytes is better in FAST+ and HIGH modes. @@ -584,8 +613,27 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui else error = ig4iic_write(sc, msgs[i].buf, msgs[i].len, rpstart, stop); - if (error != 0) + + if (error != 0) { + /* + * Send STOP condition if it's not done yet and flush + * both FIFOs. Do a controller soft reset if transfer + * abort is failed. + */ + if (ig4iic_xfer_is_started(sc) && + ig4iic_xfer_abort(sc) != 0) { + device_printf(sc->dev, "Failed to abort " + "transfer. Do the controller reset.\n"); + ig4iic_set_config(sc, true); + } else { + while (reg_read(sc, IG4_REG_I2C_STA) & + IG4_STATUS_RX_NOTEMPTY) + reg_read(sc, IG4_REG_DATA_CMD); + reg_read(sc, IG4_REG_TX_ABRT_SOURCE); + reg_read(sc, IG4_REG_CLR_INTR); + } break; + } rpstart = !stop; } @@ -843,7 +891,7 @@ ig4iic_get_config(ig4iic_softc_t *sc) } static int -ig4iic_set_config(ig4iic_softc_t *sc) +ig4iic_set_config(ig4iic_softc_t *sc, bool reset) { uint32_t v; @@ -851,10 +899,16 @@ ig4iic_set_config(ig4iic_softc_t *sc) if (sc->version == IG4_SKYLAKE && (v & IG4_RESTORE_REQUIRED) ) { reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE | IG4_RESTORE_REQUIRED); reg_write(sc, IG4_REG_DEVIDLE_CTRL, 0); + pause("i2crst", 1); + reset = true; + } + if ((sc->version == IG4_HASWELL || sc->version == IG4_ATOM) && reset) { + reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_ASSERT_HSW); + reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_DEASSERT_HSW); + } else if (sc->version == IG4_SKYLAKE && reset) { reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL); reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_DEASSERT_SKL); - DELAY(1000); } if (sc->version == IG4_ATOM) @@ -922,6 +976,9 @@ ig4iic_set_config(ig4iic_softc_t *sc) IG4_CTL_RESTARTEN | (sc->cfg.bus_speed & IG4_CTL_SPEED_MASK)); + /* Force setting of the target address on the next transfer */ + sc->slave_valid = 0; + return (0); } @@ -938,7 +995,7 @@ ig4iic_attach(ig4iic_softc_t *sc) ig4iic_get_config(sc); - error = ig4iic_set_config(sc); + error = ig4iic_set_config(sc, false); if (error) goto done; @@ -949,19 +1006,6 @@ ig4iic_attach(ig4iic_softc_t *sc) goto done; } -#if 0 - /* - * Don't do this, it blows up the PCI config - */ - if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { - reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_ASSERT_HSW); - reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_DEASSERT_HSW); - } else if (sc->version = IG4_SKYLAKE) { - reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL); - reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_DEASSERT_SKL); - } -#endif - if (set_controller(sc, IG4_I2C_ENABLE)) { device_printf(sc->dev, "controller error during attach-2\n"); error = ENXIO; @@ -1051,10 +1095,8 @@ int ig4iic_resume(ig4iic_softc_t *sc) int error; sx_xlock(&sc->call_lock); - if (ig4iic_set_config(sc)) + if (ig4iic_set_config(sc, sc->version == IG4_SKYLAKE)) device_printf(sc->dev, "controller error during resume\n"); - /* Force setting of the target address on the next transfer */ - sc->slave_valid = 0; sx_xunlock(&sc->call_lock); error = bus_generic_resume(sc->dev); Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:07:12 2019 (r354314) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:08:26 2019 (r354315) @@ -383,7 +383,9 @@ * I2C_EN - (RW) I2C Enable Register 22.2.22 * * ABORT Software can abort an I2C transfer by setting this - * bit. Hardware will clear the bit once the STOP has + * bit. In response, the controller issues the STOP + * condition over the I2C bus, followed by TX FIFO flush. + * Hardware will clear the bit once the STOP has * been detected. This bit can only be set while the * I2C interface is enabled. * From owner-svn-src-all@freebsd.org Sun Nov 3 21:10:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3A6C1A2FBD; Sun, 3 Nov 2019 21:10:48 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pVw1gG2z4MJk; Sun, 3 Nov 2019 21:10:48 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C9A219BA0; Sun, 3 Nov 2019 21:10:48 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LAlsv072391; Sun, 3 Nov 2019 21:10:47 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LAlts072390; Sun, 3 Nov 2019 21:10:47 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032110.xA3LAlts072390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354316 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:10:48 -0000 Author: wulf Date: Sun Nov 3 21:10:47 2019 New Revision: 354316 URL: https://svnweb.freebsd.org/changeset/base/354316 Log: [ig4] On SkyLake controllers issue reset on attach unconditionally. It is very helpful during debugging of I2C issues. It is done only for SkyLakes due to lack of testing on other hardware. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:08:26 2019 (r354315) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:10:47 2019 (r354316) @@ -995,7 +995,7 @@ ig4iic_attach(ig4iic_softc_t *sc) ig4iic_get_config(sc); - error = ig4iic_set_config(sc, false); + error = ig4iic_set_config(sc, sc->version == IG4_SKYLAKE); if (error) goto done; From owner-svn-src-all@freebsd.org Sun Nov 3 21:13:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC5911A313B; Sun, 3 Nov 2019 21:13:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pYS3kc8z4WCW; Sun, 3 Nov 2019 21:13:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64D0219D3E; Sun, 3 Nov 2019 21:13:00 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LD0Db077728; Sun, 3 Nov 2019 21:13:00 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LD0FU077727; Sun, 3 Nov 2019 21:13:00 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032113.xA3LD0FU077727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354317 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:13:00 -0000 Author: wulf Date: Sun Nov 3 21:12:59 2019 New Revision: 354317 URL: https://svnweb.freebsd.org/changeset/base/354317 Log: [ig4] wait for bus stop condition after stop command issued It gives better error detection and ig4 driver's lock coverage in a pipelined write case Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:10:47 2019 (r354316) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:12:59 2019 (r354317) @@ -362,7 +362,8 @@ ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave, if (!repeated_start) { /* - * Clear any previous TX/RX FIFOs overflow/underflow bits. + * Clear any previous TX/RX FIFOs overflow/underflow bits + * and I2C bus STOP condition. */ reg_read(sc, IG4_REG_CLR_INTR); } @@ -613,6 +614,13 @@ ig4iic_transfer(device_t dev, struct iic_msg *msgs, ui else error = ig4iic_write(sc, msgs[i].buf, msgs[i].len, rpstart, stop); + + /* Wait for error or stop condition occurred on the I2C bus */ + if (stop && error == 0) { + error = wait_intr(sc, IG4_INTR_STOP_DET); + if (error == 0) + reg_read(sc, IG4_REG_CLR_INTR); + } if (error != 0) { /* From owner-svn-src-all@freebsd.org Sun Nov 3 21:14:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5BFE1A316C; Sun, 3 Nov 2019 21:14:09 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pZn3nTLz4ZCS; Sun, 3 Nov 2019 21:14:09 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6505F19D3F; Sun, 3 Nov 2019 21:14:09 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LE9rr077820; Sun, 3 Nov 2019 21:14:09 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LE9xI077819; Sun, 3 Nov 2019 21:14:09 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032114.xA3LE9xI077819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:14:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354318 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:14:09 -0000 Author: wulf Date: Sun Nov 3 21:14:08 2019 New Revision: 354318 URL: https://svnweb.freebsd.org/changeset/base/354318 Log: [ig4] Minor improvement of write pipelining With leaving some data queued in the TX FIFO at the end of write cycle. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:12:59 2019 (r354317) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:14:08 2019 (r354318) @@ -471,6 +471,7 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ int sent = 0; int burst, target; int error; + bool lowat_set = false; if (len == 0) return (0); @@ -479,6 +480,11 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ burst = sc->cfg.txfifo_depth - (reg_read(sc, IG4_REG_TXFLR) & IG4_FIFOLVL_MASK); target = MIN(sent + burst, (int)len); + /* Leave some data queued to maintain the hardware pipeline */ + if (!lowat_set && target != len) { + lowat_set = true; + reg_write(sc, IG4_REG_TX_TL, IG4_FIFO_LOWAT); + } while(sent < target) { cmd = buf[sent]; if (repeated_start && sent == 0) @@ -494,6 +500,8 @@ ig4iic_write(ig4iic_softc_t *sc, uint8_t *buf, uint16_ break; } } + if (lowat_set) + reg_write(sc, IG4_REG_TX_TL, 0); return (error); } From owner-svn-src-all@freebsd.org Sun Nov 3 21:15:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D620E1A328F; Sun, 3 Nov 2019 21:15:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pbp2H8mz4cBv; Sun, 3 Nov 2019 21:15:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C2D719D41; Sun, 3 Nov 2019 21:15:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LF1RU077910; Sun, 3 Nov 2019 21:15:01 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LF1A6077908; Sun, 3 Nov 2019 21:15:01 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032115.xA3LF1A6077908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354319 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:15:02 -0000 Author: wulf Date: Sun Nov 3 21:15:01 2019 New Revision: 354319 URL: https://svnweb.freebsd.org/changeset/base/354319 Log: [ig4] Add generic resource methods to bus interface That allows ig4 children to allocate IRQs Modified: head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_pci.c Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 21:14:08 2019 (r354318) +++ head/sys/dev/ichiic/ig4_acpi.c Sun Nov 3 21:15:01 2019 (r354319) @@ -169,6 +169,17 @@ static device_method_t ig4iic_acpi_methods[] = { DEVMETHOD(device_suspend, ig4iic_acpi_suspend), DEVMETHOD(device_resume, ig4iic_acpi_resume), + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + /* iicbus interface */ DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 21:14:08 2019 (r354318) +++ head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 21:15:01 2019 (r354319) @@ -230,6 +230,18 @@ static device_method_t ig4iic_pci_methods[] = { DEVMETHOD(device_suspend, ig4iic_pci_suspend), DEVMETHOD(device_resume, ig4iic_pci_resume), + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + + /* iicbus interface */ DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), DEVMETHOD(iicbus_callback, ig4iic_callback), From owner-svn-src-all@freebsd.org Sun Nov 3 21:16:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA3541A335C; Sun, 3 Nov 2019 21:16:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pd34mlVz4h35; Sun, 3 Nov 2019 21:16:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87C9C19D42; Sun, 3 Nov 2019 21:16:07 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LG7Ju078016; Sun, 3 Nov 2019 21:16:07 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LG6QB078013; Sun, 3 Nov 2019 21:16:06 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032116.xA3LG6QB078013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354320 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:16:07 -0000 Author: wulf Date: Sun Nov 3 21:16:06 2019 New Revision: 354320 URL: https://svnweb.freebsd.org/changeset/base/354320 Log: [ig4] Add support for CannonLake controllers They are clocked at 216MHz rate, much higher than previous models. PR: 240485 Submitted by: Neel Chauhan Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_reg.h head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:15:01 2019 (r354319) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:16:06 2019 (r354320) @@ -115,6 +115,10 @@ static const struct ig4_hw ig4iic_hw[] = { .scl_fall_time = 208, .sda_hold_time = 207, }, + [IG4_CANNONLAKE] = { + .ic_clock_rate = 216, + .sda_hold_time = 230, + }, }; static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); @@ -912,7 +916,7 @@ ig4iic_set_config(ig4iic_softc_t *sc, bool reset) uint32_t v; v = reg_read(sc, IG4_REG_DEVIDLE_CTRL); - if (sc->version == IG4_SKYLAKE && (v & IG4_RESTORE_REQUIRED) ) { + if (IG4_HAS_ADDREGS(sc->version) && (v & IG4_RESTORE_REQUIRED)) { reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE | IG4_RESTORE_REQUIRED); reg_write(sc, IG4_REG_DEVIDLE_CTRL, 0); pause("i2crst", 1); @@ -922,7 +926,7 @@ ig4iic_set_config(ig4iic_softc_t *sc, bool reset) if ((sc->version == IG4_HASWELL || sc->version == IG4_ATOM) && reset) { reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_ASSERT_HSW); reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_DEASSERT_HSW); - } else if (sc->version == IG4_SKYLAKE && reset) { + } else if (IG4_HAS_ADDREGS(sc->version) && reset) { reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL); reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_DEASSERT_SKL); } @@ -948,7 +952,7 @@ ig4iic_set_config(ig4iic_softc_t *sc, bool reset) if (sc->version == IG4_HASWELL) { v = reg_read(sc, IG4_REG_SW_LTR_VALUE); v = reg_read(sc, IG4_REG_AUTO_LTR_VALUE); - } else if (sc->version == IG4_SKYLAKE) { + } else if (IG4_HAS_ADDREGS(sc->version)) { v = reg_read(sc, IG4_REG_ACTIVE_LTR_VALUE); v = reg_read(sc, IG4_REG_IDLE_LTR_VALUE); } @@ -1011,7 +1015,7 @@ ig4iic_attach(ig4iic_softc_t *sc) ig4iic_get_config(sc); - error = ig4iic_set_config(sc, sc->version == IG4_SKYLAKE); + error = ig4iic_set_config(sc, IG4_HAS_ADDREGS(sc->version)); if (error) goto done; @@ -1089,7 +1093,7 @@ ig4iic_suspend(ig4iic_softc_t *sc) sx_xlock(&sc->call_lock); set_controller(sc, 0); - if (sc->version == IG4_SKYLAKE) { + if (IG4_HAS_ADDREGS(sc->version)) { /* * Place the device in the idle state, just to be safe */ @@ -1111,7 +1115,7 @@ int ig4iic_resume(ig4iic_softc_t *sc) int error; sx_xlock(&sc->call_lock); - if (ig4iic_set_config(sc, sc->version == IG4_SKYLAKE)) + if (ig4iic_set_config(sc, IG4_HAS_ADDREGS(sc->version))) device_printf(sc->dev, "controller error during resume\n"); sx_xunlock(&sc->call_lock); @@ -1183,7 +1187,7 @@ ig4iic_dump(ig4iic_softc_t *sc) if (sc->version == IG4_HASWELL) { REGDUMP(sc, IG4_REG_SW_LTR_VALUE); REGDUMP(sc, IG4_REG_AUTO_LTR_VALUE); - } else if (sc->version == IG4_SKYLAKE) { + } else if (IG4_HAS_ADDREGS(sc->version)) { REGDUMP(sc, IG4_REG_ACTIVE_LTR_VALUE); REGDUMP(sc, IG4_REG_IDLE_LTR_VALUE); } Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 21:15:01 2019 (r354319) +++ head/sys/dev/ichiic/ig4_pci.c Sun Nov 3 21:16:06 2019 (r354320) @@ -90,6 +90,16 @@ static int ig4iic_pci_detach(device_t dev); #define PCI_CHIP_APL_I2C_5 0x5ab68086 #define PCI_CHIP_APL_I2C_6 0x5ab88086 #define PCI_CHIP_APL_I2C_7 0x5aba8086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_0 0x9dc58086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_1 0x9dc68086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_2 0x9de88086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_3 0x9de98086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_4 0x9dea8086 +#define PCI_CHIP_CANNONLAKE_LP_I2C_5 0x9deb8086 +#define PCI_CHIP_CANNONLAKE_H_I2C_0 0xa3688086 +#define PCI_CHIP_CANNONLAKE_H_I2C_1 0xa3698086 +#define PCI_CHIP_CANNONLAKE_H_I2C_2 0xa36a8086 +#define PCI_CHIP_CANNONLAKE_H_I2C_3 0xa36b8086 struct ig4iic_pci_device { uint32_t devid; @@ -121,7 +131,17 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", IG4_APL}, { PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", IG4_APL}, { PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", IG4_APL}, - { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL} + { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL}, + { PCI_CHIP_CANNONLAKE_LP_I2C_0, "Intel Cannon Lake-LP I2C Controller-0", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_LP_I2C_1, "Intel Cannon Lake-LP I2C Controller-1", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_LP_I2C_2, "Intel Cannon Lake-LP I2C Controller-2", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_LP_I2C_3, "Intel Cannon Lake-LP I2C Controller-3", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_LP_I2C_4, "Intel Cannon Lake-LP I2C Controller-4", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_LP_I2C_5, "Intel Cannon Lake-LP I2C Controller-5", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_H_I2C_0, "Intel Cannon Lake-H I2C Controller-0", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_H_I2C_1, "Intel Cannon Lake-H I2C Controller-1", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_H_I2C_2, "Intel Cannon Lake-H I2C Controller-2", IG4_CANNONLAKE}, + { PCI_CHIP_CANNONLAKE_H_I2C_3, "Intel Cannon Lake-H I2C Controller-3", IG4_CANNONLAKE}, }; static int Modified: head/sys/dev/ichiic/ig4_reg.h ============================================================================== --- head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:15:01 2019 (r354319) +++ head/sys/dev/ichiic/ig4_reg.h Sun Nov 3 21:16:06 2019 (r354320) @@ -117,7 +117,7 @@ #define IG4_REG_COMP_VER 0x00F8 /* RO Component Version */ /* Available at least on Atom SoCs */ #define IG4_REG_COMP_TYPE 0x00FC /* RO Probe width/endian? (linux) */ -/* Available on Skylake-U/Y and Kaby Lake-U/Y */ +/* 0x200-0x2FF - Additional registers available on Skylake-U/Y and others */ #define IG4_REG_RESETS_SKL 0x0204 /* RW Reset Register */ #define IG4_REG_ACTIVE_LTR_VALUE 0x0210 /* RW Active LTR Value */ #define IG4_REG_IDLE_LTR_VALUE 0x0214 /* RW Idle LTR Value */ Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:15:01 2019 (r354319) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:16:06 2019 (r354320) @@ -43,7 +43,10 @@ #include "pci_if.h" #include "iicbus_if.h" -enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL }; +enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL, IG4_CANNONLAKE }; +/* Controller has additional registers */ +#define IG4_HAS_ADDREGS(vers) ((vers) == IG4_SKYLAKE || \ + (vers) == IG4_CANNONLAKE) struct ig4_hw { uint32_t ic_clock_rate; /* MHz */ From owner-svn-src-all@freebsd.org Sun Nov 3 21:17:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F1991A342B; Sun, 3 Nov 2019 21:17:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pf633Yxz4hZ6; Sun, 3 Nov 2019 21:17:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DA4719D4C; Sun, 3 Nov 2019 21:17:02 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LH2Pu078113; Sun, 3 Nov 2019 21:17:02 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LH2nX078112; Sun, 3 Nov 2019 21:17:02 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032117.xA3LH2nX078112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354321 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:17:02 -0000 Author: wulf Date: Sun Nov 3 21:17:01 2019 New Revision: 354321 URL: https://svnweb.freebsd.org/changeset/base/354321 Log: [ig4] Enable additional registers support on Appolo Lake controllers To be inline with intel-lpss Linux driver Modified: head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:16:06 2019 (r354320) +++ head/sys/dev/ichiic/ig4_var.h Sun Nov 3 21:17:01 2019 (r354321) @@ -46,7 +46,7 @@ enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL, IG4_CANNONLAKE }; /* Controller has additional registers */ #define IG4_HAS_ADDREGS(vers) ((vers) == IG4_SKYLAKE || \ - (vers) == IG4_CANNONLAKE) + (vers) == IG4_APL || (vers) == IG4_CANNONLAKE) struct ig4_hw { uint32_t ic_clock_rate; /* MHz */ From owner-svn-src-all@freebsd.org Sun Nov 3 21:17:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC8101A3500; Sun, 3 Nov 2019 21:17:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pg32rppz4hhq; Sun, 3 Nov 2019 21:17:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46BBA19D4D; Sun, 3 Nov 2019 21:17:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LHpxu078187; Sun, 3 Nov 2019 21:17:51 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LHpKK078186; Sun, 3 Nov 2019 21:17:51 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911032117.xA3LHpKK078186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 3 Nov 2019 21:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354322 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:17:51 -0000 Author: wulf Date: Sun Nov 3 21:17:50 2019 New Revision: 354322 URL: https://svnweb.freebsd.org/changeset/base/354322 Log: [ig4] Convert ithread interrupt handler to filter based one. Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:01 2019 (r354321) +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:50 2019 (r354322) @@ -122,7 +122,7 @@ static const struct ig4_hw ig4iic_hw[] = { }; static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); -static void ig4iic_intr(void *cookie); +static driver_filter_t ig4iic_intr; static void ig4iic_dump(ig4iic_softc_t *sc); static int ig4_dump; @@ -297,12 +297,12 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) * When polling is not requested let the interrupt do its work. */ if (!DO_POLL(sc)) { - mtx_lock(&sc->io_lock); + mtx_lock_spin(&sc->io_lock); set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); - mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", + msleep_spin(sc, &sc->io_lock, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ set_intr_mask(sc, 0); - mtx_unlock(&sc->io_lock); + mtx_unlock_spin(&sc->io_lock); count_us += 10000; } else { DELAY(25); @@ -1010,7 +1010,7 @@ ig4iic_attach(ig4iic_softc_t *sc) { int error; - mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); + mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_SPIN); sx_init(&sc->call_lock, "IG4 call lock"); ig4iic_get_config(sc); @@ -1037,7 +1037,7 @@ ig4iic_attach(ig4iic_softc_t *sc) goto done; } error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE, - NULL, ig4iic_intr, sc, &sc->intr_handle); + ig4iic_intr, NULL, sc, &sc->intr_handle); if (error) { device_printf(sc->dev, "Unable to setup irq: error %d\n", error); @@ -1127,19 +1127,23 @@ int ig4iic_resume(ig4iic_softc_t *sc) /* * Interrupt Operation, see ig4_var.h for locking semantics. */ -static void +static int ig4iic_intr(void *cookie) { ig4iic_softc_t *sc = cookie; + int retval = FILTER_STRAY; - mtx_lock(&sc->io_lock); + mtx_lock_spin(&sc->io_lock); /* Ignore stray interrupts */ if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) { /* Interrupt bits are cleared in wait_intr() loop */ set_intr_mask(sc, 0); wakeup(sc); + retval = FILTER_HANDLED; } - mtx_unlock(&sc->io_lock); + mtx_unlock_spin(&sc->io_lock); + + return (retval); } #define REGDUMP(sc, reg) \ From owner-svn-src-all@freebsd.org Sun Nov 3 21:19:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB9F21A3694; Sun, 3 Nov 2019 21:19:52 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475pjN5t0wz4hww; Sun, 3 Nov 2019 21:19:52 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE22E19D50; Sun, 3 Nov 2019 21:19:52 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LJqBH078314; Sun, 3 Nov 2019 21:19:52 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LJqFb078312; Sun, 3 Nov 2019 21:19:52 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911032119.xA3LJqFb078312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 21:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354323 - in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head: stand/libsa/zfs sys/cddl/boot/zfs X-SVN-Commit-Revision: 354323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:19:52 -0000 Author: tsoome Date: Sun Nov 3 21:19:52 2019 New Revision: 354323 URL: https://svnweb.freebsd.org/changeset/base/354323 Log: loader: factor out label and uberblock load from vdev_probe, add MMP checks Clean up the label read. Modified: head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 21:17:50 2019 (r354322) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 21:19:52 2019 (r354323) @@ -1549,71 +1549,104 @@ vdev_label_offset(uint64_t psize, int l, uint64_t offs } static int -vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap) +vdev_uberblock_compare(const uberblock_t *ub1, const uberblock_t *ub2) { - vdev_t vtmp; - vdev_phys_t *vdev_label = (vdev_phys_t *) zap_scratch; - vdev_phys_t *tmp_label; - spa_t *spa; - vdev_t *vdev, *top_vdev, *pool_vdev; - off_t off; + unsigned int seq1 = 0; + unsigned int seq2 = 0; + int cmp = AVL_CMP(ub1->ub_txg, ub2->ub_txg); + + if (cmp != 0) + return (cmp); + + cmp = AVL_CMP(ub1->ub_timestamp, ub2->ub_timestamp); + if (cmp != 0) + return (cmp); + + if (MMP_VALID(ub1) && MMP_SEQ_VALID(ub1)) + seq1 = MMP_SEQ(ub1); + + if (MMP_VALID(ub2) && MMP_SEQ_VALID(ub2)) + seq2 = MMP_SEQ(ub2); + + return (AVL_CMP(seq1, seq2)); +} + +static int +uberblock_verify(uberblock_t *ub) +{ + if (ub->ub_magic == BSWAP_64((uint64_t)UBERBLOCK_MAGIC)) { + byteswap_uint64_array(ub, sizeof (uberblock_t)); + } + + if (ub->ub_magic != UBERBLOCK_MAGIC || + !SPA_VERSION_IS_SUPPORTED(ub->ub_version)) + return (EINVAL); + + return (0); +} + +static int +vdev_label_read(vdev_t *vd, int l, void *buf, uint64_t offset, + size_t size) +{ blkptr_t bp; - const unsigned char *nvlist = NULL; - uint64_t val; - uint64_t guid; - uint64_t best_txg = 0; - uint64_t pool_txg, pool_guid; - const char *pool_name; - const unsigned char *vdevs; - const unsigned char *features; - int i, l, rc, is_newer; - char *upbuf; - const struct uberblock *up; + off_t off; - /* - * Load the vdev label and figure out which - * uberblock is most current. - */ - memset(&vtmp, 0, sizeof(vtmp)); - vtmp.v_phys_read = _read; - vtmp.v_read_priv = read_priv; - vtmp.v_psize = P2ALIGN(ldi_get_size(read_priv), - (uint64_t)sizeof (vdev_label_t)); + off = vdev_label_offset(vd->v_psize, l, offset); - /* Test for minimum pool size. */ - if (vtmp.v_psize < SPA_MINDEVSIZE) - return (EIO); + BP_ZERO(&bp); + BP_SET_LSIZE(&bp, size); + BP_SET_PSIZE(&bp, size); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); + DVA_SET_OFFSET(BP_IDENTITY(&bp), off); + ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - tmp_label = zfs_alloc(sizeof(vdev_phys_t)); + return (vdev_read_phys(vd, &bp, buf, off, size)); +} - for (l = 0; l < VDEV_LABELS; l++) { - off = vdev_label_offset(vtmp.v_psize, l, - offsetof(vdev_label_t, vl_vdev_phys)); +static unsigned char * +vdev_label_read_config(vdev_t *vd, uint64_t txg) +{ + vdev_phys_t *label; + uint64_t best_txg = 0; + uint64_t label_txg = 0; + uint64_t asize; + unsigned char *nvl; + size_t nvl_size; + int error; - BP_ZERO(&bp); - BP_SET_LSIZE(&bp, sizeof(vdev_phys_t)); - BP_SET_PSIZE(&bp, sizeof(vdev_phys_t)); - BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); - BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); - DVA_SET_OFFSET(BP_IDENTITY(&bp), off); - ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); + label = malloc(sizeof (vdev_phys_t)); + if (label == NULL) + return (NULL); - if (vdev_read_phys(&vtmp, &bp, tmp_label, off, 0)) - continue; + nvl_size = VDEV_PHYS_SIZE - sizeof (zio_eck_t) - 4; + nvl = malloc(nvl_size); + if (nvl == NULL) { + free(label); + return (NULL); + } - if (tmp_label->vp_nvlist[0] != NV_ENCODE_XDR) + for (int l = 0; l < VDEV_LABELS; l++) { + const unsigned char *nvlist; + + if (vdev_label_read(vd, l, label, + offsetof(vdev_label_t, vl_vdev_phys), + sizeof (vdev_phys_t))) continue; - nvlist = (const unsigned char *) tmp_label->vp_nvlist + 4; - if (nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, - DATA_TYPE_UINT64, NULL, &pool_txg) != 0) + if (label->vp_nvlist[0] != NV_ENCODE_XDR) continue; - if (best_txg <= pool_txg) { - uint64_t asize; + nvlist = (const unsigned char *) label->vp_nvlist + 4; + error = nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, + DATA_TYPE_UINT64, NULL, &label_txg); + if (error != 0 || label_txg == 0) + return (nvl); - best_txg = pool_txg; - memcpy(vdev_label, tmp_label, sizeof (vdev_phys_t)); + if (label_txg <= txg && label_txg > best_txg) { + best_txg = label_txg; + memcpy(nvl, nvlist, nvl_size); /* * Use asize from pool config. We need this @@ -1621,30 +1654,87 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s */ if (nvlist_find(nvlist, ZPOOL_CONFIG_ASIZE, DATA_TYPE_UINT64, NULL, &asize) == 0) { - vtmp.v_psize = asize + + vd->v_psize = asize + VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; } } } - zfs_free(tmp_label, sizeof (vdev_phys_t)); + if (best_txg == 0) { + free(nvl); + nvl = NULL; + } + return (nvl); +} - if (best_txg == 0) +static void +vdev_uberblock_load(vdev_t *vd, uberblock_t *ub) +{ + uberblock_t *buf; + + buf = malloc(VDEV_UBERBLOCK_SIZE(vd)); + if (buf == NULL) + return; + + for (int l = 0; l < VDEV_LABELS; l++) { + for (int n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { + if (vdev_label_read(vd, l, buf, + VDEV_UBERBLOCK_OFFSET(vd, n), + VDEV_UBERBLOCK_SIZE(vd))) + continue; + if (uberblock_verify(buf) != 0) + continue; + + if (vdev_uberblock_compare(buf, ub) > 0) + *ub = *buf; + } + } + free(buf); +} + +static int +vdev_probe(vdev_phys_read_t *_read, void *read_priv, spa_t **spap) +{ + vdev_t vtmp; + spa_t *spa; + vdev_t *vdev, *top_vdev, *pool_vdev; + unsigned char *nvlist; + uint64_t val; + uint64_t guid; + uint64_t pool_txg, pool_guid; + const char *pool_name; + const unsigned char *vdevs; + const unsigned char *features; + int rc, is_newer; + + /* + * Load the vdev label and figure out which + * uberblock is most current. + */ + memset(&vtmp, 0, sizeof(vtmp)); + vtmp.v_phys_read = _read; + vtmp.v_read_priv = read_priv; + vtmp.v_psize = P2ALIGN(ldi_get_size(read_priv), + (uint64_t)sizeof (vdev_label_t)); + + /* Test for minimum device size. */ + if (vtmp.v_psize < SPA_MINDEVSIZE) return (EIO); - if (vdev_label->vp_nvlist[0] != NV_ENCODE_XDR) + nvlist = vdev_label_read_config(&vtmp, UINT64_MAX); + if (nvlist == NULL) return (EIO); - nvlist = (const unsigned char *) vdev_label->vp_nvlist + 4; - if (nvlist_find(nvlist, ZPOOL_CONFIG_VERSION, DATA_TYPE_UINT64, NULL, &val) != 0) { + free(nvlist); return (EIO); } if (!SPA_VERSION_IS_SUPPORTED(val)) { printf("ZFS: unsupported ZFS version %u (should be %u)\n", (unsigned) val, (unsigned) SPA_VERSION); + free(nvlist); return (EIO); } @@ -1652,16 +1742,19 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s if (nvlist_find(nvlist, ZPOOL_CONFIG_FEATURES_FOR_READ, DATA_TYPE_NVLIST, NULL, &features) == 0 && nvlist_check_features_for_read(features) != 0) { + free(nvlist); return (EIO); } if (nvlist_find(nvlist, ZPOOL_CONFIG_POOL_STATE, DATA_TYPE_UINT64, NULL, &val) != 0) { + free(nvlist); return (EIO); } if (val == POOL_STATE_DESTROYED) { /* We don't boot only from destroyed pools. */ + free(nvlist); return (EIO); } @@ -1675,12 +1768,13 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s * Cache and spare devices end up here - just ignore * them. */ - /*printf("ZFS: can't find pool details\n");*/ + free(nvlist); return (EIO); } if (nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, NULL, &val) == 0 && val != 0) { + free(nvlist); return (EIO); } @@ -1690,8 +1784,10 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s spa = spa_find_by_guid(pool_guid); if (spa == NULL) { spa = spa_create(pool_guid, pool_name); - if (spa == NULL) + if (spa == NULL) { + free(nvlist); return (ENOMEM); + } } if (pool_txg > spa->spa_txg) { spa->spa_txg = pool_txg; @@ -1708,18 +1804,24 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s */ if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, NULL, &guid) != 0) { + free(nvlist); return (EIO); } vdev = vdev_find(guid); - if (vdev && vdev->v_phys_read) /* Has this vdev already been inited? */ + /* Has this vdev already been inited? */ + if (vdev && vdev->v_phys_read) { + free(nvlist); return (EIO); + } if (nvlist_find(nvlist, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, NULL, &vdevs)) { + free(nvlist); return (EIO); } rc = vdev_init_from_nvlist(vdevs, NULL, &top_vdev, is_newer); + free(nvlist); if (rc != 0) return (rc); @@ -1729,6 +1831,7 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink) if (top_vdev == pool_vdev) break; + if (!pool_vdev && top_vdev) { top_vdev->spa = spa; STAILQ_INSERT_TAIL(&spa->spa_vdevs, top_vdev, v_childlink); @@ -1765,36 +1868,7 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s * the best uberblock and then we can actually access * the contents of the pool. */ - upbuf = zfs_alloc(VDEV_UBERBLOCK_SIZE(vdev)); - up = (const struct uberblock *)upbuf; - for (l = 0; l < VDEV_LABELS; l++) { - for (i = 0; i < VDEV_UBERBLOCK_COUNT(vdev); i++) { - off = vdev_label_offset(vdev->v_psize, l, - VDEV_UBERBLOCK_OFFSET(vdev, i)); - BP_ZERO(&bp); - DVA_SET_OFFSET(&bp.blk_dva[0], off); - BP_SET_LSIZE(&bp, VDEV_UBERBLOCK_SIZE(vdev)); - BP_SET_PSIZE(&bp, VDEV_UBERBLOCK_SIZE(vdev)); - BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); - BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); - ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - - if (vdev_read_phys(vdev, &bp, upbuf, off, 0)) - continue; - - if (up->ub_magic != UBERBLOCK_MAGIC) - continue; - if (up->ub_txg < spa->spa_txg) - continue; - if (up->ub_txg > spa->spa_uberblock.ub_txg || - (up->ub_txg == spa->spa_uberblock.ub_txg && - up->ub_timestamp > - spa->spa_uberblock.ub_timestamp)) { - spa->spa_uberblock = *up; - } - } - } - zfs_free(upbuf, VDEV_UBERBLOCK_SIZE(vdev)); + vdev_uberblock_load(vdev, &spa->spa_uberblock); vdev->spa = spa; if (spap != NULL) Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 21:17:50 2019 (r354322) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 21:19:52 2019 (r354323) @@ -63,6 +63,14 @@ #define _NOTE(s) +/* + * AVL comparator helpers + */ +#define AVL_ISIGN(a) (((a) > 0) - ((a) < 0)) +#define AVL_CMP(a, b) (((a) > (b)) - ((a) < (b))) +#define AVL_PCMP(a, b) \ + (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b))) + typedef enum { B_FALSE, B_TRUE } boolean_t; /* CRC64 table */ @@ -490,8 +498,16 @@ typedef struct zio_gbh { #define VDEV_PHYS_SIZE (112 << 10) #define VDEV_UBERBLOCK_RING (128 << 10) +/* + * MMP blocks occupy the last MMP_BLOCKS_PER_LABEL slots in the uberblock + * ring when MMP is enabled. + */ +#define MMP_BLOCKS_PER_LABEL 1 + +/* The largest uberblock we support is 8k. */ +#define MAX_UBERBLOCK_SHIFT (13) #define VDEV_UBERBLOCK_SHIFT(vd) \ - MAX((vd)->v_top->v_ashift, UBERBLOCK_SHIFT) + MIN(MAX((vd)->v_top->v_ashift, UBERBLOCK_SHIFT), MAX_UBERBLOCK_SHIFT) #define VDEV_UBERBLOCK_COUNT(vd) \ (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd)) #define VDEV_UBERBLOCK_OFFSET(vd, n) \ @@ -841,14 +857,88 @@ typedef enum pool_state { #define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ #define UBERBLOCK_SHIFT 10 /* up to 1K */ -struct uberblock { +#define MMP_MAGIC 0xa11cea11 /* all-see-all */ + +#define MMP_INTERVAL_VALID_BIT 0x01 +#define MMP_SEQ_VALID_BIT 0x02 +#define MMP_FAIL_INT_VALID_BIT 0x04 + +#define MMP_VALID(ubp) (ubp->ub_magic == UBERBLOCK_MAGIC && \ + ubp->ub_mmp_magic == MMP_MAGIC) +#define MMP_INTERVAL_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_INTERVAL_VALID_BIT)) +#define MMP_SEQ_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_SEQ_VALID_BIT)) +#define MMP_FAIL_INT_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_FAIL_INT_VALID_BIT)) + +#define MMP_INTERVAL(ubp) ((ubp->ub_mmp_config & 0x00000000FFFFFF00) \ + >> 8) +#define MMP_SEQ(ubp) ((ubp->ub_mmp_config & 0x0000FFFF00000000) \ + >> 32) +#define MMP_FAIL_INT(ubp) ((ubp->ub_mmp_config & 0xFFFF000000000000) \ + >> 48) + +typedef struct uberblock { uint64_t ub_magic; /* UBERBLOCK_MAGIC */ uint64_t ub_version; /* SPA_VERSION */ uint64_t ub_txg; /* txg of last sync */ uint64_t ub_guid_sum; /* sum of all vdev guids */ uint64_t ub_timestamp; /* UTC time of last sync */ blkptr_t ub_rootbp; /* MOS objset_phys_t */ -}; + /* highest SPA_VERSION supported by software that wrote this txg */ + uint64_t ub_software_version; + /* Maybe missing in uberblocks we read, but always written */ + uint64_t ub_mmp_magic; + /* + * If ub_mmp_delay == 0 and ub_mmp_magic is valid, MMP is off. + * Otherwise, nanosec since last MMP write. + */ + uint64_t ub_mmp_delay; + + /* + * The ub_mmp_config contains the multihost write interval, multihost + * fail intervals, sequence number for sub-second granularity, and + * valid bit mask. This layout is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | Fail Intervals| Seq | Write Interval (ms) | VALID | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * This allows a write_interval of (2^24/1000)s, over 4.5 hours + * + * VALID Bits: + * - 0x01 - Write Interval (ms) + * - 0x02 - Sequence number exists + * - 0x04 - Fail Intervals + * - 0xf8 - Reserved + */ + uint64_t ub_mmp_config; + + /* + * ub_checkpoint_txg indicates two things about the current uberblock: + * + * 1] If it is not zero then this uberblock is a checkpoint. If it is + * zero, then this uberblock is not a checkpoint. + * + * 2] On checkpointed uberblocks, the value of ub_checkpoint_txg is + * the ub_txg that the uberblock had at the time we moved it to + * the MOS config. + * + * The field is set when we checkpoint the uberblock and continues to + * hold that value even after we've rewound (unlike the ub_txg that + * is reset to a higher value). + * + * Besides checks used to determine whether we are reopening the + * pool from a checkpointed uberblock [see spa_ld_select_uberblock()], + * the value of the field is used to determine which ZIL blocks have + * been allocated according to the ms_sm when we are rewinding to a + * checkpoint. Specifically, if blk_birth > ub_checkpoint_txg, then + * the ZIL block is not allocated [see uses of spa_min_claim_txg()]. + */ + uint64_t ub_checkpoint_txg; +} uberblock_t; /* * Flags. From owner-svn-src-all@freebsd.org Sun Nov 3 21:32:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94C391A45FD for ; Sun, 3 Nov 2019 21:32:48 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztdg10022001.me.com (pv50p00im-ztdg10022001.me.com [17.58.6.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475q0H5yXPz4k5H for ; Sun, 3 Nov 2019 21:32:47 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztdg10022001.me.com (Postfix) with ESMTPSA id E9E58A04BE; Sun, 3 Nov 2019 21:32:43 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3594.4.19\)) Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs From: Toomas Soome In-Reply-To: Date: Sun, 3 Nov 2019 23:32:41 +0200 Cc: Andriy Gapon , Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> To: Kevin Bowling X-Mailer: Apple Mail (2.3594.4.19) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-03_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=879 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911030224 X-Rspamd-Queue-Id: 475q0H5yXPz4k5H X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[58.6.58.17.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[me.com]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-4.76), ipnet: 17.58.0.0/20(-2.49), asn: 714(-2.56), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:32:48 -0000 > On 3. Nov 2019, at 22:39, Kevin Bowling = wrote: >=20 > I believe this is/was a common configuration, at least the few > spinning disk based systems I have left have a slog. >=20 On boot pool? um. well, I=E2=80=99ll kick out that return then. rgds, toomas > On Sun, Nov 3, 2019 at 10:55 AM Andriy Gapon wrote: >>=20 >> On 03/11/2019 15:25, Toomas Soome wrote: >>> Author: tsoome >>> Date: Sun Nov 3 13:25:47 2019 >>> New Revision: 354283 >>> URL: https://svnweb.freebsd.org/changeset/base/354283 >>>=20 >>> Log: >>> loader: we do not support booting from pool with log device >>>=20 >>> If pool has log device, stop there and tell about it. >>=20 >> Why? >>=20 >>> Modified: >>> head/stand/libsa/zfs/zfs.c >>> head/stand/libsa/zfs/zfsimpl.c >>> head/sys/cddl/boot/zfs/zfsimpl.h >>=20 >>=20 >>=20 >> -- >> Andriy Gapon >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Sun Nov 3 21:36:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 693701A4CA4; Sun, 3 Nov 2019 21:36:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475q4Z24xSz4kf9; Sun, 3 Nov 2019 21:36:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C0491A0CE; Sun, 3 Nov 2019 21:36:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3LaUvo090048; Sun, 3 Nov 2019 21:36:30 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3LaUcq090047; Sun, 3 Nov 2019 21:36:30 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911032136.xA3LaUcq090047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 3 Nov 2019 21:36:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354324 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:36:30 -0000 Author: tsoome Date: Sun Nov 3 21:36:29 2019 New Revision: 354324 URL: https://svnweb.freebsd.org/changeset/base/354324 Log: loader: allow booting from pool with log device Apparently people are using log with boot pool, so we can not just error out there. Still we will need to investigate how to handle log properly. Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Sun Nov 3 21:19:52 2019 (r354323) +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 21:36:29 2019 (r354324) @@ -669,11 +669,14 @@ zfs_dev_open(struct open_file *f, ...) spa = spa_find_by_guid(dev->pool_guid); if (!spa) return (ENXIO); +#if 0 + /* Apparently too many are using slog with boot pool. */ if (spa->spa_with_log) { printf("Reading pool %s is not supported due to log device.\n", spa->spa_name); return (ENXIO); } +#endif mount = malloc(sizeof(*mount)); if (mount == NULL) rv = ENOMEM; From owner-svn-src-all@freebsd.org Sun Nov 3 21:56:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F89B1A696D; Sun, 3 Nov 2019 21:56:52 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475qX270Q6z4n8T; Sun, 3 Nov 2019 21:56:50 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f174.google.com with SMTP id g3so9360400ljl.11; Sun, 03 Nov 2019 13:56:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=X6EIcKYz2MbF9y+2pAywOP4PeJptNbgMjfGyUJFmxnE=; b=NF2JkBopsdKp1huusHnm/Ff4dk0fpFdyl+bdD9aIM7VHyFhlO8M8zOaTV7sEC04KeO SlZycDyL5NEntXmUlHLnDZJm265wBxiR+knG37s7L+EgLdPUNDF7Gbr5opZft/lL6/Ki dvEp/osxgDOeggs8IVUFcVZcAAm26NhQBqgdSBf4sl6+IxTwzr/mMsDD5/6yB+Q7AxI5 O4GV2MZ1mGPR2xpJTa5bpkNziJDzjfLfojzayf71zN5KowpZVTpgzc63KAhVyo6qFtfL rpw49QaydGCVNe7Aip6n5yQCSfzUjBzYcK3qmJj/MZPvZE0rbvlJX1LB4UrtcMb9tuyd Fkmg== X-Gm-Message-State: APjAAAUrWc1PTX2S7qvEu+y9iCpYzRyFM9IK9L+49JeoZR102dpfrbDw Gp8Q8wn7mb/PM1P78z7i1KEAMGnWcfw= X-Google-Smtp-Source: APXvYqzbOQZqgv/SvppeEnufsvgGUjfGM9jpgmswPvmJohenIlvNNVh86ZJOruO8uAzGFN7ryh1LxQ== X-Received: by 2002:a2e:7204:: with SMTP id n4mr8298399ljc.139.1572818208849; Sun, 03 Nov 2019 13:56:48 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id y6sm6352855lfj.75.2019.11.03.13.56.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Nov 2019 13:56:48 -0800 (PST) Subject: Re: svn commit: r354324 - head/stand/libsa/zfs To: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911032136.xA3LaUcq090047@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Sun, 3 Nov 2019 23:56:47 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201911032136.xA3LaUcq090047@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 475qX270Q6z4n8T X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.14 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.14)[ip: (-0.43), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.03), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[174.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[174.208.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:56:52 -0000 On 03/11/2019 23:36, Toomas Soome wrote: > Author: tsoome > Date: Sun Nov 3 21:36:29 2019 > New Revision: 354324 > URL: https://svnweb.freebsd.org/changeset/base/354324 > > Log: > loader: allow booting from pool with log device > > Apparently people are using log with boot pool, so we can not just > error out there. Still we will need to investigate how to handle > log properly. Toomas, I still don't understand your concern here. It's true that we do not support reading from a log device, but as far as I can recall, we do not attempt to read / apply ZIL in the boot code at all. So in my understanding, whether a pool has a log or device or not should be completely irrelevant. -- Andriy Gapon From owner-svn-src-all@freebsd.org Sun Nov 3 21:57:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6CEB1A6A6E for ; Sun, 3 Nov 2019 21:57:35 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475qXv0wWTz4nPd for ; Sun, 3 Nov 2019 21:57:34 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-io1-xd35.google.com with SMTP id k1so16335465iom.9 for ; Sun, 03 Nov 2019 13:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mRpy4P9QLGnNYC2lWVv8OUnizWNKAKUAgd2DK18Bs4Y=; b=cE+4ZBr1vhdLn37wIiBMMylBzl67RsgVZc3BNcqno9D50+QkGNlyAqSFceIhifu+p2 lCjbu7rRxFjC1kJ/oV5La2kuN5tVC4VUFasCRagCjoy3AHF4qrRTB3hpYnOrQ3H3PQaN B/HjkxtslJoGYacdGzEr4benaYLgx81L594QU= 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=mRpy4P9QLGnNYC2lWVv8OUnizWNKAKUAgd2DK18Bs4Y=; b=Ok6l8teRUxEcySL4I4tIERbsnKQR5sVgoltcQeKL3E7tuSWvl21C40P8YXRP9lDsWq lQmyQgpSGo112+QCt+Hj/PLTK2m1N1B7gHi0qxyqh+7g5EzDfTw2iphuVja61PrKiz25 qLSZg9YMM6FOgfjjUrHME6rAvGTxXcS87ZgznmbS7/Fr4tDp9b7Vu7iqCI5MmrVdHlFo WLb4uA8rSVGmRPZUUN6w8yF3oHs9LvcOgp+xVwp0sWDZJtJ1SHfBzTflP7WK8sqNSrha ALOhBMCUcys4A1I01PT58B8OyXX/3GmkUn6fPDGqKnpOIN7TTmIx396J0oGLcO6yEvmT 1KjQ== X-Gm-Message-State: APjAAAWwU7M6+839QpEQaOY4IoQ51PgfIMAf94sMqzc6UDQHtt/mfamh aogaKpPzHg5/5x1WO/Eh/ugCrtQ6aNSMx93Q109aa0YlHIg= X-Google-Smtp-Source: APXvYqwNijrL6D4XvOMBmNH62DFZYgN7SG5mSRb+sdA5xk4Rkt692aQMfDO4bXhqAK8bMLo5ki7iLUAKoiK63i2n6nc= X-Received: by 2002:a05:6602:198:: with SMTP id m24mr6967528ioo.238.1572818253402; Sun, 03 Nov 2019 13:57:33 -0800 (PST) MIME-Version: 1.0 References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> In-Reply-To: <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> From: Kevin Bowling Date: Sun, 3 Nov 2019 14:57:22 -0700 Message-ID: Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs To: Toomas Soome Cc: Andriy Gapon , Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 475qXv0wWTz4nPd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none (invalid DKIM record) header.d=kev009.com header.s=google header.b=cE+4ZBr1; dmarc=none; spf=pass (mx1.freebsd.org: domain of kevin.bowling@kev009.com designates 2607:f8b0:4864:20::d35 as permitted sender) smtp.mailfrom=kevin.bowling@kev009.com X-Spamd-Result: default: False [-4.40 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[kev009.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[kev009.com:~]; RCVD_IN_DNSWL_NONE(0.00)[5.3.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_DKIM_PERMFAIL(0.00)[kev009.com:s=google]; FREEMAIL_TO(0.00)[me.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.10)[ip: (-6.03), ipnet: 2607:f8b0::/32(-2.38), asn: 15169(-2.03), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 21:57:35 -0000 Yes, some systems with two disks in a mirror and an ssd as slog. What are you trying to guard against? I have never seen an issue but would like to be aware of potential problems with that system. On Sun, Nov 3, 2019 at 2:32 PM Toomas Soome wrote: > > > > On 3. Nov 2019, at 22:39, Kevin Bowling > wrote: > > > > I believe this is/was a common configuration, at least the few > > spinning disk based systems I have left have a slog. > > > > On boot pool? um. well, I=E2=80=99ll kick out that return then. > > rgds, > toomas > > > On Sun, Nov 3, 2019 at 10:55 AM Andriy Gapon wrote: > >> > >> On 03/11/2019 15:25, Toomas Soome wrote: > >>> Author: tsoome > >>> Date: Sun Nov 3 13:25:47 2019 > >>> New Revision: 354283 > >>> URL: https://svnweb.freebsd.org/changeset/base/354283 > >>> > >>> Log: > >>> loader: we do not support booting from pool with log device > >>> > >>> If pool has log device, stop there and tell about it. > >> > >> Why? > >> > >>> Modified: > >>> head/stand/libsa/zfs/zfs.c > >>> head/stand/libsa/zfs/zfsimpl.c > >>> head/sys/cddl/boot/zfs/zfsimpl.h > >> > >> > >> > >> -- > >> Andriy Gapon > >> _______________________________________________ > >> svn-src-head@freebsd.org mailing list > >> https://lists.freebsd.org/mailman/listinfo/svn-src-head > >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org= " > > From owner-svn-src-all@freebsd.org Sun Nov 3 22:02:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F5D61A77AB; Sun, 3 Nov 2019 22:02:30 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475qfZ0yXFz4pKV; Sun, 3 Nov 2019 22:02:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xA3M2MP3033742 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Nov 2019 00:02:25 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xA3M2MP3033742 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xA3M2Mjl033741; Mon, 4 Nov 2019 00:02:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Nov 2019 00:02:22 +0200 From: Konstantin Belousov To: Vladimir Kondratyev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354322 - head/sys/dev/ichiic Message-ID: <20191103220222.GX73312@kib.kiev.ua> References: <201911032117.xA3LHpKK078186@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911032117.xA3LHpKK078186@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 475qfZ0yXFz4pKV X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:02:30 -0000 On Sun, Nov 03, 2019 at 09:17:51PM +0000, Vladimir Kondratyev wrote: > Author: wulf > Date: Sun Nov 3 21:17:50 2019 > New Revision: 354322 > URL: https://svnweb.freebsd.org/changeset/base/354322 > > Log: > [ig4] Convert ithread interrupt handler to filter based one. And why ? You need some reason to use filters/spinlocks, otherwise it only taxes system latency. From owner-svn-src-all@freebsd.org Sun Nov 3 22:17:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F06D1A965D; Sun, 3 Nov 2019 22:17:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475r0G25GMz4r7X; Sun, 3 Nov 2019 22:17:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26D3B1A818; Sun, 3 Nov 2019 22:17:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA3MHo4U019965; Sun, 3 Nov 2019 22:17:50 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA3MHnro019964; Sun, 3 Nov 2019 22:17:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911032217.xA3MHnro019964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 3 Nov 2019 22:17:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354325 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:17:50 -0000 Author: andrew Date: Sun Nov 3 22:17:49 2019 New Revision: 354325 URL: https://svnweb.freebsd.org/changeset/base/354325 Log: Move the struct debug_monitor_state out of _KERNEL. Some userland libraries incude machine/pcb.h and this needs the full definition of struct debug_monitor_state. To allow this to work move stuct debug_monitor_state out of the _KERNEL guard. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/debug_monitor.h Modified: head/sys/arm64/include/debug_monitor.h ============================================================================== --- head/sys/arm64/include/debug_monitor.h Sun Nov 3 21:36:29 2019 (r354324) +++ head/sys/arm64/include/debug_monitor.h Sun Nov 3 22:17:49 2019 (r354325) @@ -32,8 +32,6 @@ #ifndef _MACHINE_DEBUG_MONITOR_H_ #define _MACHINE_DEBUG_MONITOR_H_ -#ifdef _KERNEL - #define DBG_BRP_MAX 16 #define DBG_WRP_MAX 16 @@ -47,6 +45,8 @@ struct debug_monitor_state { uint64_t dbg_wcr[DBG_WRP_MAX]; uint64_t dbg_wvr[DBG_WRP_MAX]; }; + +#ifdef _KERNEL enum dbg_access_t { HW_BREAKPOINT_X = 0, From owner-svn-src-all@freebsd.org Sun Nov 3 22:46:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B9841AA630; Sun, 3 Nov 2019 22:46:47 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 475rdd00cCz4syM; Sun, 3 Nov 2019 22:46:44 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id 936256E499; Mon, 4 Nov 2019 01:46:37 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id h0YruLfpf1xF; Mon, 4 Nov 2019 01:46:37 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 068CC6E492; Mon, 4 Nov 2019 01:46:37 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id B915B422123; Mon, 4 Nov 2019 01:46:36 +0300 (MSK) X-Virus-Scanned: amavisd-new at cicgroup.ru Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id OACSyxQR3AJe; Mon, 4 Nov 2019 01:46:34 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id DA37B422122; Mon, 4 Nov 2019 01:46:33 +0300 (MSK) Subject: Re: svn commit: r354322 - head/sys/dev/ichiic To: Konstantin Belousov , Vladimir Kondratyev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911032117.xA3LHpKK078186@repo.freebsd.org> <20191103220222.GX73312@kib.kiev.ua> From: Vladimir Kondratyev Autocrypt: addr=vladimir@kondratyev.su; prefer-encrypt=mutual; keydata= mQENBFkI9Y8BCAC44UZYE8ZswFr/LHNHutuCmrbfP0j6jYl6zkW9VeM3cXVDjDsL3h9JhEFH zF9Or0muwHjspNuVdP2ot9vH8FCGAGEYS/GrzEEKxj4yoxAZxWnGUwzFiaf8fCtlrq5D9vOd /HSm6tb5YbcC/t/46hSwyPZ4i07rtsxmeozrKNx9H2gkcY0/AfmZ+UxY90/cj/F3aNk4wYLH gC95N99jaZvwPFX8wW5k++YaThXo8TNGQaxmC28cFFPdc1qICYdzYxS7kbTlGKp37lWmV9Z6 FursbfIkJZ7Rzw7NjGGijj4XjKif91ZwQNz/BfO58xrookQCibVCJ3JKcZo4NZ7rWTWlABEB AAG0LFZsYWRpbWlyIEtvbmRyYXR5ZXYgPHZsYWRpbWlyQGtvbmRyYXR5ZXYuc3U+iQFUBBMB CgA+FiEEkwnJqomIwH/siVElg2u+IHApX3UFAlkJEuQCGwMFCQWjmoAFCwkIBwMFFQoJCAsF FgMCAQACHgECF4AACgkQg2u+IHApX3Wsmwf/bSUJeS0KXHQHH/XZwaqi0CfWxifrWfC+K62O DVA5TZZfZTs8h4Pov2DBvgx/DaQIVXeZazDPZho4v5SCrSulv//gboO6iN/7ZVnSRwQfyOp+ xnXLOzjC4mv4GjYc5sILJWQbWF4UPBGrBiFjtWrYjrRwVE6o/ThEXP92uu7suS2+U+f0zBh+ NZpJdf1T6EUN/dn8QLCyASNW1uYXzQ//5kTFc3ECC0VXzTnCZ7WWzkEOMbaVOwR25K5hCrg/ e41zrGlq8xLQhnXje+ZvG5DZkWKiZ0hUrB7nA8RLOVN6I1rzqStQjYxQuQqGu0Om/Bv6Rp+t AwEaLQdYOdXEyMZRe7kBDQRZCPWPAQgAt5NVWoIBXPqs/lo3w3JxUZ2f2R1bTqdWNBHlKI1Y r6WDHSMWT9WM/vycZSG5N6a051ZGhyPS6LNoxxqokYwgLr9VMsBTS7pA8Nx8hzyjIAAYCQqX 2tluX2FzvcJUaEZDo3pt93IpHzvf924A1nvxP4n9NyfTu4GBZ+07sBJEploKugmAVIzXD1m6 zr1xeo6LF5Adz1b0WP2cU88gv66FiuZp9Cj6DTGdIta6hQqAtrBxINVd5XR99eXrZ0+YSiIi 7ywa3dDti8NXwkZkn4pGPDkCjb34PL1kdoD/yOCpp9yAdflF8T8KObjWuivnAMOYfmGGN30n nhh8Ub9n2DVw7wARAQABiQE8BBgBCgAmFiEEkwnJqomIwH/siVElg2u+IHApX3UFAlkI9Y8C GwwFCQWjmoAACgkQg2u+IHApX3XzJggAs8Hiu/YeLfmZYp/57eaK/BrtW5TeLrKd5x4knFkY dxWOJ7ZJIIr7fhUH9OZKyAMYPzJaWuxhAuDIZiH39MZFnAhx6LnycCIQMY6CP4gJ8Y2ssvf7 eNcFRqL1xvEmAELMC5HtpnLp914xlYkBoqcU2rH7X0Qza4GvafQHHVrjc+DqqKbF6YjPsEew Fp4mqvvIxi71UiWy95q0x8tC3Cbm5hUCl2i5nl0iaWNNMkuh6is+jLJZ9W5CfEPcp+W2Vekd UTm4zN0+uaR7br3Lr3GbBJPlLHrH1haK6nJmyfVzf1MbK8wqIHiH1wWmIxC96QHKCEzRDjdf IVYGqb/YykLjBw== Message-ID: Date: Mon, 4 Nov 2019 01:46:14 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191103220222.GX73312@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 475rdd00cCz4syM X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of vladimir@kondratyev.su has no SPF policy when checking 195.170.219.3) smtp.mailfrom=vladimir@kondratyev.su X-Spamd-Result: default: False [0.51 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.69)[-0.686,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[kondratyev.su]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.19)[0.191,0]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8299, ipnet:195.170.192.0/19, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[country: RU(0.01)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:46:47 -0000 On 04.11.2019 01:02, Konstantin Belousov wrote: > On Sun, Nov 03, 2019 at 09:17:51PM +0000, Vladimir Kondratyev wrote: >> Author: wulf >> Date: Sun Nov 3 21:17:50 2019 >> New Revision: 354322 >> URL: https://svnweb.freebsd.org/changeset/base/354322 >> >> Log: >> [ig4] Convert ithread interrupt handler to filter based one. > And why ? > > You need some reason to use filters/spinlocks, otherwise it only > taxes system latency. The only thing ig4 interrupt handler does is a waking up the user thread, so postponing it to ithread looks like a wasting of CPU cycles. Spinlock here is acting as condition variable not as a data protection lock. It is taken around msleep(). I can replace it with cv_* calls if current usage confuses someone Ig4 access is serialized with sx lock so it is impossible to get any congestion on spinlock From owner-svn-src-all@freebsd.org Sun Nov 3 22:48:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FDEC1AA677 for ; Sun, 3 Nov 2019 22:48:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475rg46S53z4t6h for ; Sun, 3 Nov 2019 22:48:00 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572821279; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=kiPpHX5no+Ne1u1b4u88fzRluOErREfPq1hEEiDoRIYMIMyUh4pPoBEAJguWcb6fgLHXsPvLNt1Ov 5b29LipZ1qEIGZ5TSl7mapgiZDiBje/lM5Wggc3lZTJJMTXnuqOm2q+CwNWgC/2ZKrnSIY8SrJqjNm EqEJkZW4Dh3bV8wBwMttcqJ5NAZGB1jgBtZNTSATJ+ATmxBiMkizqpfxhry1cL886o0C60t2/uhyW+ AxWoYHQUeP9TGmgVRdY729cM1dShgB1iIxx8YEKWVIUx06olWH5+bPYhZmTDEte5T1gL8ozrOV35uw qEm9Bq9JFn+Zpsxs2ttrkJBis00e5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=wYH1OUZ4LmWdsJoZ82b4+pyeA6hILXZNYw/hfWN+Gvk=; b=PCNPjBvgZVGIQt2vDJ2nhZhxD0m1mgtVLiiOHrxZb0u/SjTCrdHC5frcgNSevlVDx0Mt3+YzclYPJ gwj7Z848C2GOvv8d58rygdaJe8qoJuIofTcJHHgOP2wg/4BeQ72wol3CqHE0/69W/2vUZXkJx/F7EX Ia56f4Mso6qf3jUHIG4FFA3+KFig+tHmLbf/g5XcWOS/s5LnybCWNmJa9eV9r0g2FsGLr8m2E08xxp QkMH9vGWvci/Z5zAeXHPAL60pOH18VSxN8iaib5ZmCITk6MRqL+jRPkHqtC/omo4Mnf8GInN0k3xfa vgdvsd3KdYTdQ3myBpCMViO+jR8whIQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=wYH1OUZ4LmWdsJoZ82b4+pyeA6hILXZNYw/hfWN+Gvk=; b=sE9fklTfrF8j+HKAs92KUC4Sn5/Af8dWJpC36rLOEx1+MaaxN12WutluqhnZ6EaVQwUQHww+g8toF LqYSpyh06CRETXkgchRsaOajqmlnkCSmAGq3kDv59vjkMJQVJZbtXHgk3UTv6UNDoIZyLvyL5zMnVL xq6ufiR6aLKR+CUQkj+cqi0owNAFNOFpl6sQ21ZEG5rUfZiSu4NU+SVhGQRJWGEqakaC2dwyTp0OxZ AMR50RLfJyQeq5sP71g/5vrDj6tuN4MFHwc+aWGG9UWB5KI6eoq8Lj2ruxW0+0RCy/Sy1eDgCnDx5l PHq4qsIDBjvnEZ2dtggUN978L3FZ/tw== X-MHO-RoutePath: aGlwcGll X-MHO-User: fa5cfedc-fe8b-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id fa5cfedc-fe8b-11e9-b80b-052b4a66b6b2; Sun, 03 Nov 2019 22:47:58 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xA3MluBA085719; Sun, 3 Nov 2019 15:47:56 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r354322 - head/sys/dev/ichiic From: Ian Lepore To: Vladimir Kondratyev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 03 Nov 2019 15:47:56 -0700 In-Reply-To: <201911032117.xA3LHpKK078186@repo.freebsd.org> References: <201911032117.xA3LHpKK078186@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 475rg46S53z4t6h X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:48:01 -0000 On Sun, 2019-11-03 at 21:17 +0000, Vladimir Kondratyev wrote: > Author: wulf > Date: Sun Nov 3 21:17:50 2019 > New Revision: 354322 > URL: https://svnweb.freebsd.org/changeset/base/354322 > > Log: > [ig4] Convert ithread interrupt handler to filter based one. > This doesn't seem like a very good idea. I2c comms is way too slow to benefit from handling the interrupt in the primary interrupt context. All it will accomplish is to make other (perhaps more time-critical) interrupts wait for service while this handler runs (although, admittedly, this handler doesn't do much more than a couple register accesses and a wakeup()). -- Ian > Modified: > head/sys/dev/ichiic/ig4_iic.c > > Modified: head/sys/dev/ichiic/ig4_iic.c > ===================================================================== > ========= > --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:01 2019 (r354 > 321) > +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:50 2019 (r354 > 322) > @@ -122,7 +122,7 @@ static const struct ig4_hw ig4iic_hw[] = { > }; > > static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); > -static void ig4iic_intr(void *cookie); > +static driver_filter_t ig4iic_intr; > static void ig4iic_dump(ig4iic_softc_t *sc); > > static int ig4_dump; > @@ -297,12 +297,12 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) > * When polling is not requested let the interrupt do > its work. > */ > if (!DO_POLL(sc)) { > - mtx_lock(&sc->io_lock); > + mtx_lock_spin(&sc->io_lock); > set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); > - mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", > + msleep_spin(sc, &sc->io_lock, "i2cwait", > (hz + 99) / 100); /* sleep up to 10ms > */ > set_intr_mask(sc, 0); > - mtx_unlock(&sc->io_lock); > + mtx_unlock_spin(&sc->io_lock); > count_us += 10000; > } else { > DELAY(25); > @@ -1010,7 +1010,7 @@ ig4iic_attach(ig4iic_softc_t *sc) > { > int error; > > - mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); > + mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_SPIN); > sx_init(&sc->call_lock, "IG4 call lock"); > > ig4iic_get_config(sc); > @@ -1037,7 +1037,7 @@ ig4iic_attach(ig4iic_softc_t *sc) > goto done; > } > error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | > INTR_MPSAFE, > - NULL, ig4iic_intr, sc, &sc- > >intr_handle); > + ig4iic_intr, NULL, sc, &sc- > >intr_handle); > if (error) { > device_printf(sc->dev, > "Unable to setup irq: error %d\n", > error); > @@ -1127,19 +1127,23 @@ int ig4iic_resume(ig4iic_softc_t *sc) > /* > * Interrupt Operation, see ig4_var.h for locking semantics. > */ > -static void > +static int > ig4iic_intr(void *cookie) > { > ig4iic_softc_t *sc = cookie; > + int retval = FILTER_STRAY; > > - mtx_lock(&sc->io_lock); > + mtx_lock_spin(&sc->io_lock); > /* Ignore stray interrupts */ > if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) > { > /* Interrupt bits are cleared in wait_intr() loop */ > set_intr_mask(sc, 0); > wakeup(sc); > + retval = FILTER_HANDLED; > } > - mtx_unlock(&sc->io_lock); > + mtx_unlock_spin(&sc->io_lock); > + > + return (retval); > } > > #define REGDUMP(sc, reg) \ From owner-svn-src-all@freebsd.org Sun Nov 3 22:59:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FFE51AAB9E; Sun, 3 Nov 2019 22:59:29 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475rwJ3zT4z4v8X; Sun, 3 Nov 2019 22:59:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xA3MxLvH046748 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Nov 2019 00:59:24 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xA3MxLvH046748 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xA3MxLle046747; Mon, 4 Nov 2019 00:59:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Nov 2019 00:59:21 +0200 From: Konstantin Belousov To: Vladimir Kondratyev Cc: Vladimir Kondratyev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354322 - head/sys/dev/ichiic Message-ID: <20191103225921.GZ73312@kib.kiev.ua> References: <201911032117.xA3LHpKK078186@repo.freebsd.org> <20191103220222.GX73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 475rwJ3zT4z4v8X X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.64), ipnet: 2001:470::/32(-4.61), asn: 6939(-3.47), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:59:29 -0000 On Mon, Nov 04, 2019 at 01:46:14AM +0300, Vladimir Kondratyev wrote: > On 04.11.2019 01:02, Konstantin Belousov wrote: > > On Sun, Nov 03, 2019 at 09:17:51PM +0000, Vladimir Kondratyev wrote: > >> Author: wulf > >> Date: Sun Nov 3 21:17:50 2019 > >> New Revision: 354322 > >> URL: https://svnweb.freebsd.org/changeset/base/354322 > >> > >> Log: > >> [ig4] Convert ithread interrupt handler to filter based one. > > And why ? > > > > You need some reason to use filters/spinlocks, otherwise it only > > taxes system latency. > > > The only thing ig4 interrupt handler does is a waking up the user > thread, so postponing it to ithread looks like a wasting of CPU cycles. > > Spinlock here is acting as condition variable not as a data protection > lock. It is taken around msleep(). I can replace it with cv_* calls if > current usage confuses someone > > Ig4 access is serialized with sx lock so it is impossible to get any > congestion on spinlock > You need to lock the same spinlock in the sleeping thread and in the interrupt context. I do not remember why these drivers ended up using sx for their main data synchronization, I suspect it was due to copyouts. From owner-svn-src-all@freebsd.org Sun Nov 3 22:59:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60D0E1AAC15 for ; Sun, 3 Nov 2019 22:59:59 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475rwt2ywtz4vHN for ; Sun, 3 Nov 2019 22:59:58 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: by mail-il1-x133.google.com with SMTP id j2so11049199ilc.10 for ; Sun, 03 Nov 2019 14:59:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8UG2nfnZ87FGKXSEfDE4GMCXPkCUGRy9EvCf42Q3MAg=; b=JHcVvw+u2gcu7+/UwPP1Q4TmPUoNX843/MhsWwjHfj2lNWgUnNWBJo0Ki9pbhmeR8A jD3WRwiAQ9oaON9/y7Ch9VzVKFcgQ7yMFqlhJh5OFnDDD4CzS1voGbXJuSa37+zNuxfM 9JNuZLvkAhrQPJ43nltuWxYJG9p+ih+eEBCT0CYzONfHeaBLw65Lb+d9nfY4xP7u86C2 fR4I8siVFollNBTVPy9RjO6dmFC+cm78EyGAxOHptEP8bVsopYqDsOXLNIsFO9UpzUsp ku3TjMLnW9Xg8ngopSuHuWIccbbxULYW8qagh/6lE25cApOx0YtDRLWtdDvKKT9vQJDS 3vKg== 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=8UG2nfnZ87FGKXSEfDE4GMCXPkCUGRy9EvCf42Q3MAg=; b=ldvcOONjQdKIw8RYF4So46xOlHvStGs8UMuMb7FilBZlYZwNY0Dc8claat2oXtTmJ0 q/h/Q6jrCEDdcOJS/N7Y38csTadJh0dZ6PokUgv/VmRW5SyhYpOkG2Twaqnl4mag5sf1 tEp4cKI0FoV2TJbAjMWEhypRlGBX+VIO5L65MzRtRLlNSH+h6A3IGddKKYPoYpu3kBsN C2PAZbbSSBlx5TBMCy+GGKw5kDepIv9RvVmt3Wz82McgyjU34QDjXBrPq2IZ2wybqgqU jTAXcYtsCUAcT8UXCryoKctdpdlBtXi7pNZZQAmfBJ3fMviHiv9Y3+tFD8JcfPSOEv6/ igMA== X-Gm-Message-State: APjAAAWmUAvIytqgLQDjxhDEcypv9VGr3hZkwDe3NLS3URPuWESrAawV C/YkF8N1OY8GjS25LqjUGHkT265s/GV9GTjfPsMbyg== X-Google-Smtp-Source: APXvYqyBEzTTrRcPjqpSUg0PpMiCGR4Vg8qjjFs5EJv8NXqUMCd7YLivcis5fQDb3U4e+iaPIBFDc7K0At+YrxpRnHk= X-Received: by 2002:a92:5c5d:: with SMTP id q90mr26480746ilb.22.1572821997071; Sun, 03 Nov 2019 14:59:57 -0800 (PST) MIME-Version: 1.0 References: <201911031325.xA3DPl3B080386@repo.freebsd.org> In-Reply-To: <201911031325.xA3DPl3B080386@repo.freebsd.org> From: Steven Hartland Date: Sun, 3 Nov 2019 22:59:46 +0000 Message-ID: Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs To: Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 475rwt2ywtz4vHN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=multiplay-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=JHcVvw+u; dmarc=pass (policy=none) header.from=multiplay.co.uk; spf=pass (mx1.freebsd.org: domain of steven@multiplay.co.uk designates 2607:f8b0:4864:20::133 as permitted sender) smtp.mailfrom=steven@multiplay.co.uk X-Spamd-Result: default: False [-4.23 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[multiplay-co-uk.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[multiplay-co-uk.20150623.gappssmtp.com:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_IN_DNSWL_NONE(0.00)[3.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[multiplay.co.uk,none]; FORGED_SENDER(0.30)[steven.hartland@multiplay.co.uk,steven@multiplay.co.uk]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.63)[ip: (-8.71), ipnet: 2607:f8b0::/32(-2.38), asn: 15169(-2.03), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[steven.hartland@multiplay.co.uk,steven@multiplay.co.uk]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 22:59:59 -0000 Pretty sure we had at least two systems using root with log just fine, so would be interested to know why this isn=E2=80=99t supported anymore? On Sun, 3 Nov 2019 at 13:26, Toomas Soome wrote: > Author: tsoome > Date: Sun Nov 3 13:25:47 2019 > New Revision: 354283 > URL: https://svnweb.freebsd.org/changeset/base/354283 > > Log: > loader: we do not support booting from pool with log device > > If pool has log device, stop there and tell about it. > > Modified: > head/stand/libsa/zfs/zfs.c > head/stand/libsa/zfs/zfsimpl.c > head/sys/cddl/boot/zfs/zfsimpl.h > > Modified: head/stand/libsa/zfs/zfs.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/stand/libsa/zfs/zfs.c Sun Nov 3 13:03:47 2019 (r354282) > +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 13:25:47 2019 (r354283) > @@ -668,6 +668,11 @@ zfs_dev_open(struct open_file *f, ...) > spa =3D spa_find_by_guid(dev->pool_guid); > if (!spa) > return (ENXIO); > + if (spa->spa_with_log) { > + printf("Reading pool %s is not supported due to log > device.\n", > + spa->spa_name); > + return (ENXIO); > + } > mount =3D malloc(sizeof(*mount)); > if (mount =3D=3D NULL) > return (ENOMEM); > > Modified: head/stand/libsa/zfs/zfsimpl.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:03:47 2019 > (r354282) > +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:25:47 2019 > (r354283) > @@ -1109,6 +1109,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, > vde > const unsigned char *kids; > int nkids, i, is_new; > uint64_t is_offline, is_faulted, is_degraded, is_removed, > isnt_present; > + uint64_t is_log; > > if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, > NULL, &guid) > @@ -1132,17 +1133,20 @@ vdev_init_from_nvlist(const unsigned char *nvlist= , > vde > } > > is_offline =3D is_removed =3D is_faulted =3D is_degraded =3D isnt= _present > =3D 0; > + is_log =3D 0; > > nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, NULL, > - &is_offline); > + &is_offline); > nvlist_find(nvlist, ZPOOL_CONFIG_REMOVED, DATA_TYPE_UINT64, NULL, > - &is_removed); > + &is_removed); > nvlist_find(nvlist, ZPOOL_CONFIG_FAULTED, DATA_TYPE_UINT64, NULL, > - &is_faulted); > + &is_faulted); > nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, NULL= , > - &is_degraded); > + &is_degraded); > nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, > NULL, > - &isnt_present); > + &isnt_present); > + nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, NULL, > + &is_log); > > vdev =3D vdev_find(guid); > if (!vdev) { > @@ -1217,6 +1221,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, > vde > return (ENOMEM); > vdev->v_name =3D name; > } > + vdev->v_islog =3D is_log =3D=3D 1; > } else { > is_new =3D 0; > } > @@ -1433,6 +1438,12 @@ vdev_status(vdev_t *vdev, int indent) > { > vdev_t *kid; > int ret; > + > + if (vdev->v_islog) { > + (void)pager_output(" logs\n"); > + indent++; > + } > + > ret =3D print_state(indent, vdev->v_name, vdev->v_state); > if (ret !=3D 0) > return (ret); > @@ -1737,6 +1748,12 @@ vdev_probe(vdev_phys_read_t *_read, void > *read_priv, s > printf("ZFS: inconsistent nvlist contents\n"); > return (EIO); > } > + > + /* > + * We do not support reading pools with log device. > + */ > + if (vdev->v_islog) > + spa->spa_with_log =3D vdev->v_islog; > > /* > * Re-evaluate top-level vdev state. > > Modified: head/sys/cddl/boot/zfs/zfsimpl.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:03:47 2019 > (r354282) > +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:25:47 2019 > (r354283) > @@ -1670,6 +1670,7 @@ typedef struct vdev { > vdev_phys_read_t *v_phys_read; /* read from raw leaf vdev */ > vdev_read_t *v_read; /* read from vdev */ > void *v_read_priv; /* private data for read function > */ > + boolean_t v_islog; > struct spa *spa; /* link to spa */ > /* > * Values stored in the config for an indirect or removing vdev. > @@ -1694,6 +1695,7 @@ typedef struct spa { > zio_cksum_salt_t spa_cksum_salt; /* secret salt for cksum = */ > void *spa_cksum_tmpls[ZIO_CHECKSUM_FUNCTIONS]; > int spa_inited; /* initialized */ > + boolean_t spa_with_log; /* this pool has log */ > } spa_t; > > /* IO related arguments. */ > From owner-svn-src-all@freebsd.org Sun Nov 3 23:31:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68FC61AB927; Sun, 3 Nov 2019 23:31:00 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475sch2Cmdz3CSp; Sun, 3 Nov 2019 23:31:00 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (unknown [IPv6:2601:641:300:6e9f:7139:e5f8:3da1:d5af]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 6C67D16D25; Sun, 3 Nov 2019 23:30:59 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1e.0.191013 Date: Sun, 03 Nov 2019 15:30:55 -0800 Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs From: Ravi Pokala To: Toomas Soome , , , Message-ID: Thread-Topic: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs References: <201911031325.xA3DPl3B080386@repo.freebsd.org> In-Reply-To: <201911031325.xA3DPl3B080386@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 23:31:00 -0000 Uh.... I've had a log device in my boot-pool for months, and have booted without i= ssue: [threepio:~] rpokala% zpool status zroot pool: zroot state: ONLINE scan: scrub repaired 0 in 0 days 00:04:36 with 0 errors on Mon Oct 28= 03:10:59 2019 config: NAME STATE READ WRITE CKSUM zroot ONLINE 0 0 0 nvd1p4 ONLINE 0 0 0 logs nvd0p1 ONLINE 0 0 0 errors: No known data errors -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Toomas Soome Date: 2019-11-03, Sunday at 05:25 To: , , Subject: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs Author: tsoome Date: Sun Nov 3 13:25:47 2019 New Revision: 354283 URL: https://svnweb.freebsd.org/changeset/base/354283 =20 Log: loader: we do not support booting from pool with log device =20 If pool has log device, stop there and tell about it. =20 Modified: head/stand/libsa/zfs/zfs.c head/stand/libsa/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h =20 Modified: head/stand/libsa/zfs/zfs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/stand/libsa/zfs/zfs.c Sun Nov 3 13:03:47 2019 (r354282) +++ head/stand/libsa/zfs/zfs.c Sun Nov 3 13:25:47 2019 (r354283) @@ -668,6 +668,11 @@ zfs_dev_open(struct open_file *f, ...) spa =3D spa_find_by_guid(dev->pool_guid); if (!spa) return (ENXIO); + if (spa->spa_with_log) { + printf("Reading pool %s is not supported due to log device.\n", + spa->spa_name); + return (ENXIO); + } mount =3D malloc(sizeof(*mount)); if (mount =3D=3D NULL) return (ENOMEM); =20 Modified: head/stand/libsa/zfs/zfsimpl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:03:47 2019 (r354282) +++ head/stand/libsa/zfs/zfsimpl.c Sun Nov 3 13:25:47 2019 (r354283) @@ -1109,6 +1109,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist= , vde const unsigned char *kids; int nkids, i, is_new; uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_presen= t; + uint64_t is_log; =20 if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, NULL, &guid) @@ -1132,17 +1133,20 @@ vdev_init_from_nvlist(const unsigned char *nvli= st, vde } =20 is_offline =3D is_removed =3D is_faulted =3D is_degraded =3D isnt_present =3D 0= ; + is_log =3D 0; =20 nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, NULL, - &is_offline); + &is_offline); nvlist_find(nvlist, ZPOOL_CONFIG_REMOVED, DATA_TYPE_UINT64, NULL, - &is_removed); + &is_removed); nvlist_find(nvlist, ZPOOL_CONFIG_FAULTED, DATA_TYPE_UINT64, NULL, - &is_faulted); + &is_faulted); nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, NULL, - &is_degraded); + &is_degraded); nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, NULL, - &isnt_present); + &isnt_present); + nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, NULL, + &is_log); =20 vdev =3D vdev_find(guid); if (!vdev) { @@ -1217,6 +1221,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist= , vde return (ENOMEM); vdev->v_name =3D name; } + vdev->v_islog =3D is_log =3D=3D 1; } else { is_new =3D 0; } @@ -1433,6 +1438,12 @@ vdev_status(vdev_t *vdev, int indent) { vdev_t *kid; int ret; + + if (vdev->v_islog) { + (void)pager_output(" logs\n"); + indent++; + } + ret =3D print_state(indent, vdev->v_name, vdev->v_state); if (ret !=3D 0) return (ret); @@ -1737,6 +1748,12 @@ vdev_probe(vdev_phys_read_t *_read, void *read_p= riv, s printf("ZFS: inconsistent nvlist contents\n"); return (EIO); } + + /* + * We do not support reading pools with log device. + */ + if (vdev->v_islog) + spa->spa_with_log =3D vdev->v_islog; =20 /* * Re-evaluate top-level vdev state. =20 Modified: head/sys/cddl/boot/zfs/zfsimpl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:03:47 2019 (r354282) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sun Nov 3 13:25:47 2019 (r354283) @@ -1670,6 +1670,7 @@ typedef struct vdev { vdev_phys_read_t *v_phys_read; /* read from raw leaf vdev */ vdev_read_t *v_read; /* read from vdev */ void *v_read_priv; /* private data for read function */ + boolean_t v_islog; struct spa *spa; /* link to spa */ /* * Values stored in the config for an indirect or removing vdev. @@ -1694,6 +1695,7 @@ typedef struct spa { zio_cksum_salt_t spa_cksum_salt; /* secret salt for cksum */ void *spa_cksum_tmpls[ZIO_CHECKSUM_FUNCTIONS]; int spa_inited; /* initialized */ + boolean_t spa_with_log; /* this pool has log */ } spa_t; =20 /* IO related arguments. */ =20 From owner-svn-src-all@freebsd.org Mon Nov 4 00:35:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DD481AD819; Mon, 4 Nov 2019 00:35:41 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475v3K3GBzz3GcN; Mon, 4 Nov 2019 00:35:41 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C4011C114; Mon, 4 Nov 2019 00:35:41 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA40Zfxd003049; Mon, 4 Nov 2019 00:35:41 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA40ZfRX003048; Mon, 4 Nov 2019 00:35:41 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911040035.xA40ZfRX003048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 4 Nov 2019 00:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354326 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 00:35:41 -0000 Author: jhibbits Date: Mon Nov 4 00:35:40 2019 New Revision: 354326 URL: https://svnweb.freebsd.org/changeset/base/354326 Log: powerpc/pmap: Make use of tlb1_mapin_region in pmap_mapdev_attr() tlb1_mapin_region() and pmap_mapdev_attr() do roughly the same thing -- map a chunk of physical address space(memory or MMIO) into virtual, but do it in differing ways. Unify the code, settling on pmap_mapdev_attr()'s algorithm, to simplify and unify the logic. This fixes a bug with growing the kernel mappings in mmu_booke_bootstrap(), where part of the mapping was not getting done, leading to a hang when the unmapped VAs were accessed. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sun Nov 3 22:17:49 2019 (r354325) +++ head/sys/powerpc/booke/pmap.c Mon Nov 4 00:35:40 2019 (r354326) @@ -237,11 +237,11 @@ static void tlb_print_entry(int, uint32_t, uint32_t, u static void tlb1_read_entry(tlb_entry_t *, unsigned int); static void tlb1_write_entry(tlb_entry_t *, unsigned int); static int tlb1_iomapped(int, vm_paddr_t, vm_size_t, vm_offset_t *); -static vm_size_t tlb1_mapin_region(vm_offset_t, vm_paddr_t, vm_size_t); +static vm_size_t tlb1_mapin_region(vm_offset_t, vm_paddr_t, vm_size_t, int); static vm_size_t tsize2size(unsigned int); static unsigned int size2tsize(vm_size_t); -static unsigned int ilog2(unsigned long); +static unsigned long ilog2(unsigned long); static void set_mas4_defaults(void); @@ -1619,10 +1619,16 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o debugf(" kernel pdir at 0x%"PRI0ptrX" end = 0x%"PRI0ptrX"\n", kernel_pdir, data_end); + /* Pre-round up to 1MB. This wastes some space, but saves TLB entries */ + data_end = roundup2(data_end, 1 << 20); debugf(" data_end: 0x%"PRI0ptrX"\n", data_end); + debugf(" kernstart: %p\n", kernstart); + debugf(" kernsize: %lx\n", kernsize); + if (data_end - kernstart > kernsize) { kernsize += tlb1_mapin_region(kernstart + kernsize, - kernload + kernsize, (data_end - kernstart) - kernsize); + kernload + kernsize, (data_end - kernstart) - kernsize, + _TLB_ENTRY_MEM); } data_end = kernstart + kernsize; debugf(" updated data_end: 0x%"PRI0ptrX"\n", data_end); @@ -1819,7 +1825,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o * Round so it fits into a single mapping. */ tlb1_mapin_region(DMAP_BASE_ADDRESS, 0, - phys_avail[i + 1]); + phys_avail[i + 1], _TLB_ENTRY_MEM); #endif /*******************************************************/ @@ -3500,30 +3506,8 @@ mmu_booke_mapdev_attr(mmu_t mmu, vm_paddr_t pa, vm_siz #endif res = (void *)va; - do { - sz = 1 << (ilog2(size) & ~1); - /* Align size to PA */ - if (pa % sz != 0) { - do { - sz >>= 2; - } while (pa % sz != 0); - } - /* Now align from there to VA */ - if (va % sz != 0) { - do { - sz >>= 2; - } while (va % sz != 0); - } - if (bootverbose) - printf("Wiring VA=%p to PA=%jx (size=%lx)\n", - (void *)va, (uintmax_t)pa, (long)sz); - if (tlb1_set_entry(va, pa, sz, - _TLB_ENTRY_SHARED | tlb_calc_wimg(pa, ma)) < 0) - return (NULL); - size -= sz; - pa += sz; - va += sz; - } while (size > 0); + if (tlb1_mapin_region(va, pa, size, tlb_calc_wimg(pa, ma)) != size) + return (NULL); return (res); } @@ -3864,7 +3848,7 @@ tlb1_write_entry(tlb_entry_t *e, unsigned int idx) /* * Return the largest uint value log such that 2^log <= num. */ -static unsigned int +static unsigned long ilog2(unsigned long num) { long lz; @@ -3952,69 +3936,49 @@ tlb1_set_entry(vm_offset_t va, vm_paddr_t pa, vm_size_ } /* - * Map in contiguous RAM region into the TLB1 using maximum of - * KERNEL_REGION_MAX_TLB_ENTRIES entries. - * - * If necessary round up last entry size and return total size - * used by all allocated entries. + * Map in contiguous RAM region into the TLB1. */ -vm_size_t -tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_size_t size) +static vm_size_t +tlb1_mapin_region(vm_offset_t va, vm_paddr_t pa, vm_size_t size, int wimge) { - vm_size_t pgs[KERNEL_REGION_MAX_TLB_ENTRIES]; - vm_size_t mapped, pgsz, base, mask; - int idx, nents; + vm_offset_t base; + vm_size_t mapped, sz, ssize; - /* Round up to the next 1M */ - size = roundup2(size, 1 << 20); - mapped = 0; - idx = 0; base = va; - pgsz = 64*1024*1024; - while (mapped < size) { - while (mapped < size && idx < KERNEL_REGION_MAX_TLB_ENTRIES) { - while (pgsz > (size - mapped)) - pgsz >>= 2; - pgs[idx++] = pgsz; - mapped += pgsz; - } + ssize = size; - /* We under-map. Correct for this. */ - if (mapped < size) { - while (pgs[idx - 1] == pgsz) { - idx--; - mapped -= pgsz; - } - /* XXX We may increase beyond out starting point. */ - pgsz <<= 2; - pgs[idx++] = pgsz; - mapped += pgsz; + while (size > 0) { + sz = 1UL << (ilog2(size) & ~1); + /* Align size to PA */ + if (pa % sz != 0) { + do { + sz >>= 2; + } while (pa % sz != 0); } + /* Now align from there to VA */ + if (va % sz != 0) { + do { + sz >>= 2; + } while (va % sz != 0); + } + /* Now align from there to VA */ + if (bootverbose) + printf("Wiring VA=%p to PA=%jx (size=%lx)\n", + (void *)va, (uintmax_t)pa, (long)sz); + if (tlb1_set_entry(va, pa, sz, + _TLB_ENTRY_SHARED | wimge) < 0) + return (mapped); + size -= sz; + pa += sz; + va += sz; } - nents = idx; - mask = pgs[0] - 1; - /* Align address to the boundary */ - if (va & mask) { - va = (va + mask) & ~mask; - pa = (pa + mask) & ~mask; - } - - for (idx = 0; idx < nents; idx++) { - pgsz = pgs[idx]; - debugf("%u: %jx -> %jx, size=%jx\n", idx, (uintmax_t)pa, - (uintmax_t)va, (uintmax_t)pgsz); - tlb1_set_entry(va, pa, pgsz, - _TLB_ENTRY_SHARED | _TLB_ENTRY_MEM); - pa += pgsz; - va += pgsz; - } - mapped = (va - base); if (bootverbose) printf("mapped size 0x%"PRIxPTR" (wasted space 0x%"PRIxPTR")\n", - mapped, mapped - size); + mapped, mapped - ssize); + return (mapped); } From owner-svn-src-all@freebsd.org Mon Nov 4 01:19:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 847891AE59B; Mon, 4 Nov 2019 01:19:20 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "anubis.delphij.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475w1h201Wz3J2t; Mon, 4 Nov 2019 01:19:19 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from p51.home.us.delphij.net (unknown [IPv6:2601:646:8600:d04a:e670:b8ff:fe5c:4e69]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 08D5930043; Sun, 3 Nov 2019 17:19:11 -0800 (PST) Reply-To: d@delphij.net To: Ravi Pokala , Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911031325.xA3DPl3B080386@repo.freebsd.org> From: Xin Li Autocrypt: addr=delphij@delphij.net; keydata= mQINBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABtBxYaW4gTEkgPGRl bHBoaWpAZGVscGhpai5uZXQ+iQJUBBMBCgA+FiEEceNg5NEMZIki80nQQHl/fJX0g08FAluS R/YCGwMFCQmuhAAFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQQHl/fJX0g0+2Og//bWpE F2V5/M5l6YW1T8oLcT9rIOH6oq9M0LMNRgFeiNNnilGIeeIgtOGBRueG4CZiZAvsRPJkrO70 1R2SrdkCIvwGUzUAxx1NfBWb+vgm4fgkW/MotGonceM5v0qfSKKXasWvDctkK28aG+IoQzmi FjXNW4+ju4zeQFYwD4ZDWqw9MqO0hVb24uW3dxtQhbfmOLgJ/PEDMQaFuANbW1c+iR0BQA3D Go/EeMY4kpN8on6Aqt/S/4JVltudfQ9OXdjQsC7netSaB9K3mHGt9aKAAB7RzlRY00DKkYS/ /eQwLzGPmK7yX13M68mMDjBs6mIR8t/E1S5OdBNhHRPNPlEbwugR4KaiCsN5yqzJoSV99fKY z2VyxjWPaG8yhHE+jmKUgIBKTfFUQEfkriQR4EASoeJ+soaMTiFDBij1Zw5n3ndLRFMB1ZCl fZLER36mAgW4m4kP83TWnDiJLxOxSOxifV8HpTFjff902H85cybg9KMwrfPDr6W19GGk5Vo1 fkza5krRMGbKWb7+74Evusi0ZxJLIOFwp5Y8eVqUMZaAD3f1ZX1M3pgXOp20QgAy+2KvMHij rLa4q+tMGRzYYD1BnFVSVdXAX5VOoTmHBcDz67DkuRwk2Byp1sgd407oEOmSwrNJlKS0TPCm xUJ2fdSQF+1/MMSRfee49vtMvz7cOrC5Ag0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+tfx3z sUwAsH1VaBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+sFZ32 0pYcl61Fxg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiqhbL7 BthDOt5KxjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD7/Ef Pwwzou9T8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mVq7QZ Bc7nzwZ6UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzAylOa qdogra5EW+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrChphf aOLB9YIXhnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9Nb33 nmxMn09mb48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr8a4r cdsLbkvlyoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC+73Z YH1dh7lZABEBAAGJAjwEGAEKACYWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCW5JHigIbDAUJ Ca6EAAAKCRBAeX98lfSDTz8DEACMh3poeUb+gWNF4RWFZuLteZVo0+E1JLYXQkmtrRBLXviP +Qy0pXyFAVxLM4hNIBoIDYfK9BcwrBYf7AwSKrH0GiNwFpgHCkbZd6qoZy2gB+adTnCpVCTJ KJetsH/8awkrChJWMK0ckGf3EeWMPvawG7kW7FBz70NYEZ0pOMiaEZNVtzD3wwbYWUiDFYth 83XGglOExg+1ShTW5XjQPRrdyJAO+aUW4o3lVjfyUJXMgI4rmhMiLVm06GuNrbpKIF0s+4Vd jQAjhrDQjfoXi9CkfsA/cONseuHNv1JGj3RqHiqHJq1dbrpodXp925zGDAnUGxCOBPoFopAH gVzR89GTut059GpwqsddZmU6y7rqifuam/ekJ+QRwc16vgt7pHqCrTY8WPxRZr2UpFU1wlTo COdeiFep1gq1F9jzFjJnoMaAdmC6k7bgAA+RQusOgIhJL0jIej7DoAHxmxFFCfRy+lDtpXwF gQ8HMvzHI65QWmQnMo7s6SQH/ZH5s1yR6SJq8+3lDz+dCuT42qJVqIPVvxd10LW0FNN+t7HF eLadU6ekSgD13/EYMYXlvNHkw7dAItSDxIzgRyykLz0bCU9xwNWoS4Z43+ifF9anJ+uR0ltW El1j++h6ZrD3LLuCgJIt1so0m49GzdcSpOI7LCwMlacyvafiEyjUn+tSNDsnfw== Organization: The FreeBSD Project Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs Message-ID: <61bed957-a0c5-bb95-8138-13d00df9d44f@delphij.net> Date: Sun, 3 Nov 2019 17:19:03 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1Ml20wRaSfzcucOS3LgU7nPfd3XfKe7Dv" X-Rspamd-Queue-Id: 475w1h201Wz3J2t X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 01:19:20 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1Ml20wRaSfzcucOS3LgU7nPfd3XfKe7Dv Content-Type: multipart/mixed; boundary="2UUtBCh5AT5UmyB9XvkIYRjoIhlAN89vO"; protected-headers="v1" From: Xin Li Reply-To: d@delphij.net To: Ravi Pokala , Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <61bed957-a0c5-bb95-8138-13d00df9d44f@delphij.net> Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs References: <201911031325.xA3DPl3B080386@repo.freebsd.org> In-Reply-To: --2UUtBCh5AT5UmyB9XvkIYRjoIhlAN89vO Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable (chosen a random message) On 2019-11-03 15:30, Ravi Pokala wrote: > Uh.... >=20 > I've had a log device in my boot-pool for months, and have booted witho= ut issue: >=20 > [threepio:~] rpokala% zpool status zroot > pool: zroot > state: ONLINE > scan: scrub repaired 0 in 0 days 00:04:36 with 0 errors on Mon Oc= t 28 03:10:59 2019 > config: >=20 > NAME STATE READ WRITE CKSUM > zroot ONLINE 0 0 0 > nvd1p4 ONLINE 0 0 0 > logs > nvd0p1 ONLINE 0 0 0 >=20 > errors: No known data errors This is not supported, and it's not trivial to support it, because in order to support it, the bootloader would have to know how to replay zilogs, which would add quite a lot of code to it. It's unlikely that you actually hit a problem, however, because the critical contents to boot the system is rarely written to, and as a result it's quite likely that the readable, consistent state of your /boot/ is good enough to boot the system. That's said, it's still because you were lucky, and the code was not designed to work that way...= Cheers, --2UUtBCh5AT5UmyB9XvkIYRjoIhlAN89vO-- --1Ml20wRaSfzcucOS3LgU7nPfd3XfKe7Dv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.2.17 (FreeBSD) iQIzBAEBCgAdFiEEceNg5NEMZIki80nQQHl/fJX0g08FAl2/fIwACgkQQHl/fJX0 g0+GTA/8CqC8u5dDZJVA10LrU6KpQqZqx9ZuTm8o3Kdgm+lei+MMMMKYlng5ugBc iW8ko8k1ElIPk8BuYqnv0F3r6IoHxIU7Wn9vQK9DqVl3R+QDR9OdgZOLrTu5zJhG q3tDyQ0fHFPtmOaKJJcnu/d8qZZMZXPiMCAk+3ZbjskmVlDqhOwHMSF4NuX+wuFW pJo6c0u79VedvU3wBdDcCv1Y4X4Sjq08pcdLOV7iaG/O/JPP66nLyfrWrY1SLzGp eNJ0h8DgHVdbsgf4MyuwMVkb0MMNQx8juXEk+ovKJaZkwFwswLfyG6fOeAWyr6IH O0Iolm3ocCnYyncKM63BoEkatosLl75vet9ke1gRpxEWB+NXHQOKgbMEiPWsReVQ wOFN2VgoT8M0zB8u3WexZuIoUMY76s8KVL/ND3kBP/fSE85CXyiWY2nR7Q/WuDBf 9DSakJckexaGG6uPnrmkvBFN7eFsLQG7s4sir9TA3k1ET0rILO5SOoD8/A9ZrQXi Coc8ZvmZVV35RGSMZzaixuVKXGsaihfd84b4lmkTDmf4MVnct1nKuet1D6D0Td15 Y1+Fq+cLIHL9wggUoRquKMdzsbjg4lHKAWvw7D07MEf6FQkPBQgY158GBV+sRFTh 6BRWW0negOkmXUlmJeSsgqhv/uGDxwq6XoJPO3wzERa7+1QNIys= =PQAz -----END PGP SIGNATURE----- --1Ml20wRaSfzcucOS3LgU7nPfd3XfKe7Dv-- From owner-svn-src-all@freebsd.org Mon Nov 4 01:31:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 544A91AEC2E; Mon, 4 Nov 2019 01:31:24 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "anubis.delphij.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475wHb226pz3JcY; Mon, 4 Nov 2019 01:31:22 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from p51.home.us.delphij.net (unknown [IPv6:2601:646:8600:d04a:e670:b8ff:fe5c:4e69]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 011E430077; Sun, 3 Nov 2019 17:31:20 -0800 (PST) Reply-To: d@delphij.net To: Toomas Soome , Kevin Bowling Cc: Andriy Gapon , Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> From: Xin Li Autocrypt: addr=delphij@delphij.net; keydata= mQINBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABtBxYaW4gTEkgPGRl bHBoaWpAZGVscGhpai5uZXQ+iQJUBBMBCgA+FiEEceNg5NEMZIki80nQQHl/fJX0g08FAluS R/YCGwMFCQmuhAAFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQQHl/fJX0g0+2Og//bWpE F2V5/M5l6YW1T8oLcT9rIOH6oq9M0LMNRgFeiNNnilGIeeIgtOGBRueG4CZiZAvsRPJkrO70 1R2SrdkCIvwGUzUAxx1NfBWb+vgm4fgkW/MotGonceM5v0qfSKKXasWvDctkK28aG+IoQzmi FjXNW4+ju4zeQFYwD4ZDWqw9MqO0hVb24uW3dxtQhbfmOLgJ/PEDMQaFuANbW1c+iR0BQA3D Go/EeMY4kpN8on6Aqt/S/4JVltudfQ9OXdjQsC7netSaB9K3mHGt9aKAAB7RzlRY00DKkYS/ /eQwLzGPmK7yX13M68mMDjBs6mIR8t/E1S5OdBNhHRPNPlEbwugR4KaiCsN5yqzJoSV99fKY z2VyxjWPaG8yhHE+jmKUgIBKTfFUQEfkriQR4EASoeJ+soaMTiFDBij1Zw5n3ndLRFMB1ZCl fZLER36mAgW4m4kP83TWnDiJLxOxSOxifV8HpTFjff902H85cybg9KMwrfPDr6W19GGk5Vo1 fkza5krRMGbKWb7+74Evusi0ZxJLIOFwp5Y8eVqUMZaAD3f1ZX1M3pgXOp20QgAy+2KvMHij rLa4q+tMGRzYYD1BnFVSVdXAX5VOoTmHBcDz67DkuRwk2Byp1sgd407oEOmSwrNJlKS0TPCm xUJ2fdSQF+1/MMSRfee49vtMvz7cOrC5Ag0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+tfx3z sUwAsH1VaBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+sFZ32 0pYcl61Fxg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiqhbL7 BthDOt5KxjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD7/Ef Pwwzou9T8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mVq7QZ Bc7nzwZ6UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzAylOa qdogra5EW+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrChphf aOLB9YIXhnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9Nb33 nmxMn09mb48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr8a4r cdsLbkvlyoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC+73Z YH1dh7lZABEBAAGJAjwEGAEKACYWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCW5JHigIbDAUJ Ca6EAAAKCRBAeX98lfSDTz8DEACMh3poeUb+gWNF4RWFZuLteZVo0+E1JLYXQkmtrRBLXviP +Qy0pXyFAVxLM4hNIBoIDYfK9BcwrBYf7AwSKrH0GiNwFpgHCkbZd6qoZy2gB+adTnCpVCTJ KJetsH/8awkrChJWMK0ckGf3EeWMPvawG7kW7FBz70NYEZ0pOMiaEZNVtzD3wwbYWUiDFYth 83XGglOExg+1ShTW5XjQPRrdyJAO+aUW4o3lVjfyUJXMgI4rmhMiLVm06GuNrbpKIF0s+4Vd jQAjhrDQjfoXi9CkfsA/cONseuHNv1JGj3RqHiqHJq1dbrpodXp925zGDAnUGxCOBPoFopAH gVzR89GTut059GpwqsddZmU6y7rqifuam/ekJ+QRwc16vgt7pHqCrTY8WPxRZr2UpFU1wlTo COdeiFep1gq1F9jzFjJnoMaAdmC6k7bgAA+RQusOgIhJL0jIej7DoAHxmxFFCfRy+lDtpXwF gQ8HMvzHI65QWmQnMo7s6SQH/ZH5s1yR6SJq8+3lDz+dCuT42qJVqIPVvxd10LW0FNN+t7HF eLadU6ekSgD13/EYMYXlvNHkw7dAItSDxIzgRyykLz0bCU9xwNWoS4Z43+ifF9anJ+uR0ltW El1j++h6ZrD3LLuCgJIt1so0m49GzdcSpOI7LCwMlacyvafiEyjUn+tSNDsnfw== Organization: The FreeBSD Project Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs Message-ID: <0cb52df0-9128-b3d7-8b56-7ac583b9ad62@delphij.net> Date: Sun, 3 Nov 2019 17:31:16 -0800 MIME-Version: 1.0 In-Reply-To: <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ABPXx8qtSk9ArSkQ27f9M4YMTPmsizUmj" X-Rspamd-Queue-Id: 475wHb226pz3JcY X-Spamd-Bar: ------- X-Spamd-Result: default: False [-7.54 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[d@delphij.net]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; HAS_ATTACHMENT(0.00)[]; HAS_ORG_HEADER(0.00)[]; DKIM_TRACE(0.00)[delphij.net:+]; DMARC_POLICY_ALLOW(-0.50)[delphij.net,reject]; RCPT_COUNT_SEVEN(0.00)[7]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[me.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~]; IP_SCORE(-2.44)[ip: (-9.89), ipnet: 64.62.128.0/18(1.21), asn: 6939(-3.47), country: US(-0.05)]; ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[delphij.net:s=m7e2]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain]; REPLYTO_DOM_EQ_FROM_DOM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 01:31:24 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ABPXx8qtSk9ArSkQ27f9M4YMTPmsizUmj Content-Type: multipart/mixed; boundary="yuX5ogQ27Ef5KKkIqDmBNGdKzOtKuoEQr"; protected-headers="v1" From: Xin Li Reply-To: d@delphij.net To: Toomas Soome , Kevin Bowling Cc: Andriy Gapon , Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <0cb52df0-9128-b3d7-8b56-7ac583b9ad62@delphij.net> Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <276a3efd-da6c-69ca-cc4f-51c9a5b77696@FreeBSD.org> <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> In-Reply-To: <51E88C9A-CA94-4503-85F7-8BCD57C00961@me.com> --yuX5ogQ27Ef5KKkIqDmBNGdKzOtKuoEQr Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2019-11-03 13:32, Toomas Soome wrote: >=20 >=20 >> On 3. Nov 2019, at 22:39, Kevin Bowling wro= te: >> >> I believe this is/was a common configuration, at least the few >> spinning disk based systems I have left have a slog. >> >=20 > On boot pool? um. well, I=E2=80=99ll kick out that return then. I think it's fine to simply ignore the log in loader, because it's a read-only consumer. The full-featured kernel ZFS code would skip replaying the log when importing read-only, in that case we might see some outdated data, but it's still guaranteed to be consistent by ZFS. Cheers, >=20 > rgds, > toomas >=20 >> On Sun, Nov 3, 2019 at 10:55 AM Andriy Gapon wrote: >>> >>> On 03/11/2019 15:25, Toomas Soome wrote: >>>> Author: tsoome >>>> Date: Sun Nov 3 13:25:47 2019 >>>> New Revision: 354283 >>>> URL: https://svnweb.freebsd.org/changeset/base/354283 >>>> >>>> Log: >>>> loader: we do not support booting from pool with log device >>>> >>>> If pool has log device, stop there and tell about it. >>> >>> Why? >>> >>>> Modified: >>>> head/stand/libsa/zfs/zfs.c >>>> head/stand/libsa/zfs/zfsimpl.c >>>> head/sys/cddl/boot/zfs/zfsimpl.h >>> >>> >>> >>> -- >>> Andriy Gapon >>> _______________________________________________ >>> svn-src-head@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/svn-src-head >>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.or= g" >=20 --yuX5ogQ27Ef5KKkIqDmBNGdKzOtKuoEQr-- --ABPXx8qtSk9ArSkQ27f9M4YMTPmsizUmj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.2.17 (FreeBSD) iQIzBAEBCgAdFiEEceNg5NEMZIki80nQQHl/fJX0g08FAl2/f2QACgkQQHl/fJX0 g0/0yxAArGEiseHZH0lZvRIc/fuyARzAofV+MYUvG7vVBLsUStlTUVBYmFvyyb4I Zbx5LB1RYTGojIEEg61E/5NXCaXzOBYcGJhNX3cdLSBnP9dPM7W+0xgalqNsVUK4 aM83FXYSEXFneivC3jBn+Oq++gLysNnCX0P7ldbFbZzKHtOndySwvmAhv2zSL3kV OZ6KUwCf8cYHdsw1Ah7adtOMzK1x+T9iNrZ7KTUeWHgnEvN553azjJQRF+58XyZ3 UHKAb1ATH4b3l5V0ZpqxJhj68GUMJuzOgMP2/4q6Co2wYDLfvsakpFHc3fo6ryOz Id+6qfDbAXEU/rPbfRPXoLz7knXU7eDaosMZoMNNWk2W3sqzLmmwrDmmcZKQQEig uVGtu5xyq4jNIf1ANBhN2/NwoaMXuUfrefF0q/yJHANQMdQVFJ511ZWU/U5n76jf LQSzU5cidj/FD5DnxrGEaaMCd1tsZKeywWPFVCYuQ8e7qjHGd1iW9JNmWyN4NJsQ ot6jbUbeKlid/7TuTP5ombn4vrhtWJIeRY3kNd06u8kuF+XInV60tlIu0kbwnFO+ t8P3UDaRyjX28CH1aMVF73qHNqLaW3qN3kNsoN3o9vP8b5Om9tn+TbgN4TO07AAR uhPwYYQyC7ywhAhvzflUl6+XXbJf4ibYt4TBldJojH1VBHwV+ww= =deBN -----END PGP SIGNATURE----- --ABPXx8qtSk9ArSkQ27f9M4YMTPmsizUmj-- From owner-svn-src-all@freebsd.org Mon Nov 4 01:43:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 739651AF119; Mon, 4 Nov 2019 01:43:10 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475wY91B5xz3KHf; Mon, 4 Nov 2019 01:43:08 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-il1-x143.google.com with SMTP id d83so13383500ilk.7; Sun, 03 Nov 2019 17:43:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kCRKN522t0CLu3GFEWQ5fvwCmv+dXepLVZCjHByMgvM=; b=COe8Rprcd4GoMZkJ3CMNjS3HEHacOZofAkGTkRq7Zg9utEXlriPUbDAafUBIDAq93W YS178GamXu1WxV7K46Cz3WrvKXQ/HwTa3ERh+F+zBonoTvNrAWZzPSUZjdyfXpaqaJzx VA9uuuklCD5dZSqIc2S+Xpb1KoaNWUfqt8mdX8xv/WPGG0iz6Q8O2Iat3KncuJyqjpjs Z9C/BaGbRJuBhLqFWiXIgL9nMbDOkGgRrq1Ht0wEyoCjfDCBdrYpYrhRvRw/14pmN8Ei kXghJ1rzZnY0Nglq4vNlQnEK6kJOpdgtJ8gWcOd8I8/djymkbMhjL76zFD9TTLGckIJi tqpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kCRKN522t0CLu3GFEWQ5fvwCmv+dXepLVZCjHByMgvM=; b=qDKccSLv7iA2CKJu9CKgmsAQLeNqtE96I6CaYcMi96MZutIrbmgT2hKTRE24gNjEjq 9oIfPaGC3izCgOJGUqrfv0q4SeSnZWOcM/cQWQQ//rLzv2nAwcvWx1ab1CqaVdATa2q7 vALBOeLOXysEJGB6JsmaDxlx/ho+gfGYW8ypH3re3tly6lbIm42mKOlSaxa9645QeNbB rIi9IsoKo+MomZEMLSdpnX7pD/iT8Aj48wIiJsMY3C38smex0BgbsIr0Q63RJbBXTvmQ OARQrC3J2cWt/tK8MHgdQMnAL61TYjBhGJ7WMmoytQ97oooG3D2WWOhsrPfJ61YMeStw BroA== X-Gm-Message-State: APjAAAX2aMMib7xyHhovajYofWr5P3fi3wEHg9S12sskyJ57+vC5YKm7 tFNmT2nuDBF9BWv8JYFEGyyh7beS X-Google-Smtp-Source: APXvYqzCoyGrOrVaIggjTen68sODxddT3dU1NEzQrXmR8QyxNC8N9NFAtp7HqwcK4TPZRUjxb8nm7w== X-Received: by 2002:a92:1b4c:: with SMTP id b73mr25946005ilb.207.1572831787773; Sun, 03 Nov 2019 17:43:07 -0800 (PST) Received: from spectre.mavhome.dp.ua ([75.104.85.209]) by smtp.gmail.com with ESMTPSA id b11sm858263ios.43.2019.11.03.17.43.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Nov 2019 17:43:07 -0800 (PST) Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs To: d@delphij.net, Ravi Pokala , Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <61bed957-a0c5-bb95-8138-13d00df9d44f@delphij.net> From: Alexander Motin Autocrypt: addr=mavbsd@gmail.com; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IkFsZXhhbmRlciBNb3RpbiA8bWF2YnNkQGdtYWlsLmNvbT6JAVQEEwEKAD4CGwMFCwkI BwMFFQoJCAsFFgMCAQACHgECF4AWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDCtwUJDTHM ogAKCRCDGMOVW6sif7nYB/9TpvgdnxMVBT9aPaaGrFOToI8lV5eCUIB3ot6+VbfeMam0nkFZ GGoaXvDMdIf++1jFADTP+hcl1fIrrH1uy2ZS1tDu3Ngd6BUCAcHcbFEqEZnCwzQTkULHbYGJ pHxKAvQYIvrOTpBb4IBHBO44lOVC21VYj8ii6hTr1ACqYa4SbIaQobByWkWErHNGN9A64LFS rbir4mXJ0Bo0vgfj3jtoGEV8RrbYseYBR2NOaw+1GjRMjoJxyTMgU1XNDZHAVGHiw/KG2cR8 EH4rqj47fLWJLWZy/ffUsWmqDnWvqswbzZjQXT8B4Yls9aqum5pykoNKtbAFT8Xpb/Y9RE1s nkXTuQENBFOzxAwBCADmYFn9nCSLvufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4 A7ZnBSxj3zMlriwL0jPsZqILpO8wuIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP 3ONDIVGYd+OQwOI2FlmmTY0B1FlUNXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8r VPDXVGqQ3CVWO3BD9pyQVTWT5ziDm0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdR HRCM0P2tZ4f9I+DV7c2RKiluGk1pZkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUf ABEBAAGJATwEGAEKACYCGwwWIQTpjPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAK CRCDGMOVW6sif06oB/0UBwpZL3nBNNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOs Xurqxg+zqnTQJddlG641m3SVfs73mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgu b4D2+OU537cPf/p9IvBn1YUITqnqVBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEv WHEFoN4/R54qXOjLuNeh1/fBW9ddzRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r 8BrK6eDOP0Rc1m0oLGzp2xO+OeJZrlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ tCJBbGV4YW5kZXIgTW90aW4gPG1hdmJzZEBnbWFpbC5jb20+uQENBFOzxAwBCADmYFn9nCSL vufCMz9nZFxP7q497a+Dqqwf8hxllH+9S8+g9BYumQF4A7ZnBSxj3zMlriwL0jPsZqILpO8w uIUQWL0MnJiIbqgatYztVqf2fpaaDzP9XA2C5/BZb5iP3ONDIVGYd+OQwOI2FlmmTY0B1FlU NXz3+feb3VVTD0/2mxPBOQ2hen0pEZqhU5n2EZH27d8rVPDXVGqQ3CVWO3BD9pyQVTWT5ziD m0f2SIEsY46xuaN+Ml6KnrqfCb8BL/vzcpc87slxGUdRHRCM0P2tZ4f9I+DV7c2RKiluGk1p Zkqm+sDfI4dTkjjqpGLH5xN538XGW8YuCEaDUGJZufUfABEBAAGJATwEGAEKACYCGwwWIQTp jPPE5pzDzQ5XnVWDGMOVW6sifwUCWWDC2AUJDTHMzAAKCRCDGMOVW6sif06oB/0UBwpZL3nB NNutpcCqD/5tDIeCOUy0YKCSZ/EuxtQZ6qIWCZIi6gOsXurqxg+zqnTQJddlG641m3SVfs73 mt7yaDODGbmImKxml1scxV6liXD8DFPbAIfDEYIR7rgub4D2+OU537cPf/p9IvBn1YUITqnq VBnUIODT3F74kpKAL4oOqafS3MYrJ9IK6FECrdeRnLEvWHEFoN4/R54qXOjLuNeh1/fBW9dd zRyanNoHkxy5EcrgRTqMiKgejfRio8zgCM8cbFXZfU3r8BrK6eDOP0Rc1m0oLGzp2xO+OeJZ rlWRn0XhI51JvER6fUNlFil5ad3sZWY7zqf7lRKQoJc+ Message-ID: Date: Sun, 3 Nov 2019 20:42:53 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: <61bed957-a0c5-bb95-8138-13d00df9d44f@delphij.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 475wY91B5xz3KHf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=COe8Rprc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::143 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[209.85.104.75.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (1.85), ipnet: 2607:f8b0::/32(-2.38), asn: 15169(-2.03), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 01:43:10 -0000 On 03.11.2019 20:19, Xin Li wrote: > On 2019-11-03 15:30, Ravi Pokala wrote: >> Uh.... >> >> I've had a log device in my boot-pool for months, and have booted without issue: >> >> [threepio:~] rpokala% zpool status zroot >> pool: zroot >> state: ONLINE >> scan: scrub repaired 0 in 0 days 00:04:36 with 0 errors on Mon Oct 28 03:10:59 2019 >> config: >> >> NAME STATE READ WRITE CKSUM >> zroot ONLINE 0 0 0 >> nvd1p4 ONLINE 0 0 0 >> logs >> nvd0p1 ONLINE 0 0 0 >> >> errors: No known data errors > > > This is not supported, and it's not trivial to support it, because in > order to support it, the bootloader would have to know how to replay > zilogs, which would add quite a lot of code to it. The issue with ZIL not being replayed in case of read-only mount has nothing to do with the fact of SLOG device presence. The issue is the same when ZIL resides on the main disks of the pool. So while everything else you said is right, I see no any reason to ban pools with SLOG devices in this context. -- Alexander Motin From owner-svn-src-all@freebsd.org Mon Nov 4 02:29:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FC291B0210; Mon, 4 Nov 2019 02:29:59 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475xbC1Kfpz3LgT; Mon, 4 Nov 2019 02:29:59 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C8391D4A7; Mon, 4 Nov 2019 02:29:59 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA42Tw65067401; Mon, 4 Nov 2019 02:29:58 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA42Tw98067400; Mon, 4 Nov 2019 02:29:58 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201911040229.xA42Tw98067400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 4 Nov 2019 02:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354327 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 354327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 02:29:59 -0000 Author: wulf Date: Mon Nov 4 02:29:58 2019 New Revision: 354327 URL: https://svnweb.freebsd.org/changeset/base/354327 Log: [ig4] Try to workaround MIPS namespace pollution issue Modified: head/sys/dev/ichiic/ig4_iic.c Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Mon Nov 4 00:35:40 2019 (r354326) +++ head/sys/dev/ichiic/ig4_iic.c Mon Nov 4 02:29:58 2019 (r354327) @@ -161,7 +161,7 @@ reg_read(ig4iic_softc_t *sc, uint32_t reg) } static void -set_intr_mask(ig4iic_softc_t *sc, uint32_t val) +ig4iic_set_intr_mask(ig4iic_softc_t *sc, uint32_t val) { if (sc->intr_mask != val) { reg_write(sc, IG4_REG_INTR_MASK, val); @@ -233,7 +233,7 @@ set_controller(ig4iic_softc_t *sc, uint32_t ctl) * When the controller is enabled, interrupt on STOP detect * or receive character ready and clear pending interrupts. */ - set_intr_mask(sc, 0); + ig4iic_set_intr_mask(sc, 0); if (ctl & IG4_I2C_ENABLE) reg_read(sc, IG4_REG_CLR_INTR); @@ -298,10 +298,10 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) */ if (!DO_POLL(sc)) { mtx_lock_spin(&sc->io_lock); - set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); + ig4iic_set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); msleep_spin(sc, &sc->io_lock, "i2cwait", (hz + 99) / 100); /* sleep up to 10ms */ - set_intr_mask(sc, 0); + ig4iic_set_intr_mask(sc, 0); mtx_unlock_spin(&sc->io_lock); count_us += 10000; } else { @@ -1137,7 +1137,7 @@ ig4iic_intr(void *cookie) /* Ignore stray interrupts */ if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) { /* Interrupt bits are cleared in wait_intr() loop */ - set_intr_mask(sc, 0); + ig4iic_set_intr_mask(sc, 0); wakeup(sc); retval = FILTER_HANDLED; } From owner-svn-src-all@freebsd.org Mon Nov 4 03:07:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B5E11B0E9C; Mon, 4 Nov 2019 03:07:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475yPz3fBPz3NWN; Mon, 4 Nov 2019 03:07:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E7071DC6F; Mon, 4 Nov 2019 03:07:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4373Ul092100; Mon, 4 Nov 2019 03:07:03 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4372FJ092095; Mon, 4 Nov 2019 03:07:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911040307.xA4372FJ092095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 4 Nov 2019 03:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354328 - in head/usr.bin/patch: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/usr.bin/patch: . tests X-SVN-Commit-Revision: 354328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 03:07:03 -0000 Author: kevans Date: Mon Nov 4 03:07:01 2019 New Revision: 354328 URL: https://svnweb.freebsd.org/changeset/base/354328 Log: patch(1): give /dev/null patches special treatment We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21535 Modified: head/usr.bin/patch/patch.1 head/usr.bin/patch/patch.c head/usr.bin/patch/pch.c head/usr.bin/patch/pch.h head/usr.bin/patch/tests/unified_patch_test.sh head/usr.bin/patch/util.c Modified: head/usr.bin/patch/patch.1 ============================================================================== --- head/usr.bin/patch/patch.1 Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/patch.1 Mon Nov 4 03:07:01 2019 (r354328) @@ -21,7 +21,7 @@ .\" .\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd August 15, 2015 +.Dd November 3, 2019 .Dt PATCH 1 .Os .Sh NAME @@ -559,8 +559,10 @@ option as needed. .Pp Third, you can create a file by sending out a diff that compares a null file to the file you want to create. -This will only work if the file you want to create does not exist already in -the target directory. +If the file you want to create already exists in the target directory when the +diff is applied, then +.Nm +will identify the patch as potentially reversed and offer to reverse the patch. .Pp Fourth, take care not to send out reversed patches, since it makes people wonder whether they already applied the patch. Modified: head/usr.bin/patch/patch.c ============================================================================== --- head/usr.bin/patch/patch.c Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/patch.c Mon Nov 4 03:07:01 2019 (r354328) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); static bool similar(const char *, const char *, int); static void usage(void); +static bool handle_creation(bool, bool *); /* true if -E was specified on command line. */ static bool remove_empty_files = false; @@ -147,8 +149,10 @@ static char end_defined[128]; int main(int argc, char *argv[]) { + struct stat statbuf; int error = 0, hunk, failed, i, fd; - bool patch_seen, reverse_seen; + bool out_creating, out_existed, patch_seen, remove_file; + bool reverse_seen; LINENUM where = 0, newwhere, fuzz, mymaxfuzz; const char *tmpdir; char *v; @@ -219,6 +223,12 @@ main(int argc, char *argv[]) reinitialize_almost_everything()) { /* for each patch in patch file */ + if (source_file != NULL && (diff_type == CONTEXT_DIFF || + diff_type == NEW_CONTEXT_DIFF || + diff_type == UNI_DIFF)) + out_creating = strcmp(source_file, _PATH_DEVNULL) == 0; + else + out_creating = false; patch_seen = true; warn_on_invalid_line = true; @@ -226,6 +236,19 @@ main(int argc, char *argv[]) if (outname == NULL) outname = xstrdup(filearg[0]); + /* + * At this point, we know if we're supposed to be creating the + * file and we know if we should be trying to handle a conflict + * between the patch and the file already existing. We defer + * handling it until hunk processing because we want to swap + * the hunk if they opt to reverse it, but we want to make sure + * we *can* swap the hunk without running into memory issues + * before we offer it. We also want to be verbose if flags or + * user decision cause us to skip -- this is explained a little + * more later. + */ + out_existed = stat(outname, &statbuf) == 0; + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); @@ -252,9 +275,28 @@ main(int argc, char *argv[]) failed = 0; reverse_seen = false; out_of_mem = false; + remove_file = false; while (another_hunk()) { + assert(!out_creating || hunk == 0); hunk++; fuzz = 0; + + /* + * There are only three cases in handle_creation() that + * results in us skipping hunk location, in order: + * + * 1.) Potentially reversed but -f/--force'd, + * 2.) Potentially reversed but -N/--forward'd + * 3.) Reversed and the user's opted to not apply it. + * + * In all three cases, we still want to inform the user + * that we're ignoring it in the standard way, which is + * also tied to this hunk processing loop. + */ + if (out_creating) + reverse_seen = handle_creation(out_existed, + &remove_file); + mymaxfuzz = pch_context(); if (maxfuzz < mymaxfuzz) mymaxfuzz = maxfuzz; @@ -372,7 +414,6 @@ main(int argc, char *argv[]) /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { - struct stat statbuf; char *realout = outname; if (!check_only) { @@ -383,7 +424,18 @@ main(int argc, char *argv[]) } else chmod(outname, filemode); - if (remove_empty_files && + /* + * remove_file is a per-patch flag indicating + * whether it's OK to remove the empty file. + * This is specifically set when we're reversing + * the creation of a file and it ends up empty. + * This is an exception to the global policy + * (remove_empty_files) because the user would + * likely not expect the reverse of file + * creation to leave an empty file laying + * around. + */ + if ((remove_empty_files || remove_file) && stat(realout, &statbuf) == 0 && statbuf.st_size == 0) { if (verbose) @@ -444,6 +496,9 @@ reinitialize_almost_everything(void) filearg[0] = NULL; } + free(source_file); + source_file = NULL; + free(outname); outname = NULL; @@ -1083,4 +1138,85 @@ similar(const char *a, const char *b, int len) } return true; /* actually, this is not reached */ /* since there is always a \n */ +} + +static bool +handle_creation(bool out_existed, bool *remove) +{ + bool reverse_seen; + + reverse_seen = false; + if (reverse && out_existed) { + /* + * If the patch creates the file and we're reversing the patch, + * then we need to indicate to the patch processor that it's OK + * to remove this file. + */ + *remove = true; + } else if (!reverse && out_existed) { + /* + * Otherwise, we need to blow the horn because the patch appears + * to be reversed/already applied. For non-batch jobs, we'll + * prompt to figure out what we should be trying to do to raise + * awareness of the issue. batch (-t) processing suppresses the + * questions and just assumes that we're reversed if it looks + * like we are, which is always the case if we've reached this + * branch. + */ + if (force) { + skip_rest_of_patch = true; + return (false); + } + if (noreverse) { + /* If -N is supplied, however, we bail out/ignore. */ + say("Ignoring previously applied (or reversed) patch.\n"); + skip_rest_of_patch = true; + return (false); + } + + /* Unreversed... suspicious if the file existed. */ + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + + reverse = !reverse; + + if (batch) { + if (verbose) + say("Patch creates file that already exists, %s %seversed", + reverse ? "Assuming" : "Ignoring", + reverse ? "R" : "Unr"); + } else { + ask("Patch creates file that already exists! %s -R? [y] ", + reverse ? "Assume" : "Ignore"); + + if (*buf == 'n') { + ask("Apply anyway? [n]"); + if (*buf != 'y') + /* Don't apply; error out. */ + skip_rest_of_patch = true; + else + /* Attempt to apply. */ + reverse_seen = true; + reverse = !reverse; + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + } else { + /* + * They've opted to assume -R; effectively the + * same as the first branch in this function, + * but the decision is here rather than in a + * prior patch/hunk as in that branch. + */ + *remove = true; + } + } + } + + /* + * The return value indicates if we offered a chance to reverse but the + * user declined. This keeps the main patch processor in the loop since + * we've taken this out of the normal flow of hunk processing to + * simplify logic a little bit. + */ + return (reverse_seen); } Modified: head/usr.bin/patch/pch.c ============================================================================== --- head/usr.bin/patch/pch.c Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/pch.c Mon Nov 4 03:07:01 2019 (r354328) @@ -70,6 +70,8 @@ static LINENUM p_bfake = -1; /* beg of faked up lines static FILE *pfp = NULL; /* patch file pointer */ static char *bestguess = NULL; /* guess at correct filename */ +char *source_file; + static void grow_hunkmax(void); static int intuit_diff_type(void); static void next_intuit_at(off_t, LINENUM); @@ -218,7 +220,12 @@ there_is_another_patch(void) bestguess = xstrdup(buf); filearg[0] = fetchname(buf, &exists, 0); } - if (!exists) { + /* + * fetchname can now return buf = NULL, exists = true, to + * indicate to the caller that /dev/null was specified. Retain + * previous behavior for now until this can be better evaluted. + */ + if (filearg[0] == NULL || !exists) { int def_skip = *bestguess == '\0'; ask("No file found--skip this patch? [%c] ", def_skip ? 'y' : 'n'); @@ -402,6 +409,24 @@ scan_exit: struct file_name tmp = names[OLD_FILE]; names[OLD_FILE] = names[NEW_FILE]; names[NEW_FILE] = tmp; + } + + /* Invalidated */ + free(source_file); + source_file = NULL; + + if (retval != 0) { + /* + * If we've successfully determined a diff type, stored in + * retval, path == NULL means _PATH_DEVNULL if exists is set. + * Explicitly specify it here to make it easier to detect later + * on that we're actually creating a file and not that we've + * just goofed something up. + */ + if (names[OLD_FILE].path != NULL) + source_file = xstrdup(names[OLD_FILE].path); + else if (names[OLD_FILE].exists) + source_file = xstrdup(_PATH_DEVNULL); } if (filearg[0] == NULL) { if (posix) Modified: head/usr.bin/patch/pch.h ============================================================================== --- head/usr.bin/patch/pch.h Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/pch.h Mon Nov 4 03:07:01 2019 (r354328) @@ -37,6 +37,8 @@ struct file_name { bool exists; }; +extern char *source_file; + void re_patch(void); void open_patch_file(const char *); void set_hunkmax(void); Modified: head/usr.bin/patch/tests/unified_patch_test.sh ============================================================================== --- head/usr.bin/patch/tests/unified_patch_test.sh Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/tests/unified_patch_test.sh Mon Nov 4 03:07:01 2019 (r354328) @@ -103,26 +103,27 @@ file_creation_body() # contents as many times as you apply the diff. It should instead detect that # a source of /dev/null creates the file, so it shouldn't exist. Furthermore, # the reverse of creation is deletion -- hence the next test, which ensures that -# the file is removed if it's empty once the patch is reversed. +# the file is removed if it's empty once the patch is reversed. The size checks +# are scattered throughout to make sure that we didn't get some kind of false +# error, and the first size check is merely a sanity check that should be +# trivially true as this is executed in a sandbox. atf_test_case file_nodupe file_nodupe_body() { - # WIP - atf_expect_fail "patch(1) erroneously duplicates created files" echo "x" > foo diff -u /dev/null foo > foo.diff - atf_check -x "patch -s < foo.diff" - atf_check -s not-exit:0 -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -Ns < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo } atf_test_case file_removal file_removal_body() { - - # WIP - atf_expect_fail "patch(1) does not yet recognize /dev/null as creation" echo "x" > foo diff -u /dev/null foo > foo.diff Modified: head/usr.bin/patch/util.c ============================================================================== --- head/usr.bin/patch/util.c Mon Nov 4 02:29:58 2019 (r354327) +++ head/usr.bin/patch/util.c Mon Nov 4 03:07:01 2019 (r354328) @@ -366,8 +366,10 @@ fetchname(const char *at, bool *exists, int strip_lead say("fetchname %s %d\n", at, strip_leading); #endif /* So files can be created by diffing against /dev/null. */ - if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) + if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) { + *exists = true; return NULL; + } name = fullname = t = savestr(at); tab = strchr(t, '\t') != NULL; From owner-svn-src-all@freebsd.org Mon Nov 4 06:31:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E30671B4420 for ; Mon, 4 Nov 2019 06:31:07 +0000 (UTC) (envelope-from tsoome@me.com) Received: from mr85p00im-zteg06023901.me.com (mr85p00im-zteg06023901.me.com [17.58.23.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4762xQ6qb9z41YL for ; Mon, 4 Nov 2019 06:31:06 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by mr85p00im-zteg06023901.me.com (Postfix) with ESMTPSA id C0909960AA9; Mon, 4 Nov 2019 06:31:03 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3594.4.19\)) Subject: Re: svn commit: r354283 - in head: stand/libsa/zfs sys/cddl/boot/zfs From: Toomas Soome In-Reply-To: Date: Mon, 4 Nov 2019 08:31:01 +0200 Cc: d@delphij.net, Ravi Pokala , Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201911031325.xA3DPl3B080386@repo.freebsd.org> <61bed957-a0c5-bb95-8138-13d00df9d44f@delphij.net> To: Alexander Motin X-Mailer: Apple Mail (2.3594.4.19) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=906 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911040062 X-Rspamd-Queue-Id: 4762xQ6qb9z41YL X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[me.com]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RCPT_COUNT_SEVEN(0.00)[7]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[192.23.58.17.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:714, ipnet:17.58.16.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[me.com]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-2.89), ipnet: 17.58.16.0/20(-1.78), asn: 714(-2.55), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 06:31:07 -0000 > On 4. Nov 2019, at 03:42, Alexander Motin wrote: >=20 > On 03.11.2019 20:19, Xin Li wrote: >> On 2019-11-03 15:30, Ravi Pokala wrote: >>> Uh.... >>>=20 >>> I've had a log device in my boot-pool for months, and have booted = without issue: >>>=20 >>> [threepio:~] rpokala% zpool status zroot >>> pool: zroot >>> state: ONLINE >>> scan: scrub repaired 0 in 0 days 00:04:36 with 0 errors on Mon = Oct 28 03:10:59 2019 >>> config: >>>=20 >>> NAME STATE READ WRITE CKSUM >>> zroot ONLINE 0 0 0 >>> nvd1p4 ONLINE 0 0 0 >>> logs >>> nvd0p1 ONLINE 0 0 0 >>>=20 >>> errors: No known data errors >>=20 >>=20 >> This is not supported, and it's not trivial to support it, because in >> order to support it, the bootloader would have to know how to replay >> zilogs, which would add quite a lot of code to it. >=20 > The issue with ZIL not being replayed in case of read-only mount has > nothing to do with the fact of SLOG device presence. The issue is the > same when ZIL resides on the main disks of the pool. So while > everything else you said is right, I see no any reason to ban pools = with > SLOG devices in this context. >=20 Yep, indeed. I got myself confused from the fact we return EIO for log = device. So a bit more cleanup is in order. However, the big question there is not about how recent update the boot = files have. To read out the boot files, we need a bit of processing done = and to understand if those structures are consistent or not. But as I = wrote before, thats something to be investigated. rgds, toomas From owner-svn-src-all@freebsd.org Mon Nov 4 06:35:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F42D1B466E; Mon, 4 Nov 2019 06:35:49 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47632s0Rp0z421J; Mon, 4 Nov 2019 06:35:49 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E726820124; Mon, 4 Nov 2019 06:35:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA46ZmxB014861; Mon, 4 Nov 2019 06:35:48 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA46ZmZq014860; Mon, 4 Nov 2019 06:35:48 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911040635.xA46ZmZq014860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 4 Nov 2019 06:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354330 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 354330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 06:35:49 -0000 Author: tsoome Date: Mon Nov 4 06:35:48 2019 New Revision: 354330 URL: https://svnweb.freebsd.org/changeset/base/354330 Log: MFC r354237: loader: asprinf does crash arm64 due to missing NULL pointer check PCHAR macro needs to check if d is NULL. Modified: stable/12/stand/libsa/printf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/printf.c ============================================================================== --- stable/12/stand/libsa/printf.c Mon Nov 4 06:16:00 2019 (r354329) +++ stable/12/stand/libsa/printf.c Mon Nov 4 06:35:48 2019 (r354330) @@ -247,7 +247,17 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *len static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } +#define PCHAR(c) { \ + int cc = (c); \ + \ + if (func) { \ + (*func)(cc, arg); \ + } else if (d != NULL) { \ + *d++ = cc; \ + } \ + retval++; \ + } + char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; From owner-svn-src-all@freebsd.org Mon Nov 4 09:50:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07760179EE1; Mon, 4 Nov 2019 09:50:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4767Lw5ykgz4CYk; Mon, 4 Nov 2019 09:50:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB38D2232A; Mon, 4 Nov 2019 09:50:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA49o0jS029235; Mon, 4 Nov 2019 09:50:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA49nwG7029183; Mon, 4 Nov 2019 09:49:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911040949.xA49nwG7029183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 4 Nov 2019 09:49:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354331 - in stable/12: share/man/man4 share/man/man9 sys/amd64/conf sys/conf sys/dev/superio sys/i386/conf sys/modules sys/modules/superio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: share/man/man4 share/man/man9 sys/amd64/conf sys/conf sys/dev/superio sys/i386/conf sys/modules sys/modules/superio X-SVN-Commit-Revision: 354331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 09:50:01 -0000 Author: avg Date: Mon Nov 4 09:49:58 2019 New Revision: 354331 URL: https://svnweb.freebsd.org/changeset/base/354331 Log: MFC r349580,r351740,r353432,r353433,r354079,r354080: add superio driver The goal of this driver is consolidate information about SuperIO chips and to provide for peaceful coexistence of drivers that need to access SuperIO configuration registers. While SuperIO chips can host various functions most of them are discoverable and accessible without any knowledge of the SuperIO. Examples are: keyboard and mouse controllers, UARTs, floppy disk controllers. SuperIO-s also provide non-standard functions such as GPIO, watchdog timers and hardware monitoring. Such functions do require drivers with a knowledge of a specific SuperIO. At this time the driver supports a number of ITE and Nuvoton (fka Winbond) SuperIO chips. There is a single driver for all devices. So, I have not done the usual split between the hardware driver and the bus functionality. Although, superio does act as a bus for devices that represent known non-standard functions of a SuperIO chip. The bus provides enumeration of child devices based on the hardcoded knowledge of such functions. The knowledge as extracted from datasheets and other drivers. As there is a single driver, I have not defined a kobj interface for it. So, its interface is currently made of simple functions. I think that we can the flexibility (and complications) when we actually need it. Added: stable/12/share/man/man4/superio.4 - copied, changed from r353432, head/share/man/man4/superio.4 stable/12/share/man/man9/superio.9 - copied unchanged from r353432, head/share/man/man9/superio.9 stable/12/sys/dev/superio/ - copied from r349580, head/sys/dev/superio/ stable/12/sys/dev/superio/superio_io.h - copied, changed from r354079, head/sys/dev/superio/superio_io.h stable/12/sys/modules/superio/ - copied from r349580, head/sys/modules/superio/ Modified: stable/12/share/man/man4/Makefile stable/12/share/man/man9/Makefile stable/12/sys/amd64/conf/NOTES stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/dev/superio/superio.c stable/12/sys/dev/superio/superio.h stable/12/sys/i386/conf/NOTES stable/12/sys/modules/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/share/man/man4/Makefile Mon Nov 4 09:49:58 2019 (r354331) @@ -521,6 +521,7 @@ MAN= aac.4 \ stf.4 \ stg.4 \ stge.4 \ + ${_superio.4} \ sym.4 \ syncache.4 \ syncer.4 \ @@ -830,6 +831,7 @@ _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 +_superio.4= superio.4 _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 Copied and modified: stable/12/share/man/man4/superio.4 (from r353432, head/share/man/man4/superio.4) ============================================================================== --- head/share/man/man4/superio.4 Fri Oct 11 11:13:47 2019 (r353432, copy source) +++ stable/12/share/man/man4/superio.4 Mon Nov 4 09:49:58 2019 (r354331) @@ -74,7 +74,7 @@ that can only be accessed or discovered using the cont Some of the Super I/O devices have standardized interfaces. Such devices either use well-known legacy resources or they are advertised via ACPI or both. -They can be configured either using ISA bus hints or they are auto-aconfigured by +They can be configured either using ISA bus hints or they are auto-configured by .Xr acpi 4 . The .Nm Modified: stable/12/share/man/man9/Makefile ============================================================================== --- stable/12/share/man/man9/Makefile Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/share/man/man9/Makefile Mon Nov 4 09:49:58 2019 (r354331) @@ -301,6 +301,7 @@ MAN= accept_filter.9 \ store.9 \ style.9 \ style.lua.9 \ + ${_superio.9} \ swi.9 \ sx.9 \ syscall_helper_register.9 \ @@ -2295,5 +2296,24 @@ MLINKS+=zone.9 uma.9 \ zone.9 uma_zone_set_maxcache.9 \ zone.9 uma_zone_set_warning.9 \ zone.9 uma_zsecond_create.9 + +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +_superio.9= superio.9 +MLINKS+=superio.9 superio_devid.9 \ + superio.9 superio_dev_disable.9 \ + superio.9 superio_dev_enable.9 \ + superio.9 superio_dev_enabled.9 \ + superio.9 superio_find_dev.9 \ + superio.9 superio_find_dev.9 \ + superio.9 superio_get_dma.9 \ + superio.9 superio_get_iobase.9 \ + superio.9 superio_get_irq.9 \ + superio.9 superio_get_ldn.9 \ + superio.9 superio_get_type.9 \ + superio.9 superio_read.9 \ + superio.9 superio_revid.9 \ + superio.9 superio_vendor.9 \ + superio.9 superio_write.9 +.endif .include Copied: stable/12/share/man/man9/superio.9 (from r353432, head/share/man/man9/superio.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man9/superio.9 Mon Nov 4 09:49:58 2019 (r354331, copy of r353432, head/share/man/man9/superio.9) @@ -0,0 +1,189 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2019 Andriy Gapon +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 11, 2019 +.Dt SUPERIO 9 +.Os +.Sh NAME +.Nm superio , +.Nm superio_devid , +.Nm superio_dev_disable , +.Nm superio_dev_enable , +.Nm superio_dev_enabled , +.Nm superio_find_dev , +.Nm superio_get_dma , +.Nm superio_get_iobase , +.Nm superio_get_irq , +.Nm superio_get_ldn , +.Nm superio_get_type , +.Nm superio_read , +.Nm superio_revid , +.Nm superio_vendor , +.Nm superio_write +.Nd Super I/O bus interface +.Sh SYNOPSIS +.In sys/bus.h +.In dev/superio/superio.h +.Ft uint16_t +.Fn superio_devid "device_t dev" +.Ft void +.Fn superio_dev_disable "device_t dev" "uint8_t mask" +.Ft void +.Fn superio_dev_enable "device_t dev" "uint8_t mask" +.Ft bool +.Fn superio_dev_enabled "device_t dev" "uint8_t mask" +.Ft device_t +.Fn superio_find_dev "device_t dev" "superio_dev_type_t type" "int ldn" +.Ft uint8_t +.Fn superio_get_dma "device_t dev" +.Ft uint16_t +.Fn superio_get_iobase "device_t dev" +.Ft uint8_t +.Fn superio_get_irq "device_t dev" +.Ft uint8_t +.Fn superio_get_ldn "device_t dev" +.Ft superio_dev_type_t +.Fn superio_get_type "device_t dev" +.Ft uint8_t +.Fn superio_read "device_t dev" "uint8_t reg" +.Ft uint8_t +.Fn superio_revid "device_t dev" +.Ft superio_vendor_t +.Fn superio_vendor "device_t dev" +.Ft void +.Fn superio_write "device_t dev" "uint8_t reg" "uint8_t val" +.Sh DESCRIPTION +The +.Nm +set of functions are used for managing Super I/O devices. +The functions provide support for +raw configuration access, +locating devices, +device information, +and +device configuration. +.Ss The controller interface +The +.Fn superio_vendor +function is used to get a vendor of the Super I/O controller +.Fa dev . +Possible return values are +.Dv SUPERIO_VENDOR_ITE +and +.Dv SUPERIO_VENDOR_NUVOTON . +.Pp +The +.Fn superio_devid +function is used to get a device ID of the Super I/O controller +.Fa dev . +.Pp +The +.Fn superio_revid +function is used to get a revision ID of the Super I/O controller +.Fa dev . +.Pp +The +.Fn superio_find_dev +function is used to find a device on the +.Xr superio 4 +bus, specified by +.Fa dev , +that has the requested type and logical device number. +Either of those, but not both, can be a wildcard. +Supported types are +.Dv SUPERIO_DEV_GPIO , +.Dv SUPERIO_DEV_HWM , +and +.Dv SUPERIO_DEV_WDT . +The wildcard value for +.Fa type +is +.Dv SUPERIO_DEV_NONE . +The wildcard value for +.Fa ldn +is -1. +.Ss The device interface +The +.Fn superio_read +function is used to read data from the Super I/O configuration register +of the device +.Fa dev . +.Pp +The +.Fn superio_write +function is used to write data to the Super I/O configuration register +of the device +.Fa dev . +.Pp +The +.Fn superio_dev_enable , +.Fn superio_dev_disable , +and +.Fn superio_dev_enabled +functions are used to enable, disable, or check status of the device +.Fa dev . +The +.Fa mask +parameter selects sub-functions of a device that supports them. +For devices that do not have sub-functions, +.Fa mask +should be set to 1. +.Ss The accessor interface +The +.Fn superio_get_dma +is used to get a DMA channel number configured for the device +.Fa dev . +.Pp +The +.Fn superio_get_iobase +is used to get a base I/O port configured for the device +.Fa dev . +The device may expose additional or alternative configuration access via +the I/O ports. +.Pp +The +.Fn superio_get_irq +is used to get an interrupt number configured for the device +.Fa dev . +.Pp +The +.Fn superio_get_ldn +is used to get a Logical Device Number of the device +.Fa dev . +.Pp +The +.Fn superio_get_type +is used to get a type of the device +.Fa dev . +.Sh SEE ALSO +.Xr superio 4 , +.Xr device 9 , +.Xr driver 9 +.Sh AUTHORS +This manual page was written by +.An Andriy Gapon Mt avg@FreeBSD.org Modified: stable/12/sys/amd64/conf/NOTES ============================================================================== --- stable/12/sys/amd64/conf/NOTES Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/sys/amd64/conf/NOTES Mon Nov 4 09:49:58 2019 (r354331) @@ -594,6 +594,11 @@ device amdtemp device cpuctl # +# SuperIO driver. +# +device superio + +# # System Management Bus (SMB) # options ENABLE_ALART # Control alarm on Intel intpm driver Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/sys/conf/files.amd64 Mon Nov 4 09:49:58 2019 (r354331) @@ -491,6 +491,7 @@ dev/smartpqi/smartpqi_response.c optional smartpqi dev/smartpqi/smartpqi_sis.c optional smartpqi dev/smartpqi/smartpqi_tag.c optional smartpqi dev/speaker/spkr.c optional speaker +dev/superio/superio.c optional superio isa dev/syscons/apm/apm_saver.c optional apm_saver apm dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/sys/conf/files.i386 Mon Nov 4 09:49:58 2019 (r354331) @@ -318,6 +318,7 @@ dev/sio/sio_pccard.c optional sio pccard dev/sio/sio_pci.c optional sio pci dev/sio/sio_puc.c optional sio puc dev/speaker/spkr.c optional speaker +dev/superio/superio.c optional superio isa dev/syscons/apm/apm_saver.c optional apm_saver apm dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa Modified: stable/12/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Mon Jul 1 17:05:41 2019 (r349580) +++ stable/12/sys/dev/superio/superio.c Mon Nov 4 09:49:58 2019 (r354331) @@ -1,7 +1,8 @@ -/* - * Copyright (c) 2016 Andriy Gapon - * All rights reserved. +/*- + * SPDX-License-Identifier: BSD-2-Clause * + * Copyright (c) 2019 Andriy Gapon + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -11,7 +12,7 @@ * 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 + * 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 @@ -22,6 +23,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #include @@ -47,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "isa_if.h" @@ -81,6 +85,7 @@ struct siosc { struct mtx conf_lock; STAILQ_HEAD(, superio_devinfo) devlist; struct resource* io_res; + struct cdev *chardev; int io_rid; uint16_t io_port; const struct sio_conf_methods *methods; @@ -93,6 +98,14 @@ struct siosc { uint8_t enable_reg; }; +static d_ioctl_t superio_ioctl; + +static struct cdevsw superio_cdevsw = { + .d_version = D_VERSION, + .d_ioctl = superio_ioctl, + .d_name = "superio", +}; + #define NUMPORTS 2 static uint8_t @@ -617,6 +630,13 @@ superio_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); + + sc->chardev = make_dev(&superio_cdevsw, device_get_unit(dev), + UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev)); + if (sc->chardev == NULL) + device_printf(dev, "failed to create character device\n"); + else + sc->chardev->si_drv1 = sc; return (0); } @@ -629,6 +649,8 @@ superio_detach(device_t dev) error = bus_generic_detach(dev); if (error != 0) return (error); + if (sc->chardev != NULL) + destroy_dev(sc->chardev); device_delete_children(dev); bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); mtx_destroy(&sc->conf_lock); @@ -909,6 +931,31 @@ superio_find_dev(device_t superio, superio_dev_type_t return (dinfo->dev); } return (NULL); +} + +static int +superio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, + struct thread *td) +{ + struct siosc *sc; + struct superiocmd *s; + + sc = dev->si_drv1; + s = (struct superiocmd *)data; + switch (cmd) { + case SUPERIO_CR_READ: + sio_conf_enter(sc); + s->val = sio_ldn_read(sc, s->ldn, s->cr); + sio_conf_exit(sc); + return (0); + case SUPERIO_CR_WRITE: + sio_conf_enter(sc); + sio_ldn_write(sc, s->ldn, s->cr, s->val); + sio_conf_exit(sc); + return (0); + default: + return (ENOTTY); + } } static devclass_t superio_devclass; Modified: stable/12/sys/dev/superio/superio.h ============================================================================== --- head/sys/dev/superio/superio.h Mon Jul 1 17:05:41 2019 (r349580) +++ stable/12/sys/dev/superio/superio.h Mon Nov 4 09:49:58 2019 (r354331) @@ -1,6 +1,8 @@ -/* - * Copyright (c) 2016 Andriy Gapon +/*- + * SPDX-License-Identifier: BSD-2-Clause * + * Copyright (c) 2019 Andriy Gapon + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +12,7 @@ * 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 + * 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 Copied and modified: stable/12/sys/dev/superio/superio_io.h (from r354079, head/sys/dev/superio/superio_io.h) ============================================================================== --- head/sys/dev/superio/superio_io.h Fri Oct 25 16:07:24 2019 (r354079, copy source) +++ stable/12/sys/dev/superio/superio_io.h Mon Nov 4 09:49:58 2019 (r354331) @@ -1,4 +1,6 @@ -/* + /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2019 Andriy Gapon * * Redistribution and use in source and binary forms, with or without @@ -10,7 +12,7 @@ * 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 + * 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 Modified: stable/12/sys/i386/conf/NOTES ============================================================================== --- stable/12/sys/i386/conf/NOTES Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/sys/i386/conf/NOTES Mon Nov 4 09:49:58 2019 (r354331) @@ -878,6 +878,11 @@ device amdtemp device cpuctl # +# SuperIO driver. +# +device superio + +# # System Management Bus (SMB) # options ENABLE_ALART # Control alarm on Intel intpm driver Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Mon Nov 4 06:35:48 2019 (r354330) +++ stable/12/sys/modules/Makefile Mon Nov 4 09:49:58 2019 (r354331) @@ -368,6 +368,7 @@ SUBDIR= \ ste \ ${_stg} \ stge \ + ${_superio} \ ${_sym} \ ${_syscons} \ sysvipc \ @@ -716,6 +717,7 @@ _rdrand_rng= rdrand_rng .endif _s3= s3 _sdhci_acpi= sdhci_acpi +_superio= superio _tpm= tpm _twa= twa _vesa= vesa From owner-svn-src-all@freebsd.org Mon Nov 4 12:20:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7216617F4B2; Mon, 4 Nov 2019 12:20:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476BhN2VR3z4NRk; Mon, 4 Nov 2019 12:20:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3967323E5A; Mon, 4 Nov 2019 12:20:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4CKKub018090; Mon, 4 Nov 2019 12:20:20 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4CKJ65018088; Mon, 4 Nov 2019 12:20:19 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911041220.xA4CKJ65018088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 4 Nov 2019 12:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354332 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 354332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 12:20:20 -0000 Author: tsoome Date: Mon Nov 4 12:20:19 2019 New Revision: 354332 URL: https://svnweb.freebsd.org/changeset/base/354332 Log: loader: show APFS partition type name Add small visual aid in lsdev output. Modified: head/stand/common/part.c head/stand/common/part.h Modified: head/stand/common/part.c ============================================================================== --- head/stand/common/part.c Mon Nov 4 09:49:58 2019 (r354331) +++ head/stand/common/part.c Mon Nov 4 12:20:19 2019 (r354332) @@ -60,6 +60,7 @@ static const uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TY static const uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP; static const uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS; static const uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM; +static const uuid_t gpt_uuid_apple_apfs = GPT_ENT_TYPE_APPLE_APFS; #endif struct pentry { @@ -98,6 +99,7 @@ static struct parttypes { { PART_LINUX_SWAP, "Linux swap" }, { PART_DOS, "DOS/Windows" }, { PART_ISO9660, "ISO9660" }, + { PART_APFS, "APFS" }, }; const char * @@ -141,6 +143,8 @@ gpt_parttype(uuid_t type) return (PART_FREEBSD_VINUM); else if (uuid_equal(&type, &gpt_uuid_freebsd, NULL)) return (PART_FREEBSD); + else if (uuid_equal(&type, &gpt_uuid_apple_apfs, NULL)) + return (PART_APFS); return (PART_UNKNOWN); } Modified: head/stand/common/part.h ============================================================================== --- head/stand/common/part.h Mon Nov 4 09:49:58 2019 (r354331) +++ head/stand/common/part.h Mon Nov 4 12:20:19 2019 (r354332) @@ -52,7 +52,8 @@ enum partition_type { PART_LINUX, PART_LINUX_SWAP, PART_DOS, - PART_ISO9660 + PART_ISO9660, + PART_APFS }; struct ptable_entry { From owner-svn-src-all@freebsd.org Mon Nov 4 13:30:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 507541A22FF; Mon, 4 Nov 2019 13:30:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476DFW1W6tz3D1M; Mon, 4 Nov 2019 13:30:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 181B224AC4; Mon, 4 Nov 2019 13:30:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4DUciX059743; Mon, 4 Nov 2019 13:30:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4DUbnB059737; Mon, 4 Nov 2019 13:30:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911041330.xA4DUbnB059737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 4 Nov 2019 13:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354333 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 354333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 13:30:39 -0000 Author: avg Date: Mon Nov 4 13:30:37 2019 New Revision: 354333 URL: https://svnweb.freebsd.org/changeset/base/354333 Log: zfs: enable SPA_PROCESS on the kernel side The purpose of this change is to group kernelthreads specific to a particular ZFS pool under a kernel process. There can be many dozens of threads per pool. This change improves observability of those threads. This change consists of several subchanges: 1. illumos taskq_create_proc can now pass its process parameter to taskqueue. Also, use zfsproc instead of NULL for taskq_create. Caveat: zfsproc might not be initialized yet. But in that case it is still NULL, so not worse than before. 2. illumos sys/proc.h: kthread id is stored in t_did field, not t_tid. 3. zfs: enable SPA_PROCESS on the kernel side. The change is a bit hairy as newproc() is implemented privately to spa.c. I couldn't think of a better way to populate process name than to poke inside the argument for the process routine. 4. illumos thread_create: allow assigning thread to process other than zfsproc. 5. zfs: expose spa_proc to other users, assign sync and quiesce threads to it. Pool-specific threads created using (relatively new) zthr mechanism are still assigned to the zfskern process rather than to a respective zpool-xxx process. I am going to address this a bit later. Reviewed by: no one MFC after: 5 weeks Relnotes: perhaps Differential Revision: https://reviews.freebsd.org/D9720 Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Nov 4 13:30:37 2019 (r354333) @@ -62,9 +62,9 @@ system_taskq_fini(void *arg) } SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); -taskq_t * -taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, - int maxalloc __unused, uint_t flags) +static taskq_t * +taskq_create_impl(const char *name, int nthreads, pri_t pri, proc_t *proc, + uint_t flags) { taskq_t *tq; @@ -74,17 +74,24 @@ taskq_create(const char *name, int nthreads, pri_t pri tq = kmem_alloc(sizeof(*tq), KM_SLEEP); tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, &tq->tq_queue); - (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, "%s", name); + (void) taskqueue_start_threads_in_proc(&tq->tq_queue, nthreads, pri, + proc, "%s", name); return ((taskq_t *)tq); } taskq_t * -taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc, - int maxalloc, proc_t *proc __unused, uint_t flags) +taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, + int maxalloc __unused, uint_t flags) { + return (taskq_create_impl(name, nthreads, pri, zfsproc, flags)); +} - return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags)); +taskq_t * +taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc, + int maxalloc, proc_t *proc, uint_t flags) +{ + return (taskq_create_impl(name, nthreads, pri, proc, flags)); } void Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Mon Nov 4 13:30:37 2019 (r354333) @@ -47,12 +47,13 @@ #define maxclsyspri PVM #define max_ncpus (mp_maxid + 1) #define boot_max_ncpus (mp_maxid + 1) +#define syscid 1 #define TS_RUN 0 #define p0 proc0 -#define t_tid td_tid +#define t_did td_tid typedef short pri_t; typedef struct thread _kthread; @@ -67,6 +68,7 @@ do_thread_create(caddr_t stk, size_t stksize, void (*p size_t len, proc_t *pp, int state, pri_t pri) { kthread_t *td = NULL; + proc_t **ppp; int error; /* @@ -75,9 +77,13 @@ do_thread_create(caddr_t stk, size_t stksize, void (*p ASSERT(stk == NULL); ASSERT(len == 0); ASSERT(state == TS_RUN); - ASSERT(pp == &p0); + ASSERT(pp != NULL); - error = kproc_kthread_add(proc, arg, &zfsproc, &td, RFSTOPPED, + if (pp == &p0) + ppp = &zfsproc; + else + ppp = &pp; + error = kproc_kthread_add(proc, arg, ppp, &td, RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); if (error == 0) { thread_lock(td); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Nov 4 13:30:37 2019 (r354333) @@ -176,7 +176,11 @@ boolean_t zio_taskq_sysdc = B_TRUE; /* use SDC schedul uint_t zio_taskq_basedc = 80; /* base duty cycle */ #endif +#ifdef _KERNEL +#define SPA_PROCESS +#endif boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */ + extern int zfs_sync_pass_deferred_free; /* @@ -1090,23 +1094,49 @@ spa_create_zio_taskqs(spa_t *spa) } } -#ifdef _KERNEL #ifdef SPA_PROCESS +static int +newproc(void (*pc)(void *), void *arg, id_t cid, int pri, + void **ct, pid_t pid) +{ + va_list ap; + spa_t *spa = (spa_t *)arg; /* XXX */ + struct proc *newp; + struct thread *td; + int error; + + ASSERT(ct == NULL); + ASSERT(pid == 0); + ASSERT(cid == syscid); + + error = kproc_create(pc, arg, &newp, 0, 0, "zpool-%s", spa->spa_name); + if (error != 0) + return (error); + td = FIRST_THREAD_IN_PROC(newp); + thread_lock(td); + sched_prio(td, pri); + thread_unlock(td); + return (0); +} + static void spa_thread(void *arg) { callb_cpr_t cprinfo; spa_t *spa = arg; +#ifdef illumos user_t *pu = PTOU(curproc); - +#endif CALLB_CPR_INIT(&cprinfo, &spa->spa_proc_lock, callb_generic_cpr, spa->spa_name); ASSERT(curproc != &p0); +#ifdef illumos (void) snprintf(pu->u_psargs, sizeof (pu->u_psargs), "zpool-%s", spa->spa_name); (void) strlcpy(pu->u_comm, pu->u_psargs, sizeof (pu->u_comm)); +#endif #ifdef PSRSET_BIND /* bind this thread to the requested psrset */ @@ -1160,11 +1190,14 @@ spa_thread(void *arg) cv_broadcast(&spa->spa_proc_cv); CALLB_CPR_EXIT(&cprinfo); /* drops spa_proc_lock */ +#ifdef illumos mutex_enter(&curproc->p_lock); lwp_exit(); +#else + kthread_exit(); +#endif } #endif /* SPA_PROCESS */ -#endif /* * Activate an uninitialized pool. @@ -1211,7 +1244,9 @@ spa_activate(spa_t *spa, int mode) mutex_exit(&spa->spa_proc_lock); /* If we didn't create a process, we need to create our taskqs. */ +#ifndef SPA_PROCESS ASSERT(spa->spa_proc == &p0); +#endif /* SPA_PROCESS */ if (spa->spa_proc == &p0) { spa_create_zio_taskqs(spa); } @@ -1315,6 +1350,7 @@ spa_deactivate(spa_t *spa) mutex_exit(&spa->spa_proc_lock); #ifdef SPA_PROCESS +#ifdef illumos /* * We want to make sure spa_thread() has actually exited the ZFS * module, so that the module can't be unloaded out from underneath @@ -1324,6 +1360,7 @@ spa_deactivate(spa_t *spa) thread_join(spa->spa_did); spa->spa_did = 0; } +#endif #endif /* SPA_PROCESS */ } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Mon Nov 4 13:30:37 2019 (r354333) @@ -1935,6 +1935,12 @@ spa_deadman_synctime(spa_t *spa) return (spa->spa_deadman_synctime); } +struct proc * +spa_proc(spa_t *spa) +{ + return (spa->spa_proc); +} + uint64_t dva_get_dsize_sync(spa_t *spa, const dva_t *dva) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Mon Nov 4 13:30:37 2019 (r354333) @@ -833,6 +833,7 @@ extern uint64_t spa_bootfs(spa_t *spa); extern uint64_t spa_delegation(spa_t *spa); extern objset_t *spa_meta_objset(spa_t *spa); extern uint64_t spa_deadman_synctime(spa_t *spa); +extern struct proc *spa_proc(spa_t *spa); extern uint64_t spa_dirty_data(spa_t *spa); /* Miscellaneous support routines */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Mon Nov 4 12:20:19 2019 (r354332) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Mon Nov 4 13:30:37 2019 (r354333) @@ -209,7 +209,7 @@ txg_sync_start(dsl_pool_t *dp) tx->tx_threads = 2; tx->tx_quiesce_thread = thread_create(NULL, 0, txg_quiesce_thread, - dp, 0, &p0, TS_RUN, minclsyspri); + dp, 0, spa_proc(dp->dp_spa), TS_RUN, minclsyspri); /* * The sync thread can need a larger-than-default stack size on @@ -217,7 +217,7 @@ txg_sync_start(dsl_pool_t *dp) * scrub_visitbp() recursion. */ tx->tx_sync_thread = thread_create(NULL, 32<<10, txg_sync_thread, - dp, 0, &p0, TS_RUN, minclsyspri); + dp, 0, spa_proc(dp->dp_spa), TS_RUN, minclsyspri); mutex_exit(&tx->tx_sync_lock); } From owner-svn-src-all@freebsd.org Mon Nov 4 13:46:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03B361A2D7D; Mon, 4 Nov 2019 13:46:22 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476Dbd69N7z3FJj; Mon, 4 Nov 2019 13:46:21 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AECD824E91; Mon, 4 Nov 2019 13:46:21 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4DkLLA071398; Mon, 4 Nov 2019 13:46:21 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4DkLru071397; Mon, 4 Nov 2019 13:46:21 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201911041346.xA4DkLru071397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 4 Nov 2019 13:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354334 - head X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 13:46:22 -0000 Author: cy Date: Mon Nov 4 13:46:21 2019 New Revision: 354334 URL: https://svnweb.freebsd.org/changeset/base/354334 Log: Document contrib updates: r354269: sqlite3 is updated to sqlite3-3.30.1. r351397: WPA is updated from 2.8 to 2.9. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Mon Nov 4 13:30:37 2019 (r354333) +++ head/RELNOTES Mon Nov 4 13:46:21 2019 (r354334) @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r354269: + sqlite3 is updated to sqlite3-3.30.1. + r352668: cron(8) now supports the -n (suppress mail on succesful run) and -q (suppress logging of command execution) options in the crontab format. @@ -23,6 +26,9 @@ r351522: Add kernel-side support for in-kernel Transport Layer Security (KTLS). KTLS permits using sendfile(2) over sockets using TLS. + +r351397: + WPA is updated from 2.8 to 2.9. r351361: Add probes for lockmgr(9) to the lockstat DTrace provider, add From owner-svn-src-all@freebsd.org Mon Nov 4 14:19:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94B201A3DFF; Mon, 4 Nov 2019 14:19:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476FKV2439z3Hhm; Mon, 4 Nov 2019 14:19:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 272B5253FF; Mon, 4 Nov 2019 14:19:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4EJ9Zb089334; Mon, 4 Nov 2019 14:19:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4EJ9Xe089331; Mon, 4 Nov 2019 14:19:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911041419.xA4EJ9Xe089331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 4 Nov 2019 14:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354335 - in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 354335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 14:19:10 -0000 Author: hselasky Date: Mon Nov 4 14:19:09 2019 New Revision: 354335 URL: https://svnweb.freebsd.org/changeset/base/354335 Log: Enable device class group attributes in the LinuxKPI. Bump the __FreeBSD_version to force recompilation of external kernel modules due to structure change. Differential Revision: https://reviews.freebsd.org/D21564 Submitted by: Greg V MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/device.h head/sys/compat/linuxkpi/common/include/linux/sysfs.h head/sys/sys/param.h Modified: head/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 4 13:46:21 2019 (r354334) +++ head/sys/compat/linuxkpi/common/include/linux/device.h Mon Nov 4 14:19:09 2019 (r354335) @@ -54,6 +54,7 @@ struct class { struct kobject kobj; devclass_t bsdclass; const struct dev_pm_ops *pm; + const struct attribute_group **dev_groups; void (*class_release)(struct class *class); void (*dev_release)(struct device *dev); char * (*devnode)(struct device *dev, umode_t *mode); @@ -424,6 +425,8 @@ done: kobject_init(&dev->kobj, &linux_dev_ktype); kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); + sysfs_create_groups(&dev->kobj, dev->class->dev_groups); + return (0); } @@ -431,6 +434,8 @@ static inline void device_unregister(struct device *dev) { device_t bsddev; + + sysfs_remove_groups(&dev->kobj, dev->class->dev_groups); bsddev = dev->bsddev; dev->bsddev = NULL; Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 4 13:46:21 2019 (r354334) +++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Nov 4 14:19:09 2019 (r354335) @@ -62,12 +62,13 @@ struct attribute_group { #define ATTRIBUTE_GROUPS(_name) \ static struct attribute_group _name##_group = { \ + .name = __stringify(_name), \ .attrs = _name##_attrs, \ }; \ - static struct attribute_group *_name##_groups[] = { \ + static const struct attribute_group *_name##_groups[] = { \ &_name##_group, \ NULL, \ - }; + } /* * Handle our generic '\0' terminated 'C' string. @@ -210,12 +211,25 @@ sysfs_create_groups(struct kobject *kobj, const struct int error = 0; int i; + if (grps == NULL) + goto done; for (i = 0; grps[i] && !error; i++) error = sysfs_create_group(kobj, grps[i]); while (error && --i >= 0) sysfs_remove_group(kobj, grps[i]); - +done: return (error); +} + +static inline void +sysfs_remove_groups(struct kobject *kobj, const struct attribute_group **grps) +{ + int i; + + if (grps == NULL) + return; + for (i = 0; grps[i]; i++) + sysfs_remove_group(kobj, grps[i]); } static inline int Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Nov 4 13:46:21 2019 (r354334) +++ head/sys/sys/param.h Mon Nov 4 14:19:09 2019 (r354335) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300054 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300055 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Nov 4 17:35:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9121A1AA0E9; Mon, 4 Nov 2019 17:35:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476KhB3LmXz46WZ; Mon, 4 Nov 2019 17:35:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 523ED2784D; Mon, 4 Nov 2019 17:35:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4HZcmm017385; Mon, 4 Nov 2019 17:35:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4HZcM6017384; Mon, 4 Nov 2019 17:35:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911041735.xA4HZcM6017384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 4 Nov 2019 17:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354336 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 17:35:38 -0000 Author: glebius Date: Mon Nov 4 17:35:37 2019 New Revision: 354336 URL: https://svnweb.freebsd.org/changeset/base/354336 Log: In nd6_timer() enter the network epoch earlier. The defrouter_del() may call into leaf functions that require epoch. Since the function is already run in non-sleepable context, it should be safe to cover it whole with epoch. Reported by: syzcaller Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Mon Nov 4 14:19:09 2019 (r354335) +++ head/sys/netinet6/nd6.c Mon Nov 4 17:35:37 2019 (r354336) @@ -918,6 +918,7 @@ nd6_timer(void *arg) defrouter_unlink(dr, &drq); ND6_WUNLOCK(); + NET_EPOCH_ENTER(et); while ((dr = TAILQ_FIRST(&drq)) != NULL) { TAILQ_REMOVE(&drq, dr, dr_entry); defrouter_del(dr); @@ -931,7 +932,6 @@ nd6_timer(void *arg) * * XXXRW: in6_ifaddrhead locking. */ - NET_EPOCH_ENTER(et); addrloop: CK_STAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { /* check address lifetime */ From owner-svn-src-all@freebsd.org Mon Nov 4 18:34:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BA561AB424; Mon, 4 Nov 2019 18:34:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476M061lf1z493x; Mon, 4 Nov 2019 18:34:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05232373; Mon, 4 Nov 2019 18:34:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4IYTF9052669; Mon, 4 Nov 2019 18:34:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4IYTYZ052668; Mon, 4 Nov 2019 18:34:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201911041834.xA4IYTYZ052668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 4 Nov 2019 18:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org Subject: svn commit: r354337 - release/12.1.0 X-SVN-Group: release X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: release/12.1.0 X-SVN-Commit-Revision: 354337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 18:34:30 -0000 Author: gjb Date: Mon Nov 4 18:34:29 2019 New Revision: 354337 URL: https://svnweb.freebsd.org/changeset/base/354337 Log: Tag releng/12.1@r354233 as release/12.1.0 (12.1-RELEASE). Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (netgate.com) Added: release/12.1.0/ - copied from r354233, releng/12.1/ From owner-svn-src-all@freebsd.org Mon Nov 4 19:30:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AFE11ADDE0; Mon, 4 Nov 2019 19:30:20 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476NDW6R5gz4F81; Mon, 4 Nov 2019 19:30:19 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB9A5D08; Mon, 4 Nov 2019 19:30:19 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4JUJPU083720; Mon, 4 Nov 2019 19:30:19 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4JUJCI083719; Mon, 4 Nov 2019 19:30:19 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201911041930.xA4JUJCI083719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 4 Nov 2019 19:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354338 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 19:30:20 -0000 Author: gallatin Date: Mon Nov 4 19:30:19 2019 New Revision: 354338 URL: https://svnweb.freebsd.org/changeset/base/354338 Log: Add tunable to allow interrupts on hyperthreaded cores Enabling interrupts on htt cores has benefits to workloads which are primarily interrupt driven by increasing the logical cores available for interrupt handling. The tunable is named machdep.hyperthreading_intr_allowed Reviewed by: kib, jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22233 Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Nov 4 18:34:29 2019 (r354337) +++ head/sys/x86/x86/mp_x86.c Mon Nov 4 19:30:19 2019 (r354338) @@ -144,6 +144,11 @@ static int hyperthreading_allowed = 1; SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_allowed, CTLFLAG_RDTUN, &hyperthreading_allowed, 0, "Use Intel HTT logical CPUs"); +static int hyperthreading_intr_allowed = 0; +SYSCTL_INT(_machdep, OID_AUTO, hyperthreading_intr_allowed, CTLFLAG_RDTUN, + &hyperthreading_intr_allowed, 0, + "Allow interrupts on HTT logical CPUs"); + static struct topo_node topo_root; static int pkg_id_shift; @@ -1121,7 +1126,8 @@ set_interrupt_apic_ids(void) continue; /* Don't let hyperthreads service interrupts. */ - if (cpu_info[apic_id].cpu_hyperthread) + if (cpu_info[apic_id].cpu_hyperthread && + !hyperthreading_intr_allowed) continue; intr_add_cpu(i); From owner-svn-src-all@freebsd.org Mon Nov 4 19:38:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 637321AE457; Mon, 4 Nov 2019 19:38:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476NPX1y6pz4Fpq; Mon, 4 Nov 2019 19:38:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C421F02; Mon, 4 Nov 2019 19:38:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4Jc7db089236; Mon, 4 Nov 2019 19:38:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4Jc7G5089235; Mon, 4 Nov 2019 19:38:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911041938.xA4Jc7G5089235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 4 Nov 2019 19:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354339 - head/contrib/llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 354339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 19:38:08 -0000 Author: dim Date: Mon Nov 4 19:38:07 2019 New Revision: 354339 URL: https://svnweb.freebsd.org/changeset/base/354339 Log: Merge commit 97e362607 from llvm git (by Nemanja Ivanovic): [PowerPC] Do not emit HW loop if the body contains calls to lrint/lround These two intrinsics are lowered to calls so should prevent the formation of CTR loops. In a subsequent patch, we will handle all currently known intrinsics and prevent the formation of HW loops if any unknown intrinsics are encountered. Differential revision: https://reviews.llvm.org/D68841 This should fix an "invalid CRT loop" assertion when building the www/node port for powerpc64. Requested by: Alfredo Dal'Ava Júnior MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp Modified: head/contrib/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp Mon Nov 4 19:30:19 2019 (r354338) +++ head/contrib/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp Mon Nov 4 19:38:07 2019 (r354339) @@ -331,8 +331,12 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, case Intrinsic::ceil: Opcode = ISD::FCEIL; break; case Intrinsic::trunc: Opcode = ISD::FTRUNC; break; case Intrinsic::rint: Opcode = ISD::FRINT; break; + case Intrinsic::lrint: Opcode = ISD::LRINT; break; + case Intrinsic::llrint: Opcode = ISD::LLRINT; break; case Intrinsic::nearbyint: Opcode = ISD::FNEARBYINT; break; case Intrinsic::round: Opcode = ISD::FROUND; break; + case Intrinsic::lround: Opcode = ISD::LROUND; break; + case Intrinsic::llround: Opcode = ISD::LLROUND; break; case Intrinsic::minnum: Opcode = ISD::FMINNUM; break; case Intrinsic::maxnum: Opcode = ISD::FMAXNUM; break; case Intrinsic::umul_with_overflow: Opcode = ISD::UMULO; break; From owner-svn-src-all@freebsd.org Mon Nov 4 21:06:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81BE81B0446; Mon, 4 Nov 2019 21:06:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476QM32t4Bz4LJn; Mon, 4 Nov 2019 21:06:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42E791F1A; Mon, 4 Nov 2019 21:06:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4L67Fo044664; Mon, 4 Nov 2019 21:06:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4L67pP044663; Mon, 4 Nov 2019 21:06:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911042106.xA4L67pP044663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 4 Nov 2019 21:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354340 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 354340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 21:06:07 -0000 Author: brooks Date: Mon Nov 4 21:06:06 2019 New Revision: 354340 URL: https://svnweb.freebsd.org/changeset/base/354340 Log: Remove an outdated assertion. The exclusive lock assertion became incorrect due to changes in lock scope in r354155. Discussed with: jeffr Sponsored by: DARPA, AFRL Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Nov 4 19:38:07 2019 (r354339) +++ head/sys/mips/mips/pmap.c Mon Nov 4 21:06:06 2019 (r354340) @@ -3093,7 +3093,6 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_ASSERT_WLOCKED(m->object); vm_page_assert_busied(m); if (!pmap_page_is_write_mapped(m)) From owner-svn-src-all@freebsd.org Mon Nov 4 21:23:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0609B1B0ADF; Mon, 4 Nov 2019 21:23:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476Ql65P1Zz4MT4; Mon, 4 Nov 2019 21:23:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C2C222B9; Mon, 4 Nov 2019 21:23:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4LNU4S058921; Mon, 4 Nov 2019 21:23:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4LNU0f058920; Mon, 4 Nov 2019 21:23:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911042123.xA4LNU0f058920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 4 Nov 2019 21:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354341 - head/sys/arm64/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm64/linux X-SVN-Commit-Revision: 354341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 21:23:31 -0000 Author: emaste Date: Mon Nov 4 21:23:30 2019 New Revision: 354341 URL: https://svnweb.freebsd.org/changeset/base/354341 Log: arm64 linuxulator: default to RW stack (no X) This matches Linux's default arm64 data / stack permissions. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/linux/linux_sysvec.c Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Mon Nov 4 21:06:06 2019 (r354340) +++ head/sys/arm64/linux/linux_sysvec.c Mon Nov 4 21:23:30 2019 (r354341) @@ -371,7 +371,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, /* XXX */ - .sv_stackprot = VM_PROT_ALL, /* XXX */ + .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = linux_copyout_strings, .sv_setregs = linux_exec_setregs, .sv_fixlimit = NULL, From owner-svn-src-all@freebsd.org Mon Nov 4 22:52:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 546291B2BCC; Mon, 4 Nov 2019 22:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476SjH1c2qz4S2D; Mon, 4 Nov 2019 22:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AD6D331E; Mon, 4 Nov 2019 22:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4Mq2Pu012803; Mon, 4 Nov 2019 22:52:02 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4Mq2HF012802; Mon, 4 Nov 2019 22:52:02 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911042252.xA4Mq2HF012802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 4 Nov 2019 22:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354342 - head/lib/libpmc/pmu-events X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/libpmc/pmu-events X-SVN-Commit-Revision: 354342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 22:52:03 -0000 Author: emaste Date: Mon Nov 4 22:52:02 2019 New Revision: 354342 URL: https://svnweb.freebsd.org/changeset/base/354342 Log: libpmc: jevents: handle empty descriptoin PR: 241258 Reported by: sigsys @ gmail.com Obtained from: github.com/andikleen/pmu-tools commit bb3c77ed61 MFC after: 3 days Modified: head/lib/libpmc/pmu-events/jevents.c Modified: head/lib/libpmc/pmu-events/jevents.c ============================================================================== --- head/lib/libpmc/pmu-events/jevents.c Mon Nov 4 21:23:30 2019 (r354341) +++ head/lib/libpmc/pmu-events/jevents.c Mon Nov 4 22:52:02 2019 (r354342) @@ -122,7 +122,7 @@ static void fixdesc(char *s) --e; while (e >= s && isspace(*e)) --e; - if (*e == '.') + if (e >= s && *e == '.') *e = 0; } From owner-svn-src-all@freebsd.org Mon Nov 4 22:57:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B925D1B2FCF; Mon, 4 Nov 2019 22:57:39 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476Sql4WMxz4STK; Mon, 4 Nov 2019 22:57:39 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E4B33372; Mon, 4 Nov 2019 22:57:39 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4MvdHn016311; Mon, 4 Nov 2019 22:57:39 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4MvaBV016297; Mon, 4 Nov 2019 22:57:36 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201911042257.xA4MvaBV016297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 4 Nov 2019 22:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354343 - in head/sys/dev: e1000 oce X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head/sys/dev: e1000 oce X-SVN-Commit-Revision: 354343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 22:57:39 -0000 Author: erj Date: Mon Nov 4 22:57:36 2019 New Revision: 354343 URL: https://svnweb.freebsd.org/changeset/base/354343 Log: net: prefer ETHER_ADDR_LEN over ETH_ADDR_LEN A couple of drivers and one place in if.c use ETH_ADDR_LEN, even though net/ethernet.h provides an equivalent ETHER_ADDR_LEN definition. Cleanup all of the locations which refer to ETH_ADDR_LEN to use the standard ETHER_ADDR_LEN instead. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: erj@, jpaetzel@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21239 Modified: head/sys/dev/e1000/e1000_82540.c head/sys/dev/e1000/e1000_82541.c head/sys/dev/e1000/e1000_82542.c head/sys/dev/e1000/e1000_82543.c head/sys/dev/e1000/e1000_defines.h head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_nvm.c head/sys/dev/e1000/e1000_vf.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/oce/oce_hw.c head/sys/dev/oce/oce_if.h Modified: head/sys/dev/e1000/e1000_82540.c ============================================================================== --- head/sys/dev/e1000/e1000_82540.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_82540.c Mon Nov 4 22:57:36 2019 (r354343) @@ -696,7 +696,7 @@ s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) DEBUGFUNC("e1000_read_mac_addr"); - for (i = 0; i < ETH_ADDR_LEN; i += 2) { + for (i = 0; i < ETHER_ADDR_LEN; i += 2) { offset = i >> 1; ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { @@ -711,7 +711,7 @@ s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) if (hw->bus.func == E1000_FUNC_1) hw->mac.perm_addr[5] ^= 1; - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; out: Modified: head/sys/dev/e1000/e1000_82541.c ============================================================================== --- head/sys/dev/e1000/e1000_82541.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_82541.c Mon Nov 4 22:57:36 2019 (r354343) @@ -1285,7 +1285,7 @@ static s32 e1000_read_mac_addr_82541(struct e1000_hw * DEBUGFUNC("e1000_read_mac_addr"); - for (i = 0; i < ETH_ADDR_LEN; i += 2) { + for (i = 0; i < ETHER_ADDR_LEN; i += 2) { offset = i >> 1; ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { @@ -1296,7 +1296,7 @@ static s32 e1000_read_mac_addr_82541(struct e1000_hw * hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); } - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; out: Modified: head/sys/dev/e1000/e1000_82542.c ============================================================================== --- head/sys/dev/e1000/e1000_82542.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_82542.c Mon Nov 4 22:57:36 2019 (r354343) @@ -573,7 +573,7 @@ s32 e1000_read_mac_addr_82542(struct e1000_hw *hw) DEBUGFUNC("e1000_read_mac_addr"); - for (i = 0; i < ETH_ADDR_LEN; i += 2) { + for (i = 0; i < ETHER_ADDR_LEN; i += 2) { offset = i >> 1; ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { @@ -584,7 +584,7 @@ s32 e1000_read_mac_addr_82542(struct e1000_hw *hw) hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); } - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; out: Modified: head/sys/dev/e1000/e1000_82543.c ============================================================================== --- head/sys/dev/e1000/e1000_82543.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_82543.c Mon Nov 4 22:57:36 2019 (r354343) @@ -1574,7 +1574,7 @@ s32 e1000_read_mac_addr_82543(struct e1000_hw *hw) DEBUGFUNC("e1000_read_mac_addr"); - for (i = 0; i < ETH_ADDR_LEN; i += 2) { + for (i = 0; i < ETHER_ADDR_LEN; i += 2) { offset = i >> 1; ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { @@ -1589,7 +1589,7 @@ s32 e1000_read_mac_addr_82543(struct e1000_hw *hw) if (hw->bus.func == E1000_FUNC_1) hw->mac.perm_addr[5] ^= 1; - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; out: Modified: head/sys/dev/e1000/e1000_defines.h ============================================================================== --- head/sys/dev/e1000/e1000_defines.h Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_defines.h Mon Nov 4 22:57:36 2019 (r354343) @@ -1206,10 +1206,6 @@ #define PCIE_LINK_SPEED_5000 0x02 #define PCIE_DEVICE_CONTROL2_16ms 0x0005 -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif - #define PHY_REVISION_MASK 0xFFFFFFF0 #define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ #define MAX_PHY_MULTI_PAGE_REG 0xF Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_hw.h Mon Nov 4 22:57:36 2019 (r354343) @@ -785,8 +785,8 @@ struct e1000_nvm_operations { struct e1000_mac_info { struct e1000_mac_operations ops; - u8 addr[ETH_ADDR_LEN]; - u8 perm_addr[ETH_ADDR_LEN]; + u8 addr[ETHER_ADDR_LEN]; + u8 perm_addr[ETHER_ADDR_LEN]; enum e1000_mac_type type; Modified: head/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- head/sys/dev/e1000/e1000_ich8lan.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_ich8lan.c Mon Nov 4 22:57:36 2019 (r354343) @@ -2780,7 +2780,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw * SHRAL/H) and initial CRC values to the MAC */ for (i = 0; i < hw->mac.rar_entry_count; i++) { - u8 mac_addr[ETH_ADDR_LEN] = {0}; + u8 mac_addr[ETHER_ADDR_LEN] = {0}; u32 addr_high, addr_low; addr_high = E1000_READ_REG(hw, E1000_RAH(i)); Modified: head/sys/dev/e1000/e1000_mac.c ============================================================================== --- head/sys/dev/e1000/e1000_mac.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_mac.c Mon Nov 4 22:57:36 2019 (r354343) @@ -371,7 +371,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) { u32 i; - u8 mac_addr[ETH_ADDR_LEN] = {0}; + u8 mac_addr[ETHER_ADDR_LEN] = {0}; DEBUGFUNC("e1000_init_rx_addrs_generic"); @@ -403,7 +403,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw * u32 i; s32 ret_val; u16 offset, nvm_alt_mac_addr_offset, nvm_data; - u8 alt_mac_addr[ETH_ADDR_LEN]; + u8 alt_mac_addr[ETHER_ADDR_LEN]; DEBUGFUNC("e1000_check_alt_mac_addr_generic"); @@ -440,7 +440,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw * if (hw->bus.func == E1000_FUNC_3) nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN3; - for (i = 0; i < ETH_ADDR_LEN; i += 2) { + for (i = 0; i < ETHER_ADDR_LEN; i += 2) { offset = nvm_alt_mac_addr_offset + (i >> 1); ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { @@ -604,7 +604,7 @@ void e1000_update_mc_addr_list_generic(struct e1000_hw hash_bit = hash_value & 0x1F; hw->mac.mta_shadow[hash_reg] |= (1 << hash_bit); - mc_addr_list += (ETH_ADDR_LEN); + mc_addr_list += (ETHER_ADDR_LEN); } /* replace the entire MTA table */ Modified: head/sys/dev/e1000/e1000_nvm.c ============================================================================== --- head/sys/dev/e1000/e1000_nvm.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_nvm.c Mon Nov 4 22:57:36 2019 (r354343) @@ -1143,7 +1143,7 @@ s32 e1000_read_mac_addr_generic(struct e1000_hw *hw) for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++) hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8)); - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; return E1000_SUCCESS; Modified: head/sys/dev/e1000/e1000_vf.c ============================================================================== --- head/sys/dev/e1000/e1000_vf.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/e1000_vf.c Mon Nov 4 22:57:36 2019 (r354343) @@ -431,7 +431,7 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, hash_value = e1000_hash_mc_addr_vf(hw, mc_addr_list); DEBUGOUT1("Hash value = 0x%03X\n", hash_value); hash_list[i] = hash_value & 0x0FFF; - mc_addr_list += ETH_ADDR_LEN; + mc_addr_list += ETHER_ADDR_LEN; } e1000_write_msg_read_ack(hw, msgbuf, E1000_VFMAILBOX_SIZE); @@ -517,7 +517,7 @@ static s32 e1000_read_mac_addr_vf(struct e1000_hw *hw) { int i; - for (i = 0; i < ETH_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; return E1000_SUCCESS; Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/if_em.c Mon Nov 4 22:57:36 2019 (r354343) @@ -1002,7 +1002,7 @@ em_if_attach_pre(if_ctx_t ctx) hw->mac.report_tx_early = 1; /* Allocate multicast array memory. */ - adapter->mta = malloc(sizeof(u8) * ETH_ADDR_LEN * + adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); if (adapter->mta == NULL) { device_printf(dev, "Can not allocate multicast setup array\n"); @@ -1672,7 +1672,7 @@ em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_in if (cnt == MAX_NUM_MULTICAST_ADDRESSES) return (1); - bcopy(LLADDR(sdl), &mta[cnt * ETH_ADDR_LEN], ETH_ADDR_LEN); + bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); return (1); } @@ -1696,7 +1696,7 @@ em_if_multi_set(if_ctx_t ctx) IOCTL_DEBUGOUT("em_set_multi: begin"); mta = adapter->mta; - bzero(mta, sizeof(u8) * ETH_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); + bzero(mta, sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES); if (adapter->hw.mac.type == e1000_82542 && adapter->hw.revision_id == E1000_REVISION_2) { Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/e1000/if_em.h Mon Nov 4 22:57:36 2019 (r354343) @@ -340,7 +340,6 @@ #define EM_MSIX_MASK 0x01F00000 /* For 82574 use */ #define EM_MSIX_LINK 0x01000000 /* For 82574 use */ #define ETH_ZLEN 60 -#define ETH_ADDR_LEN 6 #define EM_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */ #define IGB_CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | \ CSUM_IP_SCTP | CSUM_IP6_UDP | CSUM_IP6_TCP | \ Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/oce/oce_hw.c Mon Nov 4 22:57:36 2019 (r354343) @@ -553,7 +553,7 @@ oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_i return (0); bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++], - ETH_ADDR_LEN); + ETHER_ADDR_LEN); return (1); } Modified: head/sys/dev/oce/oce_if.h ============================================================================== --- head/sys/dev/oce/oce_if.h Mon Nov 4 22:52:02 2019 (r354342) +++ head/sys/dev/oce/oce_if.h Mon Nov 4 22:57:36 2019 (r354343) @@ -200,7 +200,6 @@ extern int mp_ncpus; /* system's total active cpu co #define OCE_IF_CAPABILITIES_NONE 0 -#define ETH_ADDR_LEN 6 #define MAX_VLANFILTER_SIZE 64 #define MAX_VLANS 4096 From owner-svn-src-all@freebsd.org Mon Nov 4 23:06:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2AA91B338A; Mon, 4 Nov 2019 23:06:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476T2T680Bz4T2n; Mon, 4 Nov 2019 23:06:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1D6C371B; Mon, 4 Nov 2019 23:06:57 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA4N6vAM021926; Mon, 4 Nov 2019 23:06:57 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA4N6vFa021925; Mon, 4 Nov 2019 23:06:57 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201911042306.xA4N6vFa021925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 4 Nov 2019 23:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354344 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2019 23:06:58 -0000 Author: erj Date: Mon Nov 4 23:06:57 2019 New Revision: 354344 URL: https://svnweb.freebsd.org/changeset/base/354344 Log: iflib: properly release memory allocated for DMA DMA memory allocations using the bus_dma.h interface are not properly released in all cases for both Tx and Rx. This causes ~448 bytes of M_DEVBUF allocations to be leaked. First, the DMA maps for Rx are not properly destroyed. A slight attempt is made in iflib_fl_bufs_free to destroy the maps if we're detaching. However, this function may not be reliably called during detach. Indeed, there is a comment "asking" if this should be moved out. Fix this by moving the bus_dmamap_destroy call into iflib_rx_sds_free, where we already sync and unload the DMA. Second, the DMA tag associated with the ifr_ifdi descriptor DMA is not released properly anywhere. Add a call to iflib_dma_free in iflib_rx_structures_free. Third, use of NULL as a canary value on the map pointer returned by bus_dmamap_create is not valid. On some platforms, notably x86, this value may be NULL. In this case, we fail to properly release the related resources. Remove the NULL checks on map values in both iflib_fl_bufs_free and iflib_txsd_destroy. With all of these fixes applied, the leaks to M_DEVBUF are squelched, and iflib drivers now seem to properly cleanup when detaching. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: erj@, gallatin@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22203 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Mon Nov 4 22:57:36 2019 (r354343) +++ head/sys/net/iflib.c Mon Nov 4 23:06:57 2019 (r354344) @@ -1696,20 +1696,16 @@ iflib_txsd_destroy(if_ctx_t ctx, iflib_txq_t txq, int { bus_dmamap_t map; - map = NULL; - if (txq->ift_sds.ifsd_map != NULL) + if (txq->ift_sds.ifsd_map != NULL) { map = txq->ift_sds.ifsd_map[i]; - if (map != NULL) { bus_dmamap_sync(txq->ift_buf_tag, map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(txq->ift_buf_tag, map); bus_dmamap_destroy(txq->ift_buf_tag, map); txq->ift_sds.ifsd_map[i] = NULL; } - map = NULL; - if (txq->ift_sds.ifsd_tso_map != NULL) + if (txq->ift_sds.ifsd_tso_map != NULL) { map = txq->ift_sds.ifsd_tso_map[i]; - if (map != NULL) { bus_dmamap_sync(txq->ift_tso_buf_tag, map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(txq->ift_tso_buf_tag, map); @@ -2120,9 +2116,6 @@ iflib_fl_bufs_free(iflib_fl_t fl) bus_dmamap_unload(fl->ifl_buf_tag, sd_map); if (*sd_cl != NULL) uma_zfree(fl->ifl_zone, *sd_cl); - // XXX: Should this get moved out? - if (iflib_in_detach(fl->ifl_rxq->ifr_ctx)) - bus_dmamap_destroy(fl->ifl_buf_tag, sd_map); if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); uma_zfree(zone_mbuf, *sd_m); @@ -2210,9 +2203,6 @@ iflib_rx_sds_free(iflib_rxq_t rxq) if (fl->ifl_buf_tag != NULL) { if (fl->ifl_sds.ifsd_map != NULL) { for (j = 0; j < fl->ifl_size; j++) { - if (fl->ifl_sds.ifsd_map[j] == - NULL) - continue; bus_dmamap_sync( fl->ifl_buf_tag, fl->ifl_sds.ifsd_map[j], @@ -2220,6 +2210,9 @@ iflib_rx_sds_free(iflib_rxq_t rxq) bus_dmamap_unload( fl->ifl_buf_tag, fl->ifl_sds.ifsd_map[j]); + bus_dmamap_destroy( + fl->ifl_buf_tag, + fl->ifl_sds.ifsd_map[j]); } } bus_dma_tag_destroy(fl->ifl_buf_tag); @@ -5735,9 +5728,12 @@ static void iflib_rx_structures_free(if_ctx_t ctx) { iflib_rxq_t rxq = ctx->ifc_rxqs; - int i; + if_shared_ctx_t sctx = ctx->ifc_sctx; + int i, j; for (i = 0; i < ctx->ifc_softc_ctx.isc_nrxqsets; i++, rxq++) { + for (j = 0; j < sctx->isc_nrxqs; j++) + iflib_dma_free(&rxq->ifr_ifdi[j]); iflib_rx_sds_free(rxq); #if defined(INET6) || defined(INET) if (if_getcapabilities(ctx->ifc_ifp) & IFCAP_LRO) From owner-svn-src-all@freebsd.org Tue Nov 5 00:12:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C65A11B4D17; Tue, 5 Nov 2019 00:12:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476VTy4ZZWz4X7X; Tue, 5 Nov 2019 00:12:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8073F4492; Tue, 5 Nov 2019 00:12:22 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA50CM44063398; Tue, 5 Nov 2019 00:12:22 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA50CLst063394; Tue, 5 Nov 2019 00:12:21 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201911050012.xA50CLst063394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 5 Nov 2019 00:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354345 - in head/sys: dev/usb/net net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head/sys: dev/usb/net net X-SVN-Commit-Revision: 354345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 00:12:22 -0000 Author: erj Date: Tue Nov 5 00:12:21 2019 New Revision: 354345 URL: https://svnweb.freebsd.org/changeset/base/354345 Log: net: add ETHER_IS_ZERO macro similar to ETHER_IS_BROADCAST Some places in network code may need to verify that an ethernet address is not the 'zero' address. Provide a standard macro ETHER_IS_ZERO for this purpose, similar to the ETHER_IS_BROADCAST macro already available. This patch also removes previous ETHER_IS_ZERO definitions in several USB ethernet drivers, in favor of this centrally-located macro. Signed-off-by: Jacob Keller Submitted by: Jacob Keller Reviewed by: erj@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21240 Modified: head/sys/dev/usb/net/if_muge.c head/sys/dev/usb/net/if_smsc.c head/sys/dev/usb/net/if_ure.c head/sys/net/ethernet.h Modified: head/sys/dev/usb/net/if_muge.c ============================================================================== --- head/sys/dev/usb/net/if_muge.c Mon Nov 4 23:06:57 2019 (r354344) +++ head/sys/dev/usb/net/if_muge.c Tue Nov 5 00:12:21 2019 (r354345) @@ -157,9 +157,6 @@ do { \ #define muge_err_printf(sc, fmt, args...) \ device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) -#define ETHER_IS_ZERO(addr) \ - (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) - #define ETHER_IS_VALID(addr) \ (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Mon Nov 4 23:06:57 2019 (r354344) +++ head/sys/dev/usb/net/if_smsc.c Tue Nov 5 00:12:21 2019 (r354345) @@ -171,9 +171,6 @@ static const struct usb_device_id smsc_devs[] = { device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) -#define ETHER_IS_ZERO(addr) \ - (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) - #define ETHER_IS_VALID(addr) \ (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) Modified: head/sys/dev/usb/net/if_ure.c ============================================================================== --- head/sys/dev/usb/net/if_ure.c Mon Nov 4 23:06:57 2019 (r354344) +++ head/sys/dev/usb/net/if_ure.c Tue Nov 5 00:12:21 2019 (r354345) @@ -68,9 +68,6 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN "Debug level"); #endif -#define ETHER_IS_ZERO(addr) \ - (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) - /* * Various supported device vendors/products. */ Modified: head/sys/net/ethernet.h ============================================================================== --- head/sys/net/ethernet.h Mon Nov 4 23:06:57 2019 (r354344) +++ head/sys/net/ethernet.h Tue Nov 5 00:12:21 2019 (r354345) @@ -74,6 +74,9 @@ struct ether_addr { #define ETHER_IS_BROADCAST(addr) \ (((addr)[0] & (addr)[1] & (addr)[2] & \ (addr)[3] & (addr)[4] & (addr)[5]) == 0xff) +#define ETHER_IS_ZERO(addr) \ + (((addr)[0] | (addr)[1] | (addr)[2] | \ + (addr)[3] | (addr)[4] | (addr)[5]) == 0x00) /* * 802.1q Virtual LAN header. From owner-svn-src-all@freebsd.org Tue Nov 5 02:30:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 008231B9951; Tue, 5 Nov 2019 02:30:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476YYY6C2Pz4g86; Tue, 5 Nov 2019 02:30:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8B9C5CD8; Tue, 5 Nov 2019 02:30:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA52UfNx041543; Tue, 5 Nov 2019 02:30:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA52UfDE041542; Tue, 5 Nov 2019 02:30:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911050230.xA52UfDE041542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 5 Nov 2019 02:30:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354346 - in head: release/picobsd share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: release/picobsd share/man/man8 X-SVN-Commit-Revision: 354346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 02:30:42 -0000 Author: kevans Date: Tue Nov 5 02:30:41 2019 New Revision: 354346 URL: https://svnweb.freebsd.org/changeset/base/354346 Log: Remove picobsd build scripts and the remaining tinyware Postings were sent to -arch@ on 2019/09/13 and 2019/10/01, proposing and confirming a removal of these scripts on 2019/10/31, due to significant work needed to bring this into the modern world and nobody having done this work in the past couple of years. No objections or proposed work was raised in response to these postings. The tinyware may see a resurrection into a separate repo for archival purposes if any users of it show interest in doing so. MFC after: never Deleted: head/release/picobsd/ head/share/man/man8/picobsd.8 Modified: head/share/man/man8/Makefile head/share/man/man8/nanobsd.8 Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Tue Nov 5 00:12:21 2019 (r354345) +++ head/share/man/man8/Makefile Tue Nov 5 02:30:41 2019 (r354346) @@ -9,7 +9,6 @@ MAN= \ diskless.8 \ intro.8 \ nanobsd.8 \ - picobsd.8 \ rc.8 \ rc.sendmail.8 \ rc.subr.8 \ Modified: head/share/man/man8/nanobsd.8 ============================================================================== --- head/share/man/man8/nanobsd.8 Tue Nov 5 00:12:21 2019 (r354345) +++ head/share/man/man8/nanobsd.8 Tue Nov 5 02:30:41 2019 (r354346) @@ -339,8 +339,7 @@ customize_cmd cust_etc_size .Sh SEE ALSO .Xr make.conf 5 , .Xr boot 8 , -.Xr boot0cfg 8 , -.Xr picobsd 8 +.Xr boot0cfg 8 .Sh HISTORY The .Nm From owner-svn-src-all@freebsd.org Tue Nov 5 03:20:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 646E41BB490; Tue, 5 Nov 2019 03:20:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476ZgG1y70z3FXN; Tue, 5 Nov 2019 03:20:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 264626699; Tue, 5 Nov 2019 03:20:42 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA53Kg6H072901; Tue, 5 Nov 2019 03:20:42 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA53Keqi072895; Tue, 5 Nov 2019 03:20:40 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911050320.xA53Keqi072895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 5 Nov 2019 03:20:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354347 - in head: contrib/compiler-rt/lib/builtins contrib/libunwind/include lib/libcompiler_rt lib/libgcc_s lib/libgcc_s/arm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/compiler-rt/lib/builtins contrib/libunwind/include lib/libcompiler_rt lib/libgcc_s lib/libgcc_s/arm X-SVN-Commit-Revision: 354347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 03:20:42 -0000 Author: cem Date: Tue Nov 5 03:20:40 2019 New Revision: 354347 URL: https://svnweb.freebsd.org/changeset/base/354347 Log: Fix llvm-libunwind userspace build on ARM GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or EHABI or whatever it's called. Export the same ones from LLVM-libunwind's libgcc_s, on ARM. As part of this, convert libgcc_s from a direct Version.map to one constructed from component Symbol.map files. This allows the ARM-specific Symbol.map to be included only on ARM. Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match non-ARM definitions and ARM-specific expectations in libcxxrt / libcompiler_rt. No functional change intended for non-ARM architectures. This commit does not actually flip the switch for ARM defaults from libgcc to llvm-libunwind, but makes it possible (to compile, anyway). Added: head/lib/libgcc_s/Symbol.map - copied, changed from r354346, head/lib/libgcc_s/Version.map head/lib/libgcc_s/Versions.def (contents, props changed) head/lib/libgcc_s/arm/ head/lib/libgcc_s/arm/Symbol.map (contents, props changed) Deleted: head/lib/libgcc_s/Version.map Modified: head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c head/contrib/libunwind/include/unwind.h head/lib/libcompiler_rt/Makefile head/lib/libgcc_s/Makefile Modified: head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c ============================================================================== --- head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c Tue Nov 5 02:30:41 2019 (r354346) +++ head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c Tue Nov 5 03:20:40 2019 (r354347) @@ -9,8 +9,23 @@ #include "int_lib.h" #include +/* + * XXX On FreeBSD, this file is compiled into three libraries: + * - libcompiler_rt + * - libgcc_eh + * - libgcc_s + * + * In the former, the include path points to the contrib/libcxxrt/unwind-arm.h + * copy of unwind.h. In the latter, the include path points to the + * contrib/libunwind/include/unwind.h header (LLVM libunwind). + * + * Neither (seemingly redundant) variant of unwind.h needs the redefinitions + * provided in the "helpful" header below, and libcxxrt's unwind-arm.h provides + * *no* useful distinguishing macros, so just forcibly disable the helper + * header on FreeBSD. + */ #if defined(__arm__) && !defined(__ARM_DWARF_EH__) && \ - !defined(__USING_SJLJ_EXCEPTIONS__) + !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__FreeBSD__) // When building with older compilers (e.g. clang <3.9), it is possible that we // have a version of unwind.h which does not provide the EHABI declarations // which are quired for the C personality to conform to the specification. In Modified: head/contrib/libunwind/include/unwind.h ============================================================================== --- head/contrib/libunwind/include/unwind.h Tue Nov 5 02:30:41 2019 (r354346) +++ head/contrib/libunwind/include/unwind.h Tue Nov 5 03:20:40 2019 (r354347) @@ -66,12 +66,16 @@ static const _Unwind_State _US_ACTION_MASK static const _Unwind_State _US_FORCE_UNWIND = 8; typedef uint32_t _Unwind_EHT_Header; +/* + * gcc_personality_v0 references 'struct _Unwind_Exception' all over the place. + * Nothing in libunwind cares about 'struct _Unwind_Control_Block,' so make it + * the alias of struct _Unwind_Exception, instead of the other way around. + */ +struct _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Control_Block; /* Alias */ -struct _Unwind_Control_Block; -typedef struct _Unwind_Control_Block _Unwind_Control_Block; -typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ - -struct _Unwind_Control_Block { +struct _Unwind_Exception { uint64_t exception_class; void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block*); Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Tue Nov 5 02:30:41 2019 (r354346) +++ head/lib/libcompiler_rt/Makefile Tue Nov 5 03:20:40 2019 (r354347) @@ -12,10 +12,6 @@ CFLAGS+= -fvisibility=hidden CFLAGS+= -DVISIBILITY_HIDDEN CFLAGS+= -I${SRCTOP}/contrib/libcxxrt -.if ${COMPILER_TYPE} == "clang" -CWARNFLAGS.gcc_personality_v0.c+= -Wno-typedef-redefinition -.endif - # gcc has incompatible internal declarations for __divtc3 and __multc3, but has # no option to silence its warning, so make warnings non-fatal. NO_WERROR.gcc= Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Tue Nov 5 02:30:41 2019 (r354346) +++ head/lib/libgcc_s/Makefile Tue Nov 5 03:20:40 2019 (r354347) @@ -4,12 +4,22 @@ PACKAGE= clibs SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib +.include + MK_SSP= no WARNS?= 2 LDFLAGS+= -nodefaultlibs LIBADD+= c -VERSION_MAP= ${.CURDIR}/Version.map + +.if ${MK_SYMVER} == "yes" +VERSION_DEF= ${.CURDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map +# Export ARM AEABI unwind routines needed by libc and libthr. +.if exists(${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map) +SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map +.endif +.endif .include "../libcompiler_rt/Makefile.inc" .include "../libgcc_eh/Makefile.inc" Copied and modified: head/lib/libgcc_s/Symbol.map (from r354346, head/lib/libgcc_s/Version.map) ============================================================================== --- head/lib/libgcc_s/Version.map Tue Nov 5 02:30:41 2019 (r354346, copy source) +++ head/lib/libgcc_s/Symbol.map Tue Nov 5 03:20:40 2019 (r354347) @@ -3,7 +3,6 @@ */ GCC_3.0 { -global: __absvdi2; __absvsi2; __addvdi3; @@ -84,8 +83,6 @@ global: _Unwind_Resume; _Unwind_SetGR; _Unwind_SetIP; -local: - *; }; GCC_3.3 { @@ -93,11 +90,11 @@ GCC_3.3 { _Unwind_FindEnclosingFunction; _Unwind_GetCFA; _Unwind_Resume_or_Rethrow; -} GCC_3.0; +}; GCC_3.3.1 { __gcc_personality_v0; -} GCC_3.3; +}; GCC_3.4 { __clzdi2; @@ -112,11 +109,11 @@ GCC_3.4 { __popcountdi2; __popcountsi2; __popcountti2; -} GCC_3.3.1; +}; GCC_3.4.2 { __enable_execute_stack; -} GCC_3.4; +}; GCC_3.4.4 { __absvti2; @@ -124,7 +121,7 @@ GCC_3.4.4 { __mulvti3; __negvti2; __subvti3; -} GCC_3.4.2; +}; GCC_4.0.0 { __divdc3; @@ -136,7 +133,7 @@ GCC_4.0.0 { __powidf2; __powisf2; __powixf2; -} GCC_3.4.4; +}; GCC_4.2.0 { __floatundidf; @@ -146,9 +143,9 @@ GCC_4.2.0 { __floatuntisf; __floatuntixf; _Unwind_GetIPInfo; -} GCC_4.0.0; +}; GCC_4.3.0 { __bswapdi2; __bswapsi2; -} GCC_4.2.0; +}; Added: head/lib/libgcc_s/Versions.def ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libgcc_s/Versions.def Tue Nov 5 03:20:40 2019 (r354347) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +GCC_3.0 { +}; + +GCC_3.3 { +} GCC_3.0; + +GCC_3.3.1 { +} GCC_3.3; + +GCC_3.4 { +} GCC_3.3.1; + +GCC_3.4.2 { +} GCC_3.4; + +GCC_3.4.4 { +} GCC_3.4.2; + +GCC_3.5 { +} GCC_3.4.4; + +GCC_4.0.0 { +} GCC_3.5; + +GCC_4.2.0 { +} GCC_4.0.0; + +GCC_4.3.0 { +} GCC_4.2.0; Added: head/lib/libgcc_s/arm/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libgcc_s/arm/Symbol.map Tue Nov 5 03:20:40 2019 (r354347) @@ -0,0 +1,12 @@ +/* + * $FreeBSD$ + */ + +GCC_3.5 { + _Unwind_VRS_Get; + _Unwind_VRS_Set; + __aeabi_unwind_cpp_pr0; + __aeabi_unwind_cpp_pr1; + __aeabi_unwind_cpp_pr2; + __gnu_unwind_frame; +}; From owner-svn-src-all@freebsd.org Tue Nov 5 03:22:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78E0A1BB69A; Tue, 5 Nov 2019 03:22:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476Zj42hDXz3Fnk; Tue, 5 Nov 2019 03:22:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F5F4683F; Tue, 5 Nov 2019 03:22:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA53MGxV075381; Tue, 5 Nov 2019 03:22:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA53MGp3075380; Tue, 5 Nov 2019 03:22:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911050322.xA53MGp3075380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 5 Nov 2019 03:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354348 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 03:22:16 -0000 Author: cem Date: Tue Nov 5 03:22:15 2019 New Revision: 354348 URL: https://svnweb.freebsd.org/changeset/base/354348 Log: armv6, armv7: Switch to llvm-libunwind by default This could just be ${__TT} == "arm", except armv5 isn't slated for death until EOY. arm tinderbox builds. Let's see what else shakes out. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Nov 5 03:20:40 2019 (r354347) +++ head/share/mk/src.opts.mk Tue Nov 5 03:22:15 2019 (r354348) @@ -329,8 +329,9 @@ BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BO .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ - ${__T:Mriscv*} != "" || ${__TT} == "mips" +.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv6" || \ + ${__T} == "armv7" || ${__T} == "i386" || ${__T:Mriscv*} != "" || \ + ${__TT} == "mips" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND From owner-svn-src-all@freebsd.org Tue Nov 5 06:34:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 777321BFF4C; Tue, 5 Nov 2019 06:34:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476fyj2Zmhz3PND; Tue, 5 Nov 2019 06:34:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C76F8A1A; Tue, 5 Nov 2019 06:34:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA56YLTw089953; Tue, 5 Nov 2019 06:34:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA56YKQ4089951; Tue, 5 Nov 2019 06:34:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050634.xA56YKQ4089951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 06:34:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354349 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 354349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 06:34:21 -0000 Author: avg Date: Tue Nov 5 06:34:20 2019 New Revision: 354349 URL: https://svnweb.freebsd.org/changeset/base/354349 Log: if_ixv: disable RSS configuration on 82599 and X540 VFs It is reported that those VFs share their RSS configuration with PF and, thus, they cannot be configured independently. Also: - add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could not be seen - do not enable IXGBE_FEATURE_RSS on the older VFs - set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set Reviewed by: nobody MFC after: 4 weeks Sponsored by: Panzura Differential Revision: https://reviews.freebsd.org/D21705 Modified: head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ix_txrx.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Tue Nov 5 03:22:15 2019 (r354348) +++ head/sys/dev/ixgbe/if_ixv.c Tue Nov 5 06:34:20 2019 (r354349) @@ -35,6 +35,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include "ixgbe.h" #include "ifdi_if.h" @@ -1454,7 +1455,12 @@ ixv_initialize_receive_units(if_ctx_t ctx) scctx->isc_nrxd[0] - 1); } - ixv_initialize_rss_mapping(adapter); + /* + * Do not touch RSS and RETA settings for older hardware + * as those are shared among PF and all VF. + */ + if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) + ixv_initialize_rss_mapping(adapter); } /* ixv_initialize_receive_units */ /************************************************************************ @@ -1889,7 +1895,6 @@ ixv_init_device_features(struct adapter *adapter) { adapter->feat_cap = IXGBE_FEATURE_NETMAP | IXGBE_FEATURE_VF - | IXGBE_FEATURE_RSS | IXGBE_FEATURE_LEGACY_TX; /* A tad short on feature flags for VFs, atm. */ @@ -1902,6 +1907,7 @@ ixv_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x_vf: case ixgbe_mac_X550EM_a_vf: adapter->feat_cap |= IXGBE_FEATURE_NEEDS_CTXD; + adapter->feat_cap |= IXGBE_FEATURE_RSS; break; default: break; Modified: head/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- head/sys/dev/ixgbe/ix_txrx.c Tue Nov 5 03:22:15 2019 (r354348) +++ head/sys/dev/ixgbe/ix_txrx.c Tue Nov 5 06:34:20 2019 (r354349) @@ -464,6 +464,12 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = ixgbe_determine_rsstype(pkt_info); + if ((adapter->feat_en & IXGBE_FEATURE_RSS) == 0) { + if (ri->iri_rsstype == M_HASHTYPE_OPAQUE) + ri->iri_rsstype = M_HASHTYPE_NONE; + else + ri->iri_rsstype = M_HASHTYPE_OPAQUE_HASH; + } ri->iri_vtag = vtag; ri->iri_nfrags = i; if (vtag) From owner-svn-src-all@freebsd.org Tue Nov 5 06:55:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E1A4178A21; Tue, 5 Nov 2019 06:55:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gQl0vrqz3QMD; Tue, 5 Nov 2019 06:55:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 026E38DE0; Tue, 5 Nov 2019 06:55:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA56tAS7001740; Tue, 5 Nov 2019 06:55:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA56t92j001734; Tue, 5 Nov 2019 06:55:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050655.xA56t92j001734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 06:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354350 - in stable/12: share/man/man4 sys/amd64/conf sys/conf sys/dev/itwd sys/i386/conf sys/modules/itwd X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/amd64/conf sys/conf sys/dev/itwd sys/i386/conf sys/modules/itwd X-SVN-Commit-Revision: 354350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 06:55:11 -0000 Author: avg Date: Tue Nov 5 06:55:09 2019 New Revision: 354350 URL: https://svnweb.freebsd.org/changeset/base/354350 Log: MFC r353647: itwd(4): driver for watchdog function in ITE Super I/O chips This branch does not have files.x86, so the driver is added to files.{amd64,i386}. Added: stable/12/share/man/man4/itwd.4 - copied unchanged from r353647, head/share/man/man4/itwd.4 stable/12/sys/dev/itwd/ - copied from r353647, head/sys/dev/itwd/ stable/12/sys/modules/itwd/ - copied from r353647, head/sys/modules/itwd/ Modified: stable/12/share/man/man4/Makefile stable/12/sys/amd64/conf/NOTES stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/i386/conf/NOTES Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/Makefile ============================================================================== --- stable/12/share/man/man4/Makefile Tue Nov 5 06:34:20 2019 (r354349) +++ stable/12/share/man/man4/Makefile Tue Nov 5 06:55:09 2019 (r354350) @@ -236,6 +236,7 @@ MAN= aac.4 \ ismt.4 \ isp.4 \ ispfw.4 \ + ${_itwd.4} \ iwi.4 \ iwifw.4 \ iwm.4 \ @@ -819,6 +820,7 @@ _if_wpi.4= if_wpi.4 _imcsmb.4= imcsmb.4 _ipmi.4= ipmi.4 _io.4= io.4 +_itwd.4= itwd.4 _linux.4= linux.4 _nda.4= nda.4 _ndis.4= ndis.4 Copied: stable/12/share/man/man4/itwd.4 (from r353647, head/share/man/man4/itwd.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/man/man4/itwd.4 Tue Nov 5 06:55:09 2019 (r354350, copy of r353647, head/share/man/man4/itwd.4) @@ -0,0 +1,75 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2012 Bjoern A. Zeeb +.\" Copyright (c) 2019 Andriy Gapon +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 16, 2019 +.Dt ITWD 4 +.Os +.Sh NAME +.Nm itwd +.Nd device driver for ITE Super I/O chips watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device superio" +.Cd "device itwd" +.Ed +.Pp +Alternatively, to load the driver as a module at boot time, place the following +line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +itwd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog timer present on at least the following +Super I/O chips: +.Bl -bullet -compact +.It +IT8721F +.It +IT8728F +.It +IT8771F +.El +.Sh SEE ALSO +.Xr superio 4 +.Xr watchdog 4 , +.Xr device.hints 5 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . Modified: stable/12/sys/amd64/conf/NOTES ============================================================================== --- stable/12/sys/amd64/conf/NOTES Tue Nov 5 06:34:20 2019 (r354349) +++ stable/12/sys/amd64/conf/NOTES Tue Nov 5 06:55:09 2019 (r354350) @@ -572,11 +572,13 @@ device ioat # Intel I/OAT DMA engine # amdsbwd: AMD SB7xx watchdog timer # viawd: VIA south bridge watchdog timer # wbwd: Winbond watchdog timer +# itwd: ITE Super I/O watchdog timer # device ichwd device amdsbwd device viawd device wbwd +device itwd # # Temperature sensors: Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Tue Nov 5 06:34:20 2019 (r354349) +++ stable/12/sys/conf/files.amd64 Tue Nov 5 06:55:09 2019 (r354350) @@ -268,6 +268,7 @@ dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci dev/ipmi/ipmi_linux.c optional ipmi compat_linux32 +dev/itwd/itwd.c optional itwd dev/ixl/if_ixl.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_main.c optional ixl pci \ Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Tue Nov 5 06:34:20 2019 (r354349) +++ stable/12/sys/conf/files.i386 Tue Nov 5 06:55:09 2019 (r354350) @@ -282,6 +282,7 @@ dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci dev/ipmi/ipmi_linux.c optional ipmi compat_linux +dev/itwd/itwd.c optional itwd dev/le/if_le_isa.c optional le isa dev/mse/mse.c optional mse dev/mse/mse_isa.c optional mse isa Modified: stable/12/sys/i386/conf/NOTES ============================================================================== --- stable/12/sys/i386/conf/NOTES Tue Nov 5 06:34:20 2019 (r354349) +++ stable/12/sys/i386/conf/NOTES Tue Nov 5 06:55:09 2019 (r354350) @@ -856,11 +856,13 @@ hint.pcf.0.irq="5" # amdsbwd: AMD SB7xx watchdog timer # viawd: VIA south bridge watchdog timer # wbwd: Winbond watchdog timer +# itwd: ITE Super I/O watchdog timer # device ichwd device amdsbwd device viawd device wbwd +device itwd # # Temperature sensors: From owner-svn-src-all@freebsd.org Tue Nov 5 07:00:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CB6B178C19; Tue, 5 Nov 2019 07:00:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gXW3BDfz3QXN; Tue, 5 Nov 2019 07:00:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 515A78DE9; Tue, 5 Nov 2019 07:00:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA570BlD002162; Tue, 5 Nov 2019 07:00:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA570BEn002161; Tue, 5 Nov 2019 07:00:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050700.xA570BEn002161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 07:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354351 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:00:11 -0000 Author: avg Date: Tue Nov 5 07:00:10 2019 New Revision: 354351 URL: https://svnweb.freebsd.org/changeset/base/354351 Log: MFC r354067,r354068: ow_temp: drop the lock around a call that can sleep And use better scopes for the lock. Modified: stable/12/sys/dev/ow/ow_temp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow_temp.c ============================================================================== --- stable/12/sys/dev/ow/ow_temp.c Tue Nov 5 06:55:09 2019 (r354350) +++ stable/12/sys/dev/ow/ow_temp.c Tue Nov 5 07:00:10 2019 (r354351) @@ -143,9 +143,11 @@ ow_temp_event_thread(void *arg) pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger mtx_lock(&sc->temp_lock); sc->flags |= OW_TEMP_RUNNING; + mtx_unlock(&sc->temp_lock); ow_temp_read_power_supply(sc->dev, &sc->parasite); if (sc->parasite) device_printf(sc->dev, "Running in parasitic mode unsupported\n"); + mtx_lock(&sc->temp_lock); while ((sc->flags & OW_TEMP_DONE) == 0) { mtx_unlock(&sc->temp_lock); ow_temp_convert_t(sc->dev); @@ -153,10 +155,9 @@ ow_temp_event_thread(void *arg) msleep(sc, &sc->temp_lock, 0, "owtcvt", hz); if (sc->flags & OW_TEMP_DONE) break; + mtx_unlock(&sc->temp_lock); for (retries = 5; retries > 0; retries--) { - mtx_unlock(&sc->temp_lock); rv = ow_temp_read_scratchpad(sc->dev, scratch, sizeof(scratch)); - mtx_lock(&sc->temp_lock); if (rv == 0) { crc = own_crc(sc->dev, scratch, sizeof(scratch) - 1); if (crc == scratch[8]) { @@ -180,6 +181,7 @@ ow_temp_event_thread(void *arg) } else sc->bad_reads++; } + mtx_lock(&sc->temp_lock); msleep(sc, &sc->temp_lock, 0, "owtcvt", sc->reading_interval); } sc->flags &= ~OW_TEMP_RUNNING; From owner-svn-src-all@freebsd.org Tue Nov 5 07:02:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 628FA178E74; Tue, 5 Nov 2019 07:02:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gbJ21HZz3Qtf; Tue, 5 Nov 2019 07:02:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 295A78FAE; Tue, 5 Nov 2019 07:02:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA572aL2007968; Tue, 5 Nov 2019 07:02:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA572a4D007967; Tue, 5 Nov 2019 07:02:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050702.xA572a4D007967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 07:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354352 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 354352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:02:36 -0000 Author: avg Date: Tue Nov 5 07:02:35 2019 New Revision: 354352 URL: https://svnweb.freebsd.org/changeset/base/354352 Log: MFC r353749: buildkernel: always add standard kernel configuration include path Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Tue Nov 5 07:00:10 2019 (r354351) +++ stable/12/Makefile.inc1 Tue Nov 5 07:02:35 2019 (r354352) @@ -1581,7 +1581,8 @@ buildkernel: .MAKE .PHONY cd ${KRNLCONFDIR}; \ PATH=${TMPPATH} \ config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ - -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' + -I '${KERNCONFDIR}' -I '${KRNLCONFDIR}' \ + '${KERNCONFDIR}/${_kernel}' .endif .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) @echo From owner-svn-src-all@freebsd.org Tue Nov 5 07:06:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 141DF178FC7; Tue, 5 Nov 2019 07:06:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gh56tXWz3R3K; Tue, 5 Nov 2019 07:06:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC6838FB2; Tue, 5 Nov 2019 07:06:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA576jSp008216; Tue, 5 Nov 2019 07:06:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA576jOS008214; Tue, 5 Nov 2019 07:06:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050706.xA576jOS008214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 07:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354353 - in stable/12: sbin/ddb share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: sbin/ddb share/man/man4 X-SVN-Commit-Revision: 354353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:06:46 -0000 Author: avg Date: Tue Nov 5 07:06:45 2019 New Revision: 354353 URL: https://svnweb.freebsd.org/changeset/base/354353 Log: MFC r353726: ddb: use 'textdump dump' instead of 'call doadump' The change is for the example in textdump.4 and the default ddb.conf. Modified: stable/12/sbin/ddb/ddb.conf stable/12/share/man/man4/textdump.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ddb/ddb.conf ============================================================================== --- stable/12/sbin/ddb/ddb.conf Tue Nov 5 07:02:35 2019 (r354352) +++ stable/12/sbin/ddb/ddb.conf Tue Nov 5 07:06:45 2019 (r354353) @@ -9,7 +9,7 @@ script lockinfo=show locks; show alllocks; show lockedvnods # kdb.enter.panic panic(9) was called. -script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; call doadump; reset +script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; ps; alltrace; capture off; textdump dump; reset # kdb.enter.witness witness(4) detected a locking error. script kdb.enter.witness=run lockinfo Modified: stable/12/share/man/man4/textdump.4 ============================================================================== --- stable/12/share/man/man4/textdump.4 Tue Nov 5 07:02:35 2019 (r354352) +++ stable/12/share/man/man4/textdump.4 Tue Nov 5 07:06:45 2019 (r354353) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 24, 2008 +.Dd October 18, 2019 .Dt TEXTDUMP 4 .Os .Sh NAME @@ -162,7 +162,7 @@ invoke panic in order to force a kernel dump to be wri reboot: .Bd -literal -offset indent script kdb.enter.panic=textdump set; capture on; show allpcpu; bt; - ps; alltrace; show alllocks; call doadump; reset + ps; alltrace; show alllocks; textdump dump; reset .Ed .Pp In the following example, the script From owner-svn-src-all@freebsd.org Tue Nov 5 07:11:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84CA5179146; Tue, 5 Nov 2019 07:11:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gnF3hDHz3RDn; Tue, 5 Nov 2019 07:11:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61A948FF6; Tue, 5 Nov 2019 07:11:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA57BDBW009189; Tue, 5 Nov 2019 07:11:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA57BCg7009185; Tue, 5 Nov 2019 07:11:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050711.xA57BCg7009185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 07:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354354 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 354354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:11:13 -0000 Author: avg Date: Tue Nov 5 07:11:12 2019 New Revision: 354354 URL: https://svnweb.freebsd.org/changeset/base/354354 Log: MFC r353565,r353568: MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Tue Nov 5 07:06:45 2019 (r354353) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Tue Nov 5 07:11:12 2019 (r354354) @@ -304,7 +304,7 @@ abd_alloc(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_scatter.abd_offset = 0; abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size; @@ -331,7 +331,7 @@ abd_free_scatter(abd_t *abd) abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_scatter_cnt); ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size); ABDSTAT_INCR(abdstat_scatter_chunk_waste, @@ -358,7 +358,7 @@ abd_alloc_linear(size_t size, boolean_t is_metadata) } abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); if (is_metadata) { abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size); @@ -381,7 +381,7 @@ abd_free_linear(abd_t *abd) zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); ABDSTAT_BUMPDOWN(abdstat_linear_cnt); ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size); @@ -487,8 +487,8 @@ abd_get_offset(abd_t *sabd, size_t off) abd->abd_size = sabd->abd_size - off; abd->abd_parent = sabd; - refcount_create(&abd->abd_children); - (void) refcount_add_many(&sabd->abd_children, abd->abd_size, abd); + zfs_refcount_create(&abd->abd_children); + (void) zfs_refcount_add_many(&sabd->abd_children, abd->abd_size, abd); return (abd); } @@ -512,7 +512,7 @@ abd_get_from_buf(void *buf, size_t size) abd->abd_flags = ABD_FLAG_LINEAR; abd->abd_size = size; abd->abd_parent = NULL; - refcount_create(&abd->abd_children); + zfs_refcount_create(&abd->abd_children); abd->abd_u.abd_linear.abd_buf = buf; @@ -530,11 +530,11 @@ abd_put(abd_t *abd) ASSERT(!(abd->abd_flags & ABD_FLAG_OWNER)); if (abd->abd_parent != NULL) { - (void) refcount_remove_many(&abd->abd_parent->abd_children, + (void) zfs_refcount_remove_many(&abd->abd_parent->abd_children, abd->abd_size, abd); } - refcount_destroy(&abd->abd_children); + zfs_refcount_destroy(&abd->abd_children); abd_free_struct(abd); } @@ -566,7 +566,7 @@ abd_borrow_buf(abd_t *abd, size_t n) } else { buf = zio_buf_alloc(n); } - (void) refcount_add_many(&abd->abd_children, n, buf); + (void) zfs_refcount_add_many(&abd->abd_children, n, buf); return (buf); } @@ -598,7 +598,7 @@ abd_return_buf(abd_t *abd, void *buf, size_t n) ASSERT0(abd_cmp_buf(abd, buf, n)); zio_buf_free(buf, n); } - (void) refcount_remove_many(&abd->abd_children, n, buf); + (void) zfs_refcount_remove_many(&abd->abd_children, n, buf); } void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Nov 5 07:06:45 2019 (r354353) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Nov 5 07:11:12 2019 (r354354) @@ -538,12 +538,12 @@ typedef struct arc_state { /* * total amount of evictable data in this state */ - refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; + zfs_refcount_t arcs_esize[ARC_BUFC_NUMTYPES]; /* * total amount of data in this state; this includes: evictable, * non-evictable, ARC_BUFC_DATA, and ARC_BUFC_METADATA. */ - refcount_t arcs_size; + zfs_refcount_t arcs_size; /* * supports the "dbufs" kstat */ @@ -1158,7 +1158,7 @@ typedef struct l1arc_buf_hdr { uint32_t b_l2_hits; /* self protecting */ - refcount_t b_refcnt; + zfs_refcount_t b_refcnt; arc_callback_t *b_acb; abd_t *b_pabd; @@ -1534,7 +1534,7 @@ struct l2arc_dev { kmutex_t l2ad_mtx; /* lock for buffer list */ list_t l2ad_buflist; /* buffer list */ list_node_t l2ad_node; /* device list node */ - refcount_t l2ad_alloc; /* allocated bytes */ + zfs_refcount_t l2ad_alloc; /* allocated bytes */ }; static list_t L2ARC_dev_list; /* device list */ @@ -1765,7 +1765,7 @@ hdr_full_cons(void *vbuf, void *unused, int kmflag) bzero(hdr, HDR_FULL_SIZE); cv_init(&hdr->b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL); - refcount_create(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_create(&hdr->b_l1hdr.b_refcnt); mutex_init(&hdr->b_l1hdr.b_freeze_lock, NULL, MUTEX_DEFAULT, NULL); multilist_link_init(&hdr->b_l1hdr.b_arc_node); arc_space_consume(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -1810,7 +1810,7 @@ hdr_full_dest(void *vbuf, void *unused) ASSERT(HDR_EMPTY(hdr)); cv_destroy(&hdr->b_l1hdr.b_cv); - refcount_destroy(&hdr->b_l1hdr.b_refcnt); + zfs_refcount_destroy(&hdr->b_l1hdr.b_refcnt); mutex_destroy(&hdr->b_l1hdr.b_freeze_lock); ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); arc_space_return(HDR_FULL_SIZE, ARC_SPACE_HDRS); @@ -2495,21 +2495,21 @@ arc_evictable_space_increment(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&state->arcs_esize[type], + (void) zfs_refcount_add_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2530,21 +2530,21 @@ arc_evictable_space_decrement(arc_buf_hdr_t *hdr, arc_ ASSERT0(hdr->b_l1hdr.b_bufcnt); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], HDR_GET_LSIZE(hdr), hdr); return; } ASSERT(!GHOST_STATE(state)); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_hdr_size(hdr), hdr); } for (arc_buf_t *buf = hdr->b_l1hdr.b_buf; buf != NULL; buf = buf->b_next) { if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], arc_buf_size(buf), buf); } } @@ -2561,13 +2561,13 @@ add_reference(arc_buf_hdr_t *hdr, void *tag) ASSERT(HDR_HAS_L1HDR(hdr)); if (!MUTEX_HELD(HDR_LOCK(hdr))) { ASSERT(hdr->b_l1hdr.b_state == arc_anon); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); } arc_state_t *state = hdr->b_l1hdr.b_state; - if ((refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && + if ((zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag) == 1) && (state != arc_anon)) { /* We don't use the L2-only state list. */ if (state != arc_l2c_only) { @@ -2599,7 +2599,7 @@ remove_reference(arc_buf_hdr_t *hdr, kmutex_t *hash_lo * arc_l2c_only counts as a ghost state so we don't need to explicitly * check to prevent usage of the arc_l2c_only list. */ - if (((cnt = refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && + if (((cnt = zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag)) == 0) && (state != arc_anon)) { multilist_insert(state->arcs_list[arc_buf_type(hdr)], hdr); ASSERT3U(hdr->b_l1hdr.b_bufcnt, >, 0); @@ -2644,7 +2644,7 @@ arc_buf_info(arc_buf_t *ab, arc_buf_info_t *abi, int s abi->abi_mru_ghost_hits = l1hdr->b_mru_ghost_hits; abi->abi_mfu_hits = l1hdr->b_mfu_hits; abi->abi_mfu_ghost_hits = l1hdr->b_mfu_ghost_hits; - abi->abi_holds = refcount_count(&l1hdr->b_refcnt); + abi->abi_holds = zfs_refcount_count(&l1hdr->b_refcnt); } if (l2hdr) { @@ -2680,7 +2680,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t */ if (HDR_HAS_L1HDR(hdr)) { old_state = hdr->b_l1hdr.b_state; - refcnt = refcount_count(&hdr->b_l1hdr.b_refcnt); + refcnt = zfs_refcount_count(&hdr->b_l1hdr.b_refcnt); bufcnt = hdr->b_l1hdr.b_bufcnt; update_old = (bufcnt > 0 || hdr->b_l1hdr.b_pabd != NULL); } else { @@ -2750,7 +2750,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * the reference. As a result, we use the arc * header pointer for the reference. */ - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many(&new_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); } else { @@ -2776,13 +2776,15 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); if (hdr->b_l1hdr.b_pabd != NULL) { - (void) refcount_add_many(&new_state->arcs_size, + (void) zfs_refcount_add_many( + &new_state->arcs_size, arc_hdr_size(hdr), hdr); } else { ASSERT(GHOST_STATE(old_state)); @@ -2804,7 +2806,7 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t * header on the ghost state. */ - (void) refcount_remove_many(&old_state->arcs_size, + (void) zfs_refcount_remove_many(&old_state->arcs_size, HDR_GET_LSIZE(hdr), hdr); } else { uint32_t buffers = 0; @@ -2829,13 +2831,13 @@ arc_change_state(arc_state_t *new_state, arc_buf_hdr_t if (arc_buf_is_shared(buf)) continue; - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_buf_size(buf), buf); } ASSERT3U(bufcnt, ==, buffers); ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); - (void) refcount_remove_many( + (void) zfs_refcount_remove_many( &old_state->arcs_size, arc_hdr_size(hdr), hdr); } } @@ -3101,8 +3103,8 @@ arc_return_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); arc_loaned_bytes_update(-arc_buf_size(buf)); } @@ -3115,8 +3117,8 @@ arc_loan_inuse_buf(arc_buf_t *buf, void *tag) ASSERT3P(buf->b_data, !=, NULL); ASSERT(HDR_HAS_L1HDR(hdr)); - (void) refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); - (void) refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&hdr->b_l1hdr.b_refcnt, arc_onloan_tag); + (void) zfs_refcount_remove(&hdr->b_l1hdr.b_refcnt, tag); arc_loaned_bytes_update(arc_buf_size(buf)); } @@ -3143,13 +3145,13 @@ arc_hdr_free_on_write(arc_buf_hdr_t *hdr) /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, hdr); } - (void) refcount_remove_many(&state->arcs_size, size, hdr); + (void) zfs_refcount_remove_many(&state->arcs_size, size, hdr); if (type == ARC_BUFC_METADATA) { arc_space_return(size, ARC_SPACE_META); } else { @@ -3179,7 +3181,7 @@ arc_share_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * refcount ownership to the hdr since it always owns * the refcount whenever an arc_buf_t is shared. */ - refcount_transfer_ownership(&state->arcs_size, buf, hdr); + zfs_refcount_transfer_ownership(&state->arcs_size, buf, hdr); hdr->b_l1hdr.b_pabd = abd_get_from_buf(buf->b_data, arc_buf_size(buf)); abd_take_ownership_of_buf(hdr->b_l1hdr.b_pabd, HDR_ISTYPE_METADATA(hdr)); @@ -3209,7 +3211,7 @@ arc_unshare_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf) * We are no longer sharing this buffer so we need * to transfer its ownership to the rightful owner. */ - refcount_transfer_ownership(&state->arcs_size, hdr, buf); + zfs_refcount_transfer_ownership(&state->arcs_size, hdr, buf); arc_hdr_clear_flags(hdr, ARC_FLAG_SHARED_DATA); abd_release_ownership_of_buf(hdr->b_l1hdr.b_pabd); abd_put(hdr->b_l1hdr.b_pabd); @@ -3436,7 +3438,7 @@ arc_hdr_alloc(uint64_t spa, int32_t psize, int32_t lsi * it references and compressed arc enablement. */ arc_hdr_alloc_pabd(hdr, B_TRUE); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); return (hdr); } @@ -3538,8 +3540,10 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, * the wrong pointer address when calling arc_hdr_destroy() later. */ - (void) refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); - (void) refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), nhdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), + hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, arc_hdr_size(nhdr), + nhdr); buf_discard_identity(hdr); kmem_cache_free(old, hdr); @@ -3619,7 +3623,7 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr) vdev_space_update(dev->l2ad_vdev, -psize, 0, 0); - (void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, psize, hdr); arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR); } @@ -3629,7 +3633,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (HDR_HAS_L1HDR(hdr)) { ASSERT(hdr->b_l1hdr.b_buf == NULL || hdr->b_l1hdr.b_bufcnt > 0); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); } ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -3793,7 +3797,7 @@ arc_evict_hdr(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) return (bytes_evicted); } - ASSERT0(refcount_count(&hdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt)); while (hdr->b_l1hdr.b_buf) { arc_buf_t *buf = hdr->b_l1hdr.b_buf; if (!mutex_tryenter(&buf->b_evict_lock)) { @@ -4107,7 +4111,7 @@ arc_flush_state(arc_state_t *state, uint64_t spa, arc_ { uint64_t evicted = 0; - while (refcount_count(&state->arcs_esize[type]) != 0) { + while (zfs_refcount_count(&state->arcs_esize[type]) != 0) { evicted += arc_evict_state(state, spa, ARC_EVICT_ALL, type); if (!retry) @@ -4130,7 +4134,7 @@ arc_prune_task(void *ptr) if (func != NULL) func(ap->p_adjust, ap->p_private); - refcount_remove(&ap->p_refcnt, func); + zfs_refcount_remove(&ap->p_refcnt, func); } /* @@ -4153,14 +4157,14 @@ arc_prune_async(int64_t adjust) for (ap = list_head(&arc_prune_list); ap != NULL; ap = list_next(&arc_prune_list, ap)) { - if (refcount_count(&ap->p_refcnt) >= 2) + if (zfs_refcount_count(&ap->p_refcnt) >= 2) continue; - refcount_add(&ap->p_refcnt, ap->p_pfunc); + zfs_refcount_add(&ap->p_refcnt, ap->p_pfunc); ap->p_adjust = adjust; if (taskq_dispatch(arc_prune_taskq, arc_prune_task, ap, TQ_SLEEP) == TASKQID_INVALID) { - refcount_remove(&ap->p_refcnt, ap->p_pfunc); + zfs_refcount_remove(&ap->p_refcnt, ap->p_pfunc); continue; } ARCSTAT_BUMP(arcstat_prune); @@ -4182,8 +4186,9 @@ arc_adjust_impl(arc_state_t *state, uint64_t spa, int6 { int64_t delta; - if (bytes > 0 && refcount_count(&state->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&state->arcs_esize[type]), bytes); + if (bytes > 0 && zfs_refcount_count(&state->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&state->arcs_esize[type]), + bytes); return (arc_evict_state(state, spa, delta, type)); } @@ -4226,8 +4231,9 @@ restart: */ adjustmnt = meta_used - arc_meta_limit; - if (adjustmnt > 0 && refcount_count(&arc_mru->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&arc_mru->arcs_esize[type]), + if (adjustmnt > 0 && + zfs_refcount_count(&arc_mru->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&arc_mru->arcs_esize[type]), adjustmnt); total_evicted += arc_adjust_impl(arc_mru, 0, delta, type); adjustmnt -= delta; @@ -4243,8 +4249,9 @@ restart: * simply decrement the amount of data evicted from the MRU. */ - if (adjustmnt > 0 && refcount_count(&arc_mfu->arcs_esize[type]) > 0) { - delta = MIN(refcount_count(&arc_mfu->arcs_esize[type]), + if (adjustmnt > 0 && + zfs_refcount_count(&arc_mfu->arcs_esize[type]) > 0) { + delta = MIN(zfs_refcount_count(&arc_mfu->arcs_esize[type]), adjustmnt); total_evicted += arc_adjust_impl(arc_mfu, 0, delta, type); } @@ -4252,17 +4259,17 @@ restart: adjustmnt = meta_used - arc_meta_limit; if (adjustmnt > 0 && - refcount_count(&arc_mru_ghost->arcs_esize[type]) > 0) { + zfs_refcount_count(&arc_mru_ghost->arcs_esize[type]) > 0) { delta = MIN(adjustmnt, - refcount_count(&arc_mru_ghost->arcs_esize[type])); + zfs_refcount_count(&arc_mru_ghost->arcs_esize[type])); total_evicted += arc_adjust_impl(arc_mru_ghost, 0, delta, type); adjustmnt -= delta; } if (adjustmnt > 0 && - refcount_count(&arc_mfu_ghost->arcs_esize[type]) > 0) { + zfs_refcount_count(&arc_mfu_ghost->arcs_esize[type]) > 0) { delta = MIN(adjustmnt, - refcount_count(&arc_mfu_ghost->arcs_esize[type])); + zfs_refcount_count(&arc_mfu_ghost->arcs_esize[type])); total_evicted += arc_adjust_impl(arc_mfu_ghost, 0, delta, type); } @@ -4311,8 +4318,8 @@ arc_adjust_meta_only(uint64_t meta_used) * evict some from the MRU here, and some from the MFU below. */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) - arc_p)); total_evicted += arc_adjust_impl(arc_mru, 0, target, ARC_BUFC_METADATA); @@ -4322,7 +4329,7 @@ arc_adjust_meta_only(uint64_t meta_used) * space allotted to the MFU (which is defined as arc_c - arc_p). */ target = MIN((int64_t)(meta_used - arc_meta_limit), - (int64_t)(refcount_count(&arc_mfu->arcs_size) - + (int64_t)(zfs_refcount_count(&arc_mfu->arcs_size) - (arc_c - arc_p))); total_evicted += arc_adjust_impl(arc_mfu, 0, target, ARC_BUFC_METADATA); @@ -4443,8 +4450,8 @@ arc_adjust(void) * arc_p here, and then evict more from the MFU below. */ target = MIN((int64_t)(asize - arc_c), - (int64_t)(refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); + (int64_t)(zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) + ameta - arc_p)); /* * If we're below arc_meta_min, always prefer to evict data. @@ -4534,8 +4541,8 @@ arc_adjust(void) * cache. The following logic enforces these limits on the ghost * caches, and evicts from them as needed. */ - target = refcount_count(&arc_mru->arcs_size) + - refcount_count(&arc_mru_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru->arcs_size) + + zfs_refcount_count(&arc_mru_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mru_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -4553,8 +4560,8 @@ arc_adjust(void) * mru + mfu + mru ghost + mfu ghost <= 2 * arc_c * mru ghost + mfu ghost <= arc_c */ - target = refcount_count(&arc_mru_ghost->arcs_size) + - refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; + target = zfs_refcount_count(&arc_mru_ghost->arcs_size) + + zfs_refcount_count(&arc_mfu_ghost->arcs_size) - arc_c; bytes = arc_adjust_impl(arc_mfu_ghost, 0, target, ARC_BUFC_DATA); total_evicted += bytes; @@ -5069,8 +5076,8 @@ arc_adapt(int bytes, arc_state_t *state) { int mult; uint64_t arc_p_min = (arc_c >> arc_p_min_shift); - int64_t mrug_size = refcount_count(&arc_mru_ghost->arcs_size); - int64_t mfug_size = refcount_count(&arc_mfu_ghost->arcs_size); + int64_t mrug_size = zfs_refcount_count(&arc_mru_ghost->arcs_size); + int64_t mfug_size = zfs_refcount_count(&arc_mfu_ghost->arcs_size); if (state == arc_l2c_only) return; @@ -5248,7 +5255,7 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (!GHOST_STATE(state)) { - (void) refcount_add_many(&state->arcs_size, size, tag); + (void) zfs_refcount_add_many(&state->arcs_size, size, tag); /* * If this is reached via arc_read, the link is @@ -5260,8 +5267,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * trying to [add|remove]_reference it. */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); - (void) refcount_add_many(&state->arcs_esize[type], + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + (void) zfs_refcount_add_many(&state->arcs_esize[type], size, tag); } @@ -5271,8 +5278,8 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v */ if (aggsum_upper_bound(&arc_size) < arc_c && hdr->b_l1hdr.b_state == arc_anon && - (refcount_count(&arc_anon->arcs_size) + - refcount_count(&arc_mru->arcs_size) > arc_p)) + (zfs_refcount_count(&arc_anon->arcs_size) + + zfs_refcount_count(&arc_mru->arcs_size) > arc_p)) arc_p = MIN(arc_c, arc_p + size); } ARCSTAT_BUMP(arcstat_allocated); @@ -5310,13 +5317,13 @@ arc_free_data_impl(arc_buf_hdr_t *hdr, uint64_t size, /* protected by hash lock, if in the hash table */ if (multilist_link_active(&hdr->b_l1hdr.b_arc_node)) { - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT(state != arc_anon && state != arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many(&state->arcs_esize[type], size, tag); } - (void) refcount_remove_many(&state->arcs_size, size, tag); + (void) zfs_refcount_remove_many(&state->arcs_size, size, tag); VERIFY3U(hdr->b_type, ==, type); if (type == ARC_BUFC_METADATA) { @@ -5363,7 +5370,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) * another prefetch (to make it less likely to be evicted). */ if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { - if (refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { /* link protected by hash lock */ ASSERT(multilist_link_active( &hdr->b_l1hdr.b_arc_node)); @@ -5404,7 +5411,7 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock) if (HDR_PREFETCH(hdr) || HDR_PRESCIENT_PREFETCH(hdr)) { new_state = arc_mru; - if (refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) { + if (zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) > 0) { arc_hdr_clear_flags(hdr, ARC_FLAG_PREFETCH | ARC_FLAG_PRESCIENT_PREFETCH); @@ -5678,7 +5685,7 @@ arc_read_done(zio_t *zio) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); } - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt) || callback_list != NULL); if (no_zio_error) { @@ -5689,7 +5696,7 @@ arc_read_done(zio_t *zio) arc_change_state(arc_anon, hdr, hash_lock); if (HDR_IN_HASH_TABLE(hdr)) buf_hash_remove(hdr); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* @@ -5709,7 +5716,7 @@ arc_read_done(zio_t *zio) * in the cache). */ ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); - freeable = refcount_is_zero(&hdr->b_l1hdr.b_refcnt); + freeable = zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt); } /* execute each callback and free its structure */ @@ -5875,7 +5882,7 @@ top: ASSERT((zio_flags & ZIO_FLAG_SPECULATIVE) || rc == 0 || rc != ENOENT); } else if (*arc_flags & ARC_FLAG_PREFETCH && - refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { + zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 0) { arc_hdr_set_flags(hdr, ARC_FLAG_PREFETCH); } DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr); @@ -5933,7 +5940,7 @@ top: ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); ASSERT(GHOST_STATE(hdr->b_l1hdr.b_state)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); - ASSERT(refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); ASSERT3P(hdr->b_l1hdr.b_buf, ==, NULL); ASSERT3P(hdr->b_l1hdr.b_freeze_cksum, ==, NULL); @@ -6154,10 +6161,10 @@ arc_add_prune_callback(arc_prune_func_t *func, void *p p->p_pfunc = func; p->p_private = private; list_link_init(&p->p_node); - refcount_create(&p->p_refcnt); + zfs_refcount_create(&p->p_refcnt); mutex_enter(&arc_prune_mtx); - refcount_add(&p->p_refcnt, &arc_prune_list); + zfs_refcount_add(&p->p_refcnt, &arc_prune_list); list_insert_head(&arc_prune_list, p); mutex_exit(&arc_prune_mtx); @@ -6170,15 +6177,15 @@ arc_remove_prune_callback(arc_prune_t *p) boolean_t wait = B_FALSE; mutex_enter(&arc_prune_mtx); list_remove(&arc_prune_list, p); - if (refcount_remove(&p->p_refcnt, &arc_prune_list) > 0) + if (zfs_refcount_remove(&p->p_refcnt, &arc_prune_list) > 0) wait = B_TRUE; mutex_exit(&arc_prune_mtx); /* wait for arc_prune_task to finish */ if (wait) taskq_wait(arc_prune_taskq); - ASSERT0(refcount_count(&p->p_refcnt)); - refcount_destroy(&p->p_refcnt); + ASSERT0(zfs_refcount_count(&p->p_refcnt)); + zfs_refcount_destroy(&p->p_refcnt); kmem_free(p, sizeof (*p)); } @@ -6221,7 +6228,7 @@ arc_freed(spa_t *spa, const blkptr_t *bp) * this hdr, then we don't destroy the hdr. */ if (!HDR_HAS_L1HDR(hdr) || (!HDR_IO_IN_PROGRESS(hdr) && - refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { + zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt))) { arc_change_state(arc_anon, hdr, hash_lock); arc_hdr_destroy(hdr); mutex_exit(hash_lock); @@ -6264,7 +6271,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT(!HDR_HAS_L2HDR(hdr)); ASSERT(HDR_EMPTY(hdr)); ASSERT3U(hdr->b_l1hdr.b_bufcnt, ==, 1); - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), ==, 1); ASSERT(!list_link_active(&hdr->b_l1hdr.b_arc_node)); hdr->b_l1hdr.b_arc_access = 0; @@ -6292,7 +6299,7 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(state, !=, arc_anon); /* this buffer is not on any list */ - ASSERT3S(refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); + ASSERT3S(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt), >, 0); if (HDR_HAS_L2HDR(hdr)) { mutex_enter(&hdr->b_l2hdr.b_dev->l2ad_mtx); @@ -6384,12 +6391,13 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL); ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_size, + (void) zfs_refcount_remove_many(&state->arcs_size, arc_buf_size(buf), buf); - if (refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { + if (zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)) { ASSERT3P(state, !=, arc_l2c_only); - (void) refcount_remove_many(&state->arcs_esize[type], + (void) zfs_refcount_remove_many( + &state->arcs_esize[type], arc_buf_size(buf), buf); } @@ -6408,21 +6416,21 @@ arc_release(arc_buf_t *buf, void *tag) nhdr = arc_hdr_alloc(spa, psize, lsize, compress, type); ASSERT3P(nhdr->b_l1hdr.b_buf, ==, NULL); ASSERT0(nhdr->b_l1hdr.b_bufcnt); - ASSERT0(refcount_count(&nhdr->b_l1hdr.b_refcnt)); + ASSERT0(zfs_refcount_count(&nhdr->b_l1hdr.b_refcnt)); VERIFY3U(nhdr->b_type, ==, type); ASSERT(!HDR_SHARED_DATA(nhdr)); nhdr->b_l1hdr.b_buf = buf; nhdr->b_l1hdr.b_bufcnt = 1; - (void) refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); + (void) zfs_refcount_add(&nhdr->b_l1hdr.b_refcnt, tag); buf->b_hdr = nhdr; mutex_exit(&buf->b_evict_lock); - (void) refcount_add_many(&arc_anon->arcs_size, + (void) zfs_refcount_add_many(&arc_anon->arcs_size, arc_buf_size(buf), buf); } else { mutex_exit(&buf->b_evict_lock); - ASSERT(refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); + ASSERT(zfs_refcount_count(&hdr->b_l1hdr.b_refcnt) == 1); /* protected by hash lock, or hdr is on arc_anon */ ASSERT(!multilist_link_active(&hdr->b_l1hdr.b_arc_node)); ASSERT(!HDR_IO_IN_PROGRESS(hdr)); @@ -6454,7 +6462,7 @@ arc_referenced(arc_buf_t *buf) int referenced; mutex_enter(&buf->b_evict_lock); - referenced = (refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); + referenced = (zfs_refcount_count(&buf->b_hdr->b_l1hdr.b_refcnt)); mutex_exit(&buf->b_evict_lock); return (referenced); } @@ -6469,7 +6477,7 @@ arc_write_ready(zio_t *zio) uint64_t psize = BP_IS_HOLE(zio->io_bp) ? 0 : BP_GET_PSIZE(zio->io_bp); ASSERT(HDR_HAS_L1HDR(hdr)); - ASSERT(!refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&buf->b_hdr->b_l1hdr.b_refcnt)); ASSERT(hdr->b_l1hdr.b_bufcnt > 0); /* @@ -6624,7 +6632,7 @@ arc_write_done(zio_t *zio) if (!BP_EQUAL(&zio->io_bp_orig, zio->io_bp)) panic("bad overwrite, hdr=%p exists=%p", (void *)hdr, (void *)exists); - ASSERT(refcount_is_zero( + ASSERT(zfs_refcount_is_zero( &exists->b_l1hdr.b_refcnt)); arc_change_state(arc_anon, exists, hash_lock); mutex_exit(hash_lock); @@ -6654,7 +6662,7 @@ arc_write_done(zio_t *zio) arc_hdr_clear_flags(hdr, ARC_FLAG_IO_IN_PROGRESS); } - ASSERT(!refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); + ASSERT(!zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt)); callback->awcb_done(zio, buf, callback->awcb_private); abd_put(zio->io_abd); @@ -6800,7 +6808,7 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui /* assert that it has not wrapped around */ ASSERT3S(atomic_add_64_nv(&arc_loaned_bytes, 0), >=, 0); - anon_size = MAX((int64_t)(refcount_count(&arc_anon->arcs_size) - + anon_size = MAX((int64_t)(zfs_refcount_count(&arc_anon->arcs_size) - arc_loaned_bytes), 0); /* @@ -6835,9 +6843,10 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, ui anon_size > arc_c * zfs_arc_anon_limit_percent / 100 && spa_dirty_anon > anon_size * zfs_arc_pool_dirty_percent / 100) { uint64_t meta_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count( + &arc_anon->arcs_esize[ARC_BUFC_METADATA]); uint64_t data_esize = - refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]); dprintf("failing, arc_tempreserve=%lluK anon_meta=%lluK " "anon_data=%lluK tempreserve=%lluK arc_c=%lluK\n", arc_tempreserve >> 10, meta_esize >> 10, @@ -6852,11 +6861,11 @@ static void arc_kstat_update_state(arc_state_t *state, kstat_named_t *size, kstat_named_t *evict_data, kstat_named_t *evict_metadata) { - size->value.ui64 = refcount_count(&state->arcs_size); + size->value.ui64 = zfs_refcount_count(&state->arcs_size); evict_data->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_DATA]); evict_metadata->value.ui64 = - refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_count(&state->arcs_esize[ARC_BUFC_METADATA]); } static int @@ -7025,25 +7034,25 @@ arc_state_init(void) offsetof(arc_buf_hdr_t, b_l1hdr.b_arc_node), arc_state_multilist_index_func); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_create(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_create(&arc_anon->arcs_size); - refcount_create(&arc_mru->arcs_size); - refcount_create(&arc_mru_ghost->arcs_size); - refcount_create(&arc_mfu->arcs_size); - refcount_create(&arc_mfu_ghost->arcs_size); - refcount_create(&arc_l2c_only->arcs_size); + zfs_refcount_create(&arc_anon->arcs_size); + zfs_refcount_create(&arc_mru->arcs_size); + zfs_refcount_create(&arc_mru_ghost->arcs_size); + zfs_refcount_create(&arc_mfu->arcs_size); + zfs_refcount_create(&arc_mfu_ghost->arcs_size); + zfs_refcount_create(&arc_l2c_only->arcs_size); aggsum_init(&arc_meta_used, 0); aggsum_init(&arc_size, 0); @@ -7059,25 +7068,25 @@ arc_state_init(void) static void arc_state_fini(void) { - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); - refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_anon->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mru_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_esize[ARC_BUFC_DATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_METADATA]); + zfs_refcount_destroy(&arc_l2c_only->arcs_esize[ARC_BUFC_DATA]); - refcount_destroy(&arc_anon->arcs_size); - refcount_destroy(&arc_mru->arcs_size); - refcount_destroy(&arc_mru_ghost->arcs_size); - refcount_destroy(&arc_mfu->arcs_size); - refcount_destroy(&arc_mfu_ghost->arcs_size); - refcount_destroy(&arc_l2c_only->arcs_size); + zfs_refcount_destroy(&arc_anon->arcs_size); + zfs_refcount_destroy(&arc_mru->arcs_size); + zfs_refcount_destroy(&arc_mru_ghost->arcs_size); + zfs_refcount_destroy(&arc_mfu->arcs_size); + zfs_refcount_destroy(&arc_mfu_ghost->arcs_size); + zfs_refcount_destroy(&arc_l2c_only->arcs_size); multilist_destroy(arc_mru->arcs_list[ARC_BUFC_METADATA]); multilist_destroy(arc_mru_ghost->arcs_list[ARC_BUFC_METADATA]); @@ -7359,8 +7368,8 @@ arc_fini(void) mutex_enter(&arc_prune_mtx); while ((p = list_head(&arc_prune_list)) != NULL) { list_remove(&arc_prune_list, p); - refcount_remove(&p->p_refcnt, &arc_prune_list); - refcount_destroy(&p->p_refcnt); + zfs_refcount_remove(&p->p_refcnt, &arc_prune_list); + zfs_refcount_destroy(&p->p_refcnt); kmem_free(p, sizeof (*p)); } mutex_exit(&arc_prune_mtx); @@ -7787,7 +7796,7 @@ top: ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr)); bytes_dropped += arc_hdr_size(hdr); - (void) refcount_remove_many(&dev->l2ad_alloc, + (void) zfs_refcount_remove_many(&dev->l2ad_alloc, arc_hdr_size(hdr), hdr); } @@ -8205,7 +8214,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint list_insert_head(&dev->l2ad_buflist, hdr); mutex_exit(&dev->l2ad_mtx); - (void) refcount_add_many(&dev->l2ad_alloc, psize, hdr); + (void) zfs_refcount_add_many(&dev->l2ad_alloc, psize, + hdr); /* * Normally the L2ARC can use the hdr's data, but if @@ -8439,7 +8449,7 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) offsetof(arc_buf_hdr_t, b_l2hdr.b_l2node)); vdev_space_update(vd, 0, 0, adddev->l2ad_end - adddev->l2ad_hand); - refcount_create(&adddev->l2ad_alloc); + zfs_refcount_create(&adddev->l2ad_alloc); /* * Add device to global list @@ -8485,7 +8495,7 @@ l2arc_remove_vdev(vdev_t *vd) l2arc_evict(remdev, 0, B_TRUE); list_destroy(&remdev->l2ad_buflist); mutex_destroy(&remdev->l2ad_mtx); - refcount_destroy(&remdev->l2ad_alloc); + zfs_refcount_destroy(&remdev->l2ad_alloc); kmem_free(remdev, sizeof (l2arc_dev_t)); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Nov 5 07:06:45 2019 (r354353) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Nov 5 07:11:12 2019 (r354354) @@ -226,7 +226,7 @@ static boolean_t dbuf_evict_thread_exit; */ typedef struct dbuf_cache { multilist_t *cache; - refcount_t size; + zfs_refcount_t size; } dbuf_cache_t; dbuf_cache_t dbuf_caches[DB_CACHE_MAX]; @@ -316,7 +316,7 @@ dbuf_cons(void *vdb, void *unused, int kmflag) mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); multilist_link_init(&db->db_cache_link); - refcount_create(&db->db_holds); + zfs_refcount_create(&db->db_holds); return (0); } @@ -329,7 +329,7 @@ dbuf_dest(void *vdb, void *unused) mutex_destroy(&db->db_mtx); cv_destroy(&db->db_changed); ASSERT(!multilist_link_active(&db->db_cache_link)); - refcount_destroy(&db->db_holds); + zfs_refcount_destroy(&db->db_holds); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Nov 5 07:13:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7919D179374; Tue, 5 Nov 2019 07:13:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476gqS2jd3z3wkJ; Tue, 5 Nov 2019 07:13:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40DEC916A; Tue, 5 Nov 2019 07:13:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA57D8up013794; Tue, 5 Nov 2019 07:13:08 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA57D8ri013793; Tue, 5 Nov 2019 07:13:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911050713.xA57D8ri013793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 07:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354355 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:13:08 -0000 Author: avg Date: Tue Nov 5 07:13:07 2019 New Revision: 354355 URL: https://svnweb.freebsd.org/changeset/base/354355 Log: MFC r353629: MFV r353628: 10842 Mutex leak in dsl_dataset_hold_obj() Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Nov 5 07:11:12 2019 (r354354) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Nov 5 07:13:07 2019 (r354355) @@ -573,10 +573,14 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, v if (ds->ds_prev) dsl_dataset_rele(ds->ds_prev, ds); dsl_dir_rele(ds->ds_dir, ds); + list_destroy(&ds->ds_prop_cbs); + list_destroy(&ds->ds_sendstreams); mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); mutex_destroy(&ds->ds_sendstream_lock); + mutex_destroy(&ds->ds_remap_deadlist_lock); zfs_refcount_destroy(&ds->ds_longholds); + rrw_destroy(&ds->ds_bp_rwlock); kmem_free(ds, sizeof (dsl_dataset_t)); if (err != 0) { dmu_buf_rele(dbuf, tag); From owner-svn-src-all@freebsd.org Tue Nov 5 07:16:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C65FE179493 for ; Tue, 5 Nov 2019 07:16:04 +0000 (UTC) (envelope-from natchathidt@kh.cootel.com) Received: from mail.cootel.com (khmail.cootel.com [103.5.124.252]) by mx1.freebsd.org (Postfix) with ESMTP id 476gtq0b7zz3wsw for ; Tue, 5 Nov 2019 07:16:02 +0000 (UTC) (envelope-from natchathidt@kh.cootel.com) Received: from [162.255.84.252] ([162.255.84.252]) by mail.cootel.com (IBM Domino Release 9.0.1) with ESMTP id 2019110514114254-610116 ; Tue, 5 Nov 2019 14:11:42 +0700 MIME-Version: 1.0 Subject: From:Ms.Natcha.t To: svn-src-all@freebsd.org From: "Natcha Thitadat" Date: Tue, 05 Nov 2019 07:00:50 +0000 Reply-To: natchathid@nttd.biz X-MIMETrack: Itemize by SMTP Server on Mail01/Server/Cootel(Release 9.0.1|October 14, 2013) at 11/05/2019 02:11:42 PM, Serialize by Router on Mail01/Server/Cootel(Release 9.0.1|October 14, 2013) at 11/05/2019 02:26:53 PM, Serialize complete at 11/05/2019 02:26:53 PM Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Content-Description: Mail message body X-Rspamd-Queue-Id: 476gtq0b7zz3wsw X-Spamd-Bar: +++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of natchathidt@kh.cootel.com has no SPF policy when checking 103.5.124.252) smtp.mailfrom=natchathidt@kh.cootel.com X-Spamd-Result: default: False [7.88 / 15.00]; HAS_REPLYTO(0.00)[natchathid@nttd.biz]; TO_DN_NONE(0.00)[]; HFILTER_HELO_IP_A(1.00)[mail.cootel.com]; HFILTER_HELO_NORES_A_OR_MX(0.30)[mail.cootel.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.02)[country: KH(0.10)]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:58424, ipnet:103.5.124.0/24, country:KH]; INTRODUCTION(2.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cootel.com]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.57)[0.566,0]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; NEURAL_SPAM_LONG(1.00)[1.000,0]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[252.124.5.103.list.dnswl.org : 127.0.10.0]; R_SPF_NA(0.00)[]; RBL_SENDERSCORE(2.00)[252.124.5.103.bl.score.senderscore.com]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body] X-Spam: Yes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 07:16:04 -0000 Good Day, How are you?I am Ms.Natcha and will like to have a little discussion with y= ou if you don't mind because I am so happy to come across your contact toda= y. Thanks and have a lovely day, Ms.Natcha. From owner-svn-src-all@freebsd.org Tue Nov 5 08:53:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B13AA17CE93; Tue, 5 Nov 2019 08:53:40 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476k3S43r1z428x; Tue, 5 Nov 2019 08:53:40 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F25EA352; Tue, 5 Nov 2019 08:53:40 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA58reE3073237; Tue, 5 Nov 2019 08:53:40 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA58re6X073236; Tue, 5 Nov 2019 08:53:40 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201911050853.xA58re6X073236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Tue, 5 Nov 2019 08:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354356 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: maxim X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 354356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 08:53:40 -0000 Author: maxim Date: Tue Nov 5 08:53:40 2019 New Revision: 354356 URL: https://svnweb.freebsd.org/changeset/base/354356 Log: o OpenBSD 6.6 and FreeBSD 12.1 releases added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Tue Nov 5 07:13:07 2019 (r354355) +++ head/share/misc/bsd-family-tree Tue Nov 5 08:53:40 2019 (r354356) @@ -394,13 +394,17 @@ FreeBSD 5.2 | | | | | | | | | DragonFly 5.4.0 *--FreeBSD | | | v | | | 12.0 | | | | DragonFly 5.4.1 - | | | | OpenBSD 6.5 | - | | | | | | - | | | NetBSD | | - | | | 8.1 | DragonFly 5.6 + | | | | | OpenBSD 6.5 | + | | | | | | | + | | | | NetBSD | | + | | | | 8.1 | DragonFly 5.6 + | | | | | | + | | | | | DragonFly 5.6.1 + | FreeBSD | | OpenBSD 6.6 | + | 12.1 | | | | + | | | | | | + | v | | | | | | | | | - | | | | DragonFly 5.6.1 - | | | | | FreeBSD 13 -current | NetBSD -current OpenBSD -current DragonFly -current | | | | | v v v v v @@ -786,6 +790,8 @@ OpenBSD 6.5 2019-05-01 [OBD] NetBSD 8.1 2019-06-04 [NBD] DragonFly 5.6 2019-06-17 [DFB] DragonFly 5.6.1 2019-06-19 [DFB] +OpenBSD 6.6 2019-10-17 [OBD] +FreeBSD 12.1 2019-11-04 [FBD] Bibliography ------------------------ From owner-svn-src-all@freebsd.org Tue Nov 5 10:53:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A65251A2437; Tue, 5 Nov 2019 10:53:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476mkD3x2Kz48hG; Tue, 5 Nov 2019 10:53:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A554B8E2; Tue, 5 Nov 2019 10:53:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5AruFJ044830; Tue, 5 Nov 2019 10:53:56 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5Arutf044828; Tue, 5 Nov 2019 10:53:56 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911051053.xA5Arutf044828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 5 Nov 2019 10:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354357 - head/tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 10:53:56 -0000 Author: bz Date: Tue Nov 5 10:53:55 2019 New Revision: 354357 URL: https://svnweb.freebsd.org/changeset/base/354357 Log: frag6 tests: set end to catch timeout as error There are times when we have to wait for reply packets. There are either an ICMPv6 (error) reply or the expiration timeout. In these cases synchonous ICMPv6 replies should arrive, always, unless the packet is lost. Due to errors experienced with the test software sending an invlaid request on at least i386 (*) these packets are not generated. That means we are waiting for a long time for the replies or even timeout the test case. Manually set the "End" flag on these test cases as well, so they do fail rather than timeout as the sniffer timeout happens. This improves debugging options, reflects the error properly, and saves time on each test suit run. (*) The real cause for that is still to be found (see the referenced PRs) PR: 241493, 239380 MFC after: 2 weeks Sponsored by: Netflix Modified: head/tests/sys/netinet6/frag6/frag6_02.py head/tests/sys/netinet6/frag6/frag6_04.py Modified: head/tests/sys/netinet6/frag6/frag6_02.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_02.py Tue Nov 5 08:53:40 2019 (r354356) +++ head/tests/sys/netinet6/frag6/frag6_02.py Tue Nov 5 10:53:55 2019 (r354357) @@ -98,6 +98,7 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sleep(0.10) + sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: sys.exit(1) Modified: head/tests/sys/netinet6/frag6/frag6_04.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_04.py Tue Nov 5 08:53:40 2019 (r354356) +++ head/tests/sys/netinet6/frag6/frag6_04.py Tue Nov 5 10:53:55 2019 (r354357) @@ -95,6 +95,7 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sleep(0.10) + sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: sys.exit(1) From owner-svn-src-all@freebsd.org Tue Nov 5 10:59:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9EF11A2665; Tue, 5 Nov 2019 10:59:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476mrk4Rc8z48tQ; Tue, 5 Nov 2019 10:59:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B21B8F5; Tue, 5 Nov 2019 10:59:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5AxYEf045161; Tue, 5 Nov 2019 10:59:34 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5AxXw2045159; Tue, 5 Nov 2019 10:59:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911051059.xA5AxXw2045159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 5 Nov 2019 10:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354358 - head/tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6 X-SVN-Commit-Revision: 354358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 10:59:34 -0000 Author: bz Date: Tue Nov 5 10:59:33 2019 New Revision: 354358 URL: https://svnweb.freebsd.org/changeset/base/354358 Log: ip6 tests: Add very simplistic extension header tests Add a simple test case which can exercise some of the IPv6 extension header code paths. At the moment only a small set of extension headers is implemented and no options to the ones which take them. Also implements a "bad" case to make sure that error handling works. The tests were used to test m_pullup() changes to the code paths while removing the KAME PULLDOWN_TEST cases and related macros. MFC after: 3 weeks Sponsored by: Netflix Added: head/tests/sys/netinet6/exthdr.py (contents, props changed) head/tests/sys/netinet6/exthdr.sh (contents, props changed) Modified: head/tests/sys/netinet6/Makefile Modified: head/tests/sys/netinet6/Makefile ============================================================================== --- head/tests/sys/netinet6/Makefile Tue Nov 5 10:53:55 2019 (r354357) +++ head/tests/sys/netinet6/Makefile Tue Nov 5 10:59:33 2019 (r354358) @@ -1,6 +1,16 @@ # $FreeBSD$ +PACKAGE= tests + TESTSDIR= ${TESTSBASE}/sys/netinet6 +FILESDIR= ${TESTSDIR} + +ATF_TESTS_SH= \ + exthdr + +${PACKAGE}FILES+= exthdr.py + +${PACKAGE}FILESMODE_exthdr.py= 0555 TESTS_SUBDIRS+= frag6 Added: head/tests/sys/netinet6/exthdr.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/exthdr.py Tue Nov 5 10:59:33 2019 (r354358) @@ -0,0 +1,273 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys +import frag6.sniffer as Sniffer +from time import sleep + +def check_icmp6_error_dst_unreach_noport(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6DestUnreach) + if not icmp6: + return False + # ICMP6_DST_UNREACH_NOPORT 4 + if icmp6.code != 4: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Dest Unreach / Port Unreach so leave it. + #icmp6.display() + return True + +def check_icmp6_error_paramprob_header(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6ParamProblem) + if not icmp6: + return False + # ICMP6_PARAMPROB_HEADER 0 + if icmp6.code != 0: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Param Prob so leave it. + #icmp6.display() + return True + +def check_tcp_rst(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + tcp = packet.getlayer(sp.TCP) + if not tcp: + return False + # Is TCP RST? + if tcp.flags & 0x04: + #tcp.display() + return True + return False + +def addExt(ext, h): + if h is None: + return ext + if ext is None: + ext = h + else: + ext = ext / h + return ext + +def getExtHdrs(args): + ext = None + + # XXX-TODO Try to put them in an order which could make sense + # in real life packets and according to the RFCs. + if args.hbh: + hbh = sp.IPv6ExtHdrHopByHop(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) + ext = addExt(ext, hbh) + + if args.rh: + rh = sp.IPv6ExtHdrRouting(type = 0) + ext = addExt(ext, rh) + + if args.frag6: + frag6 = sp.IPv6ExtHdrFragment(offset=0, m=0, id=0x1234) + ext = addExt(ext, frag6) + + if args.esp: + # XXX TODO + esp = None + ext = addExt(ext, esp) + + if args.ah: + # XXX TODO + ah = None + ext = addExt(ext, ah) + + if args.dest: + dest = sp.IPv6ExtHdrDestOpt(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) + ext = addExt(ext, dest) + + if args.mobi: + # XXX TODO + mobi = None + ext = addExt(ext, mobi) + + if args.hip: + # XXX TODO + hip = None + ext = addExt(ext, hip) + + if args.shim6: + # XXX TODO + shim6 = None + ext = addExt(ext, shim6) + + if args.proto253: + # XXX TODO + tft = None + ext = addExt(ext, tft) + + if args.proto254: + # XXX TODO + tff = None + ext = addExt(ext, tff) + + if args.hbhbad: + hbhbad = sp.IPv6ExtHdrHopByHop(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) + ext = addExt(ext, hbhbad) + + return ext + +def main(): + parser = argparse.ArgumentParser("exthdr.py", + description="IPv6 extension header test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + # Extension Headers + # See https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml + parser.add_argument('--hbh', + required=False, action='store_true', + help='Add IPv6 Hop-by-Hop Option') + parser.add_argument('--hbhbad', + required=False, action='store_true', + help='Add IPv6 Hop-by-Hop Option at an invalid position') + parser.add_argument('--rh', + required=False, action='store_true', + help='Add Routing Header for IPv6') + parser.add_argument('--frag6', + required=False, action='store_true', + help='Add Fragment Header for IPv6') + parser.add_argument('--esp', + required=False, action='store_true', + help='Add Encapsulating Security Payload') + parser.add_argument('--ah', + required=False, action='store_true', + help='Add Authentication Header') + parser.add_argument('--dest', + required=False, action='store_true', + help='Add Destination Options for IPv6') + parser.add_argument('--mobi', + required=False, action='store_true', + help='Add Mobility Header') + parser.add_argument('--hip', + required=False, action='store_true', + help='Add Host Identity Protocol') + parser.add_argument('--shim6', + required=False, action='store_true', + help='Add Shim6 Protocol') + parser.add_argument('--proto253', + required=False, action='store_true', + help='Use for experimentation and testing (253)') + parser.add_argument('--proto254', + required=False, action='store_true', + help='Use for experimentation and testing (254)') + + args = parser.parse_args() + + if args.hbhbad: + ok = 0 + else: + ok = 1 + + ######################################################################## + # + # Send IPv6 packets with one or more extension headers (combinations + # mmight not always make sense depending what user tells us). + # We are trying to cover the basic loop and passing mbufs on + # and making sure m_pullup() works. + # Try for at least UDP and TCP upper layer payloads. + # + # Expectations: no panics + # We are not testing for any other outcome here. + # + data = "6" * 88 + udp = sp.UDP(dport=3456, sport=6543) / data + tcp = sp.TCP(dport=4567, sport=7654) + ip6 = sp.Ether() / sp.IPv6(src=args.src[0], dst=args.to[0]) + for ulp in [ udp, tcp ]: + ext = getExtHdrs(args) + if ext is not None: + pkt = ip6 / ext / ulp + else: + pkt = ip6 / ulp + if args.debug : + pkt.display() + if not ok: + sc = check_icmp6_error_paramprob_header; + elif ulp == udp: + sc = check_icmp6_error_dst_unreach_noport; + elif ulp == tcp: + sc = check_tcp_rst; + else: + sys.exit(2) + # Start sniffing on recvif + sniffer = Sniffer.Sniffer(args, sc) + sp.sendp(pkt, iface=args.sendif[0], verbose=False) + sleep(0.10) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(not ok) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/exthdr.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/exthdr.sh Tue Nov 5 10:59:33 2019 (r354358) @@ -0,0 +1,124 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# 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. +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "exthdr" "cleanup" +exthdr_head() { + + atf_set descr 'Test IPv6 fragmentation code' + atf_set require.user root + atf_set require.progs scapy +} + +exthdr_body() { + + ids=65533 + id=`printf "%x" ${ids}` + if [ $$ -gt 65535 ]; then + xl=`printf "%x" $(($$ - 65535))` + yl="1" + else + xl=`printf "%x" $$` + yl="" + fi + + vnet_init + + ip6a="2001:db8:6666:0000:${yl}:${id}:1:${xl}" + ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}" + + epair=$(vnet_mkepair) + ifconfig ${epair}a mtu 131071 up + ifconfig ${epair}a inet6 ${ip6a}/64 + + jname="v6t-${id}-${yl}-${xl}" + vnet_mkjail ${jname} ${epair}b + jexec ${jname} ifconfig ${epair}b mtu 131071 up + jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 + + # Let IPv6 ND do its thing. + #ping6 -q -c 1 ff02::1%${epair}a + #ping6 -q -c 1 ${ip6b} + sleep 3 + + # Clear statistics. + jexec ${jname} netstat -z -s > /dev/null + + # Run fragment tests. + pyname=$(atf_get ident) + pyname=${pyname%*_[0-9]} + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --hbh + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --rh + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --frag6 + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --dest + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --hbh --dest + + atf_check -s exit:1 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} \ + --dest --hbhbad + +} + +exthdr_cleanup() { + + vnet_cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case "exthdr" +} + +# end From owner-svn-src-all@freebsd.org Tue Nov 5 13:14:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5B861A6D2E; Tue, 5 Nov 2019 13:14:03 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::602]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 476qqv3rsvz4J8g; Tue, 5 Nov 2019 13:14:03 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback29j.mail.yandex.net (mxback29j.mail.yandex.net [IPv6:2a02:6b8:0:1619::229]) by forward102o.mail.yandex.net (Yandex) with ESMTP id A44B96680A11; Tue, 5 Nov 2019 16:13:59 +0300 (MSK) Received: from sas1-e6a95a338f12.qloud-c.yandex.net (sas1-e6a95a338f12.qloud-c.yandex.net [2a02:6b8:c08:37a4:0:640:e6a9:5a33]) by mxback29j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id A7DvGFdAf4-Dx6m4t7B; Tue, 05 Nov 2019 16:13:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1572959639; bh=IUTD3AU29O+hu/jm3lLgn3Cq5CTb6vJCA9nH7tE52to=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=blM4M/uXAIZQl20/wbEdJAp5scMf9j6mmDlhle87/GQn24Ahxomh469EeUF9itnYG tcBV4jOE+Cm9RvMZf3AYpL/+e5Z45hBi4iCBwjhWLQQyws5wvShweCcWPmko51x3Fk zJykTUAQteZvPkYIi71tMB/XcJnR5KcxtKO0VKL0= Received: by sas1-e6a95a338f12.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id 50vxwinftq-Dw0SmfYv; Tue, 05 Nov 2019 16:13:59 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Subject: Re: svn commit: r354333 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911041330.xA4DUbnB059737@repo.freebsd.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0JUFuZHJleSBWLiBFbHN1a292IDxidTdjaGVyQHlhbmRleC5ydT6JATgEEwECACIFAkwB F1kCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEAHF6gQQyKF6qmYIAI6ekfm1VA4T vqankI1ISE6ku4jV7UlpIQlEbE7/8n3Zd6teJ+pGOQhN5qk8QE7utdPdbktAzi+x7LIJVzUw 4TywZLXGrkP7VKYkfg6oyCGyzITghefQeJtr2TN4hYCkzPWpylkue8MtmqfZv/6royqwTbN+ +E09FQNvTgRUYJYTeQ1qOsxNRycwvw3dr2rOfuxShbzaHBB1pBIjGrMg8fC5pd65ACH5zuFV A0CoTNGMDrEZSfBkTW604UUHFFXeCoC3dwDZRKOWJ3GmMXns65Ai5YkA63BSHEE1Qle3VBhd cG1w0CB5FBV3pB27UVnf0jEbysrDqW4qN7XMRFSWNAy5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <29fe0e3e-44a6-5197-8252-f0ee3d12e743@yandex.ru> Date: Tue, 5 Nov 2019 16:13:03 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201911041330.xA4DUbnB059737@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JUIUvU2eZtR816nFOVzrWk73B6jneKbrF" X-Rspamd-Queue-Id: 476qqv3rsvz4J8g X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 13:14:03 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JUIUvU2eZtR816nFOVzrWk73B6jneKbrF Content-Type: multipart/mixed; boundary="JLyE7F5K2mUOE9jnMteIOEZ5kAAdmcmbx"; protected-headers="v1" From: "Andrey V. Elsukov" To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <29fe0e3e-44a6-5197-8252-f0ee3d12e743@yandex.ru> Subject: Re: svn commit: r354333 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys References: <201911041330.xA4DUbnB059737@repo.freebsd.org> In-Reply-To: <201911041330.xA4DUbnB059737@repo.freebsd.org> --JLyE7F5K2mUOE9jnMteIOEZ5kAAdmcmbx Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 04.11.2019 16:30, Andriy Gapon wrote: > Author: avg > Date: Mon Nov 4 13:30:37 2019 > New Revision: 354333 > URL: https://svnweb.freebsd.org/changeset/base/354333 >=20 > Log: > zfs: enable SPA_PROCESS on the kernel side > =20 > The purpose of this change is to group kernelthreads specific to a > particular ZFS pool under a kernel process. There can be many dozens= of > threads per pool. This change improves observability of those thread= s. > =20 > This change consists of several subchanges: > 1. illumos taskq_create_proc can now pass its process parameter to > taskqueue. Also, use zfsproc instead of NULL for taskq_create. Cave= at: > zfsproc might not be initialized yet. But in that case it is still N= ULL, > so not worse than before. This commit probably breaks dtrace module loading: link_elf_obj: symbol zfsproc undefined linker_load_file: /boot/kernel/dtrace.ko - unsupported file type KLD dtraceall.ko: depends on dtrace - not available or version mismatch linker_load_file: /boot/kernel/dtraceall.ko - unsupported file type Does it works for you and this is my local problem? --=20 WBR, Andrey V. Elsukov --JLyE7F5K2mUOE9jnMteIOEZ5kAAdmcmbx-- --JUIUvU2eZtR816nFOVzrWk73B6jneKbrF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAl3BdV8ACgkQAcXqBBDI oXreEQf+M2cLsKDvWM2pd3Dx5NZfxvJBATpJAN/pIUP7G5g9PiRgT9XedGVUQhi7 fph8XruKIpAwLAqld3ggejhtWR/l7N6PuOJ5/RWehEic1wzGipp9tO6TJKzh4kjq PtnWGoulomsHKWSRLQkuotDx1u/iuNiDnqkeQ1HrtweMkzwj5WbO1Vx7h+bzeM1v h0Pskr43GL5mNw3qdUsDCVia1Ma16gHnSpVb52BQCQHufEBD+eAwMQ7cfe2veTug cZxlcGBddBoS5G2Axn9/E19L3wHfZVCqjWMlgIlQnaL2UIqclWT+inahaGMLZaRF kJJKvA5wm5FMi9oxUdIf7YPfdgHdfA== =YzlS -----END PGP SIGNATURE----- --JUIUvU2eZtR816nFOVzrWk73B6jneKbrF-- From owner-svn-src-all@freebsd.org Tue Nov 5 13:39:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF4121A7CEF; Tue, 5 Nov 2019 13:39:53 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476rPh5GRyz4KXH; Tue, 5 Nov 2019 13:39:52 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f193.google.com with SMTP id n21so8255328ljg.12; Tue, 05 Nov 2019 05:39:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=OvRM6os54a0cGtev6IQV5mh/woIWtu4sSdQbCotDnPw=; b=a9HllqqXO+pwXcLbRfKvqNmwtURIlhlL6DesNEkbgVvqkBvAfoiPlZKgJDA6f67swM iEiRa6QI+LJAKIjVsd56i0Hd6RYX3k/mV/1s1u8Xw8c/lcmy8n5cAwMbInRfDtIQD9Ea jMTvq6C4jX7OFOiQKrYBZAhxqMrC/H4dwaJBjSg+vl6G34i+FKpUlLJSK+YjT4vVHTdQ SR8m4GEV5wBOdlt1nnsctKWB4Ptj2R5bPSh38lLL2ow3zZo0BjF1KOonr8DQHBAzn285 0TN0YkZwmL5vstTGVmfYPnKhr+Ml6AlMJ5tEqe2tOMT/9reQiyz1vA0eMf1Ilqpzb0A3 XBbw== X-Gm-Message-State: APjAAAWzgoWZK5v+2AdR43T2rVay6WJz5c+Je8aS+nkk6tnBsFpmx5Oq M/VUJ43NdPwoEHTCe99NTWgEIxb5bIA= X-Google-Smtp-Source: APXvYqyIecSy4KVb9N3GryQy+poE2z3fXl4v81rT7fqsDazOanbXlqMH3/1C8bWdI0zwCeOUD6slEA== X-Received: by 2002:a2e:890e:: with SMTP id d14mr11601498lji.6.1572961190491; Tue, 05 Nov 2019 05:39:50 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id u2sm3449329ljg.34.2019.11.05.05.39.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Nov 2019 05:39:49 -0800 (PST) Subject: Re: svn commit: r354333 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys To: "Andrey V. Elsukov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201911041330.xA4DUbnB059737@repo.freebsd.org> <29fe0e3e-44a6-5197-8252-f0ee3d12e743@yandex.ru> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Tue, 5 Nov 2019 15:39:48 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <29fe0e3e-44a6-5197-8252-f0ee3d12e743@yandex.ru> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 476rPh5GRyz4KXH X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.193 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; IP_SCORE(-1.13)[ip: (-0.39), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.02), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; FREEMAIL_TO(0.00)[yandex.ru]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 13:39:53 -0000 On 05/11/2019 15:13, Andrey V. Elsukov wrote: > On 04.11.2019 16:30, Andriy Gapon wrote: >> Author: avg >> Date: Mon Nov 4 13:30:37 2019 >> New Revision: 354333 >> URL: https://svnweb.freebsd.org/changeset/base/354333 >> >> Log: >> zfs: enable SPA_PROCESS on the kernel side >> >> The purpose of this change is to group kernelthreads specific to a >> particular ZFS pool under a kernel process. There can be many dozens of >> threads per pool. This change improves observability of those threads. >> >> This change consists of several subchanges: >> 1. illumos taskq_create_proc can now pass its process parameter to >> taskqueue. Also, use zfsproc instead of NULL for taskq_create. Caveat: >> zfsproc might not be initialized yet. But in that case it is still NULL, >> so not worse than before. > This commit probably breaks dtrace module loading: > > link_elf_obj: symbol zfsproc undefined > linker_load_file: /boot/kernel/dtrace.ko - unsupported file type > KLD dtraceall.ko: depends on dtrace - not available or version mismatch > linker_load_file: /boot/kernel/dtraceall.ko - unsupported file type > > Does it works for you and this is my local problem? I am seeing this too on a cleanly installed system with GENERIC. Maybe I didn't see the problem earlier because I have ZFS in kernel... Anyway, I am working on a fix. -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Nov 5 14:35:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7816D1A96EF; Tue, 5 Nov 2019 14:35:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476sdJ2fLtz4NYF; Tue, 5 Nov 2019 14:35:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F0C0E25A; Tue, 5 Nov 2019 14:35:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5EZ0nl074479; Tue, 5 Nov 2019 14:35:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5EYxwx074461; Tue, 5 Nov 2019 14:34:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911051434.xA5EYxwx074461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 5 Nov 2019 14:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354359 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 14:35:00 -0000 Author: avg Date: Tue Nov 5 14:34:59 2019 New Revision: 354359 URL: https://svnweb.freebsd.org/changeset/base/354359 Log: fix up r354333, make zfsproc visible to dtrace, rename to system_proc I overlooked the fact that zfsproc is required by dtrace modules that use illumos compatible taskq KPI. So, move the symbol definition to the opensolaris module that provides compatibility support for both ZFS and DTrace. Also, rename zfsproc to system_proc to reflect that it is not specific to ZFS. Reported by: ae MFC after: 5 weeks X-MFC with: ae Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Tue Nov 5 10:59:33 2019 (r354358) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Tue Nov 5 14:34:59 2019 (r354359) @@ -42,6 +42,8 @@ static uma_zone_t taskq_zone; taskq_t *system_taskq = NULL; +struct proc *system_proc; + static void system_taskq_init(void *arg) { @@ -84,7 +86,7 @@ taskq_t * taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, int maxalloc __unused, uint_t flags) { - return (taskq_create_impl(name, nthreads, pri, zfsproc, flags)); + return (taskq_create_impl(name, nthreads, pri, system_proc, flags)); } taskq_t * Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Tue Nov 5 10:59:33 2019 (r354358) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Tue Nov 5 14:34:59 2019 (r354359) @@ -61,7 +61,7 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; -extern struct proc *zfsproc; +extern struct proc *system_proc; static __inline kthread_t * do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, @@ -80,7 +80,7 @@ do_thread_create(caddr_t stk, size_t stksize, void (*p ASSERT(pp != NULL); if (pp == &p0) - ppp = &zfsproc; + ppp = &system_proc; else ppp = &pp; error = kproc_kthread_add(proc, arg, ppp, &td, RFSTOPPED, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 5 10:59:33 2019 (r354358) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 5 14:34:59 2019 (r354359) @@ -7098,7 +7098,6 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; -struct proc *zfsproc; #ifdef illumos int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 5 10:59:33 2019 (r354358) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Nov 5 14:34:59 2019 (r354359) @@ -2685,7 +2685,7 @@ zvol_geom_run(zvol_state_t *zv) pp = zv->zv_provider; g_error_provider(pp, 0); - kproc_kthread_add(zvol_geom_worker, zv, &zfsproc, NULL, 0, 0, + kproc_kthread_add(zvol_geom_worker, zv, &system_proc, NULL, 0, 0, "zfskern", "zvol %s", pp->name + sizeof(ZVOL_DRIVER)); } From owner-svn-src-all@freebsd.org Tue Nov 5 14:36:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 463131A981F; Tue, 5 Nov 2019 14:36:43 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476sgG2FPjz4NqF; Tue, 5 Nov 2019 14:36:42 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f195.google.com with SMTP id y23so11199662ljh.10; Tue, 05 Nov 2019 06:36:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=UN9XHKsSSLL1o27GbBkTUN2qrJTc78pBU0IA+xLViAQ=; b=VRMXmdtodB0JV+FrK+rB9bugArZq2akJKCZaSU75MWUxwWInLr2k3YY1QD9MKT/E55 bllZkD8VOHGSiEa0KyjokhsX6k1/8bBsi09Tao0w05b94wLK/YlUG5PhHVXq2PQFr7sC sMCVf8cLmtypfB1yXStxi3oH5U6aaPBONvalgVV5MoXBVG8cni5iayFlXWqL20xml4Ds BK2UPmHgIBrSCTfvHoVHBFvZPDkXHVILQqkVt7xjX1t8U9btlAi4UDHKNJFRweeJtvXZ aj8WC69RyrA65tnRmEgzj4rXCmKqUaWDxTH5CnvXEn1ayExyqw0J59kGzubpH+VrtBv5 U1qg== X-Gm-Message-State: APjAAAWDWC5MJHgYDTKAOCWD9rtsMinnVabeGy7Rtc5diWHgtA4Zqcye Y3gMorJPtGHt640Keoz/uB80rizeDsA= X-Google-Smtp-Source: APXvYqxTFrtyI391euDmcwR0ETMHrtWcz5GeKkFfhVHCNArqLmekfTz4SEn1cFViXSBMKTQWZ5j0Jw== X-Received: by 2002:a2e:6a10:: with SMTP id f16mr3412208ljc.100.1572964599967; Tue, 05 Nov 2019 06:36:39 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id z17sm3178779ljz.30.2019.11.05.06.36.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Nov 2019 06:36:38 -0800 (PST) Subject: Re: svn commit: r354333 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys To: "Andrey V. Elsukov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201911041330.xA4DUbnB059737@repo.freebsd.org> <29fe0e3e-44a6-5197-8252-f0ee3d12e743@yandex.ru> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <170c52c8-8ef8-55e2-7e1a-a8b20f647941@FreeBSD.org> Date: Tue, 5 Nov 2019 16:36:38 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 476sgG2FPjz4NqF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.195 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[195.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; IP_SCORE(-1.09)[ip: (-0.19), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.02), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; FREEMAIL_TO(0.00)[yandex.ru]; RWL_MAILSPIKE_POSSIBLE(0.00)[195.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 14:36:43 -0000 On 05/11/2019 15:39, Andriy Gapon wrote: > On 05/11/2019 15:13, Andrey V. Elsukov wrote: >> On 04.11.2019 16:30, Andriy Gapon wrote: >>> Author: avg >>> Date: Mon Nov 4 13:30:37 2019 >>> New Revision: 354333 >>> URL: https://svnweb.freebsd.org/changeset/base/354333 >>> >>> Log: >>> zfs: enable SPA_PROCESS on the kernel side >>> >>> The purpose of this change is to group kernelthreads specific to a >>> particular ZFS pool under a kernel process. There can be many dozens of >>> threads per pool. This change improves observability of those threads. >>> >>> This change consists of several subchanges: >>> 1. illumos taskq_create_proc can now pass its process parameter to >>> taskqueue. Also, use zfsproc instead of NULL for taskq_create. Caveat: >>> zfsproc might not be initialized yet. But in that case it is still NULL, >>> so not worse than before. >> This commit probably breaks dtrace module loading: >> >> link_elf_obj: symbol zfsproc undefined >> linker_load_file: /boot/kernel/dtrace.ko - unsupported file type >> KLD dtraceall.ko: depends on dtrace - not available or version mismatch >> linker_load_file: /boot/kernel/dtraceall.ko - unsupported file type >> >> Does it works for you and this is my local problem? > > I am seeing this too on a cleanly installed system with GENERIC. > Maybe I didn't see the problem earlier because I have ZFS in kernel... > Anyway, I am working on a fix. Should be fixed now. Please check. Thank you for the report and sorry for the trouble. -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Nov 5 15:19:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 345E31AA83C; Tue, 5 Nov 2019 15:19:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476tcB0ZSbz4YPX; Tue, 5 Nov 2019 15:19:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB1DDE98D; Tue, 5 Nov 2019 15:19:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5FJ53q098177; Tue, 5 Nov 2019 15:19:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5FJ5UM098176; Tue, 5 Nov 2019 15:19:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911051519.xA5FJ5UM098176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 5 Nov 2019 15:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354360 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 15:19:06 -0000 Author: mav Date: Tue Nov 5 15:19:05 2019 New Revision: 354360 URL: https://svnweb.freebsd.org/changeset/base/354360 Log: Add vfs.zfs.zio.taskq_batch_pct tunable. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Nov 5 14:34:59 2019 (r354359) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Nov 5 15:19:05 2019 (r354360) @@ -245,6 +245,10 @@ uint64_t zfs_max_missing_tvds_cachefile = SPA_DVAS_PER uint64_t zfs_max_missing_tvds_scan = 0; +SYSCTL_DECL(_vfs_zfs_zio); +SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, taskq_batch_pct, CTLFLAG_RDTUN, + &zio_taskq_batch_pct, 0, + "Percentage of CPUs to run an IO worker thread"); SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_print_vdev_tree, CTLFLAG_RWTUN, &spa_load_print_vdev_tree, 0, "print out vdev tree during pool import"); From owner-svn-src-all@freebsd.org Tue Nov 5 17:33:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36F401AE83D; Tue, 5 Nov 2019 17:33:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476xbD0lqsz3KHg; Tue, 5 Nov 2019 17:33:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1FDB183B4; Tue, 5 Nov 2019 17:33:27 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5HXREA085849; Tue, 5 Nov 2019 17:33:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5HXRRK085848; Tue, 5 Nov 2019 17:33:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201911051733.xA5HXRRK085848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Tue, 5 Nov 2019 17:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354361 - head X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 17:33:28 -0000 Author: ngie Date: Tue Nov 5 17:33:27 2019 New Revision: 354361 URL: https://svnweb.freebsd.org/changeset/base/354361 Log: Remove picobsd(8) via `make delete-old` This completes the commit that removed picobsd(8) (r354346). MFC after: never Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Nov 5 15:19:05 2019 (r354360) +++ head/ObsoleteFiles.inc Tue Nov 5 17:33:27 2019 (r354361) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20191105: picobsd(8), et al, removed. +OLD_FILES+=usr/share/man/man8/picobsd.8.gz # 20191009: new clang import which bumps version from 8.0.1 to 9.0.0. OLD_FILES+=usr/lib/clang/8.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.1/include/sanitizer/asan_interface.h From owner-svn-src-all@freebsd.org Tue Nov 5 17:46:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96EEB1AEE11; Tue, 5 Nov 2019 17:46:17 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476xt13V4Xz3L3M; Tue, 5 Nov 2019 17:46:17 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 4E76516FB; Tue, 5 Nov 2019 17:46:17 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f182.google.com with SMTP id y39so30541839qty.0; Tue, 05 Nov 2019 09:46:17 -0800 (PST) X-Gm-Message-State: APjAAAXKUmfAWthWqTNmM+VlYVSFKGfFwMnhGb1jULMv6kmSIV1P+MJV 3whrmzZoCIhZr16nNJrWnss0xdFJRikaDf1Swww= X-Google-Smtp-Source: APXvYqxHpQnlA32xsJbsEtywBYEhF6b4dj06art9kfTmGF6NY3z0D2bfj3ENzaKf3hQ5CEfRqNvpRR1A04POLEun+Po= X-Received: by 2002:ac8:21b5:: with SMTP id 50mr18806763qty.60.1572975976769; Tue, 05 Nov 2019 09:46:16 -0800 (PST) MIME-Version: 1.0 References: <201911051733.xA5HXRRK085848@repo.freebsd.org> In-Reply-To: <201911051733.xA5HXRRK085848@repo.freebsd.org> From: Kyle Evans Date: Tue, 5 Nov 2019 11:46:05 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354361 - head To: Enji Cooper Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 17:46:17 -0000 On Tue, Nov 5, 2019 at 11:33 AM Enji Cooper wrote: > > Author: ngie > Date: Tue Nov 5 17:33:27 2019 > New Revision: 354361 > URL: https://svnweb.freebsd.org/changeset/base/354361 > > Log: > Remove picobsd(8) via `make delete-old` > > This completes the commit that removed picobsd(8) (r354346). > > MFC after: never > Ah, sorry about that! Thanks! Kyle Evans From owner-svn-src-all@freebsd.org Tue Nov 5 17:49:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A7CD1AEF9A; Tue, 5 Nov 2019 17:49:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476xxS3dgYz3LFZ; Tue, 5 Nov 2019 17:49:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FE5118596; Tue, 5 Nov 2019 17:49:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5HnGkQ092090; Tue, 5 Nov 2019 17:49:16 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5HnGCj092089; Tue, 5 Nov 2019 17:49:16 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911051749.xA5HnGCj092089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 5 Nov 2019 17:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354362 - head/tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netinet6 X-SVN-Commit-Revision: 354362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 17:49:16 -0000 Author: lwhsu Date: Tue Nov 5 17:49:15 2019 New Revision: 354362 URL: https://svnweb.freebsd.org/changeset/base/354362 Log: Temporarily disable sys.netinet6.exthdr on i386 PR: 241493 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netinet6/exthdr.sh Modified: head/tests/sys/netinet6/exthdr.sh ============================================================================== --- head/tests/sys/netinet6/exthdr.sh Tue Nov 5 17:33:27 2019 (r354361) +++ head/tests/sys/netinet6/exthdr.sh Tue Nov 5 17:49:15 2019 (r354362) @@ -38,6 +38,11 @@ exthdr_head() { exthdr_body() { + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "i386" ]; then + atf_skip "https://bugs.freebsd.org/241493" + fi + ids=65533 id=`printf "%x" ${ids}` if [ $$ -gt 65535 ]; then From owner-svn-src-all@freebsd.org Tue Nov 5 18:07:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A6151AF668; Tue, 5 Nov 2019 18:07:31 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476yLW0NW8z3M9H; Tue, 5 Nov 2019 18:07:31 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3F2218960; Tue, 5 Nov 2019 18:07:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5I7Ucn003485; Tue, 5 Nov 2019 18:07:30 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5I7Ur7003484; Tue, 5 Nov 2019 18:07:30 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911051807.xA5I7Ur7003484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 5 Nov 2019 18:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354363 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 18:07:31 -0000 Author: tsoome Date: Tue Nov 5 18:07:30 2019 New Revision: 354363 URL: https://svnweb.freebsd.org/changeset/base/354363 Log: loader: populate nvl with data even when label_txg is 0 We actually do not use that data, at least not now, but we want to avoid possible surprises. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Tue Nov 5 17:49:15 2019 (r354362) +++ head/stand/libsa/zfs/zfsimpl.c Tue Nov 5 18:07:30 2019 (r354363) @@ -1641,8 +1641,10 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) nvlist = (const unsigned char *) label->vp_nvlist + 4; error = nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64, NULL, &label_txg); - if (error != 0 || label_txg == 0) + if (error != 0 || label_txg == 0) { + memcpy(nvl, nvlist, nvl_size); return (nvl); + } if (label_txg <= txg && label_txg > best_txg) { best_txg = label_txg; From owner-svn-src-all@freebsd.org Tue Nov 5 18:35:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F11281B06FD; Tue, 5 Nov 2019 18:35:13 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476yyT6By8z3NhZ; Tue, 5 Nov 2019 18:35:13 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B920518EC7; Tue, 5 Nov 2019 18:35:13 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5IZDOW021053; Tue, 5 Nov 2019 18:35:13 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5IZD1d021051; Tue, 5 Nov 2019 18:35:13 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911051835.xA5IZD1d021051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 5 Nov 2019 18:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354364 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 18:35:14 -0000 Author: tsoome Date: Tue Nov 5 18:35:13 2019 New Revision: 354364 URL: https://svnweb.freebsd.org/changeset/base/354364 Log: loader: clean up the noise around log device We are ignoring log device but we also do want to have clean code. Modified: head/stand/libsa/zfs/zfs.c head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Tue Nov 5 18:07:30 2019 (r354363) +++ head/stand/libsa/zfs/zfs.c Tue Nov 5 18:35:13 2019 (r354364) @@ -669,14 +669,6 @@ zfs_dev_open(struct open_file *f, ...) spa = spa_find_by_guid(dev->pool_guid); if (!spa) return (ENXIO); -#if 0 - /* Apparently too many are using slog with boot pool. */ - if (spa->spa_with_log) { - printf("Reading pool %s is not supported due to log device.\n", - spa->spa_name); - return (ENXIO); - } -#endif mount = malloc(sizeof(*mount)); if (mount == NULL) rv = ENOMEM; Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Tue Nov 5 18:07:30 2019 (r354363) +++ head/stand/libsa/zfs/zfsimpl.c Tue Nov 5 18:35:13 2019 (r354364) @@ -1774,12 +1774,6 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s return (EIO); } - if (nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, - NULL, &val) == 0 && val != 0) { - free(nvlist); - return (EIO); - } - /* * Create the pool if this is the first time we've seen it. */ @@ -1854,9 +1848,6 @@ vdev_probe(vdev_phys_read_t *_read, void *read_priv, s return (EIO); } - /* - * We do not support reading pools with log device. - */ if (vdev->v_islog) spa->spa_with_log = vdev->v_islog; From owner-svn-src-all@freebsd.org Tue Nov 5 19:14:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83DD31B1846; Tue, 5 Nov 2019 19:14:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476zqZ2zJJz3QqW; Tue, 5 Nov 2019 19:14:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A35D195F0; Tue, 5 Nov 2019 19:14:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5JEI6a044269; Tue, 5 Nov 2019 19:14:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5JEIC5044268; Tue, 5 Nov 2019 19:14:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911051914.xA5JEIC5044268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 5 Nov 2019 19:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354365 - stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Commit-Revision: 354365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 19:14:18 -0000 Author: mav Date: Tue Nov 5 19:14:17 2019 New Revision: 354365 URL: https://svnweb.freebsd.org/changeset/base/354365 Log: MFC r354159: FreeBSD'fy ZFS zlib zalloc/zfree callbacks. The previous code came from OpenSolaris, which in my understanding require allocation size to be known to free memory. To store that size previous code allocated additional 8 byte header. But I have noticed that zlib with present settings allocates 64KB context buffers for each call, that could be efficiently cached by UMA, but addition of those 8 bytes makes them fall back to physical RAM allocations, that cause huge overhead and lock congestion on small blocks. Since FreeBSD's free() does not have the size argument, switching to it solves the problem, increasing write speed to ZVOLs with 4KB block size and GZIP compression on my 40-threads test system from ~60MB/s to ~600MB/s. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Tue Nov 5 18:35:13 2019 (r354364) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Tue Nov 5 19:14:17 2019 (r354365) @@ -28,41 +28,23 @@ #include #include -#include +#include -struct zchdr { - uint_t zch_magic; - uint_t zch_size; -}; - -#define ZCH_MAGIC 0x3cc13cc1 - /*ARGSUSED*/ void * zcalloc(void *opaque, uint_t items, uint_t size) { - size_t nbytes = sizeof (struct zchdr) + items * size; - struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP); + void *ptr; - if (z == NULL) - return (NULL); - - z->zch_magic = ZCH_MAGIC; - z->zch_size = nbytes; - - return (z + 1); + ptr = malloc((size_t)items * size, M_SOLARIS, M_NOWAIT); + return ptr; } /*ARGSUSED*/ void zcfree(void *opaque, void *ptr) { - struct zchdr *z = ((struct zchdr *)ptr) - 1; - - if (z->zch_magic != ZCH_MAGIC) - panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr); - - kobj_free(z, z->zch_size); + free(ptr, M_SOLARIS); } void From owner-svn-src-all@freebsd.org Tue Nov 5 19:15:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D98091B1920; Tue, 5 Nov 2019 19:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 476zsC5WMwz3R1B; Tue, 5 Nov 2019 19:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A147A195F2; Tue, 5 Nov 2019 19:15:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5JFh9m044400; Tue, 5 Nov 2019 19:15:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5JFhvo044399; Tue, 5 Nov 2019 19:15:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911051915.xA5JFhvo044399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 5 Nov 2019 19:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354366 - stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod X-SVN-Commit-Revision: 354366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 19:15:43 -0000 Author: mav Date: Tue Nov 5 19:15:43 2019 New Revision: 354366 URL: https://svnweb.freebsd.org/changeset/base/354366 Log: MFC r354159: FreeBSD'fy ZFS zlib zalloc/zfree callbacks. The previous code came from OpenSolaris, which in my understanding require allocation size to be known to free memory. To store that size previous code allocated additional 8 byte header. But I have noticed that zlib with present settings allocates 64KB context buffers for each call, that could be efficiently cached by UMA, but addition of those 8 bytes makes them fall back to physical RAM allocations, that cause huge overhead and lock congestion on small blocks. Since FreeBSD's free() does not have the size argument, switching to it solves the problem, increasing write speed to ZVOLs with 4KB block size and GZIP compression on my 40-threads test system from ~60MB/s to ~600MB/s. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Tue Nov 5 19:14:17 2019 (r354365) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c Tue Nov 5 19:15:43 2019 (r354366) @@ -28,41 +28,23 @@ #include #include -#include +#include -struct zchdr { - uint_t zch_magic; - uint_t zch_size; -}; - -#define ZCH_MAGIC 0x3cc13cc1 - /*ARGSUSED*/ void * zcalloc(void *opaque, uint_t items, uint_t size) { - size_t nbytes = sizeof (struct zchdr) + items * size; - struct zchdr *z = kobj_zalloc(nbytes, KM_NOWAIT|KM_TMP); + void *ptr; - if (z == NULL) - return (NULL); - - z->zch_magic = ZCH_MAGIC; - z->zch_size = nbytes; - - return (z + 1); + ptr = malloc((size_t)items * size, M_SOLARIS, M_NOWAIT); + return ptr; } /*ARGSUSED*/ void zcfree(void *opaque, void *ptr) { - struct zchdr *z = ((struct zchdr *)ptr) - 1; - - if (z->zch_magic != ZCH_MAGIC) - panic("zcfree region corrupt: hdr=%p ptr=%p", (void *)z, ptr); - - kobj_free(z, z->zch_size); + free(ptr, M_SOLARIS); } void From owner-svn-src-all@freebsd.org Tue Nov 5 21:38:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4F551787F4; Tue, 5 Nov 2019 21:38:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47732J4PgMz44tH; Tue, 5 Nov 2019 21:38:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B9D51AF75; Tue, 5 Nov 2019 21:38:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA5LcmBM034374; Tue, 5 Nov 2019 21:38:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA5LcmBr034373; Tue, 5 Nov 2019 21:38:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911052138.xA5LcmBr034373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 5 Nov 2019 21:38:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354367 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2019 21:38:48 -0000 Author: kib Date: Tue Nov 5 21:38:48 2019 New Revision: 354367 URL: https://svnweb.freebsd.org/changeset/base/354367 Log: Switch cache zones from early counters to real implementation. Early counter mock can be only used on BSP for amd64, when APs try to update it that causes random memory corruption. N.B. This is a temporary patch to plug the corruption for now, while a proper solution for handling cache zones in zone_foreach() is being developed. In collaboration with: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation, Mellanox Technologies Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Nov 5 19:15:43 2019 (r354366) +++ head/sys/vm/uma_core.c Tue Nov 5 21:38:48 2019 (r354367) @@ -2198,6 +2198,7 @@ uma_startup2(void) static void uma_startup3(void) { + uma_zone_t zone; #ifdef INVARIANTS TUNABLE_INT_FETCH("vm.debug.divisor", &dbg_divisor); @@ -2205,6 +2206,8 @@ uma_startup3(void) uma_skip_cnt = counter_u64_alloc(M_WAITOK); #endif zone_foreach(zone_alloc_counters); + LIST_FOREACH(zone, &uma_cachezones, uz_link) + zone_alloc_counters(zone); callout_init(&uma_callout, 1); callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); booted = BOOT_RUNNING; From owner-svn-src-all@freebsd.org Wed Nov 6 01:42:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED4B11B277D; Wed, 6 Nov 2019 01:42:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4778RW5x5gz4JWc; Wed, 6 Nov 2019 01:42:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEC711DC48; Wed, 6 Nov 2019 01:42:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA61gVJG092408; Wed, 6 Nov 2019 01:42:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA61gV5J091689; Wed, 6 Nov 2019 01:42:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911060142.xA61gV5J091689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 6 Nov 2019 01:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354368 - in head/usr.bin: brandelf head tail X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/usr.bin: brandelf head tail X-SVN-Commit-Revision: 354368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 01:42:32 -0000 Author: markj Date: Wed Nov 6 01:42:30 2019 New Revision: 354368 URL: https://svnweb.freebsd.org/changeset/base/354368 Log: fileargs_init() sets errno on failure. Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/brandelf/brandelf.c head/usr.bin/head/head.c head/usr.bin/tail/tail.c Modified: head/usr.bin/brandelf/brandelf.c ============================================================================== --- head/usr.bin/brandelf/brandelf.c Tue Nov 5 21:38:48 2019 (r354367) +++ head/usr.bin/brandelf/brandelf.c Wed Nov 6 01:42:30 2019 (r354368) @@ -135,7 +135,7 @@ main(int argc, char **argv) fa = fileargs_init(argc, argv, flags, 0, &rights, FA_OPEN); if (fa == NULL) - errx(1, "unable to init casper"); + err(1, "unable to init casper"); caph_cache_catpages(); if (caph_limit_stdio() < 0 || caph_enter_casper() < 0) Modified: head/usr.bin/head/head.c ============================================================================== --- head/usr.bin/head/head.c Tue Nov 5 21:38:48 2019 (r354367) +++ head/usr.bin/head/head.c Wed Nov 6 01:42:30 2019 (r354368) @@ -117,7 +117,7 @@ main(int argc, char *argv[]) fa = fileargs_init(argc, argv, O_RDONLY, 0, cap_rights_init(&rights, CAP_READ, CAP_FSTAT, CAP_FCNTL), FA_OPEN); if (fa == NULL) - errx(1, "unable to init casper"); + err(1, "unable to init casper"); caph_cache_catpages(); if (caph_limit_stdio() < 0 || caph_enter_casper() < 0) Modified: head/usr.bin/tail/tail.c ============================================================================== --- head/usr.bin/tail/tail.c Tue Nov 5 21:38:48 2019 (r354367) +++ head/usr.bin/tail/tail.c Wed Nov 6 01:42:30 2019 (r354368) @@ -169,7 +169,7 @@ main(int argc, char *argv[]) fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights, FA_OPEN); if (fa == NULL) - errx(1, "unable to init casper"); + err(1, "unable to init casper"); caph_cache_catpages(); if (caph_enter_casper() < 0) From owner-svn-src-all@freebsd.org Wed Nov 6 04:40:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0A581B5D79; Wed, 6 Nov 2019 04:40:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477DNX5D1wz4lDY; Wed, 6 Nov 2019 04:40:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9054B1FB4A; Wed, 6 Nov 2019 04:40:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA64eCKX093763; Wed, 6 Nov 2019 04:40:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA64eCcG093762; Wed, 6 Nov 2019 04:40:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911060440.xA64eCcG093762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 6 Nov 2019 04:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354369 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 04:40:12 -0000 Author: jhibbits Date: Wed Nov 6 04:40:12 2019 New Revision: 354369 URL: https://svnweb.freebsd.org/changeset/base/354369 Log: powerpc/booke: Fix pmap_mapdev_attr() for multi-TLB1 entry mappings Also, fix pmap_change_attr() to ignore non-kernel mappings. * Fix a masking bug in mmu_booke_mapdev_attr() which caused it to align mappings to the smallest mapping alignment, instead of the largest. This caused mappings to be potentially pessimally aligned, using more TLB entries than necessary. * Return existing mappings from mmu_booke_mapdev_attr() that span more than one TLB1 entry. The drm-current-kmod drivers map discontiguous segments of the GPU, resulting in more than one TLB entry being used to satisfy the mapping. * Ignore non-kernel mappings in mmu_booke_change_attr(). There's a bug in the linuxkpi layer that causes it to actually try to change physical address mappings, instead of virtual addresses. amd64 doesn't encounter this because it ignores non-kernel mappings. With this it's possible to use drm-current-kmod on Book-E. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Nov 6 01:42:30 2019 (r354368) +++ head/sys/powerpc/booke/pmap.c Wed Nov 6 04:40:12 2019 (r354369) @@ -3441,31 +3441,57 @@ mmu_booke_mapdev(mmu_t mmu, vm_paddr_t pa, vm_size_t s return (mmu_booke_mapdev_attr(mmu, pa, size, VM_MEMATTR_DEFAULT)); } +static int +tlb1_find_pa(vm_paddr_t pa, tlb_entry_t *e) +{ + int i; + + for (i = 0; i < TLB1_ENTRIES; i++) { + tlb1_read_entry(e, i); + if ((e->mas1 & MAS1_VALID) == 0) + return (i); + } + return (-1); +} + static void * mmu_booke_mapdev_attr(mmu_t mmu, vm_paddr_t pa, vm_size_t size, vm_memattr_t ma) { tlb_entry_t e; + vm_paddr_t tmppa; void *res; uintptr_t va, tmpva; vm_size_t sz; int i; + int wimge; /* - * Check if this is premapped in TLB1. Note: this should probably also - * check whether a sequence of TLB1 entries exist that match the - * requirement, but now only checks the easy case. + * Check if this is premapped in TLB1. */ + sz = size; + tmppa = pa; + va = ~0; + wimge = tlb_calc_wimg(pa, ma); for (i = 0; i < TLB1_ENTRIES; i++) { tlb1_read_entry(&e, i); if (!(e.mas1 & MAS1_VALID)) continue; - if (pa >= e.phys && - (pa + size) <= (e.phys + e.size) && - (ma == VM_MEMATTR_DEFAULT || - tlb_calc_wimg(pa, ma) == - (e.mas2 & (MAS2_WIMGE_MASK & ~_TLB_ENTRY_SHARED)))) - return (void *)(e.virt + - (vm_offset_t)(pa - e.phys)); + if (wimge != (e.mas2 & (MAS2_WIMGE_MASK & ~_TLB_ENTRY_SHARED))) + continue; + if (tmppa >= e.phys && tmppa < e.phys + e.size) { + va = e.virt + (pa - e.phys); + tmppa = e.phys + e.size; + sz -= MIN(sz, e.size); + while (sz > 0 && (i = tlb1_find_pa(tmppa, &e)) != -1) { + if (wimge != (e.mas2 & (MAS2_WIMGE_MASK & ~_TLB_ENTRY_SHARED))) + break; + sz -= MIN(sz, e.size); + tmppa = e.phys + e.size; + } + if (sz != 0) + break; + return ((void *)va); + } } size = roundup(size, PAGE_SIZE); @@ -3489,7 +3515,7 @@ mmu_booke_mapdev_attr(mmu_t mmu, vm_paddr_t pa, vm_siz */ do { tmpva = tlb1_map_base; - sz = ffsl(((1 << flsl(size-1)) - 1) & pa); + sz = ffsl((~((1 << flsl(size-1)) - 1)) & pa); sz = sz ? min(roundup(sz + 3, 4), flsl(size) - 1) : flsl(size) - 1; va = roundup(tlb1_map_base, 1 << sz) | (((1 << sz) - 1) & pa); #ifdef __powerpc64__ @@ -3568,6 +3594,23 @@ mmu_booke_change_attr(mmu_t mmu, vm_offset_t addr, vm_ pte_t *pte; int i, j; tlb_entry_t e; + + addr = trunc_page(addr); + + /* Only allow changes to mapped kernel addresses. This includes: + * - KVA + * - DMAP (powerpc64) + * - Device mappings + */ + if (addr <= VM_MAXUSER_ADDRESS || +#ifdef __powerpc64__ + (addr >= tlb1_map_base && addr < DMAP_BASE_ADDRESS) || + (addr > DMAP_MAX_ADDRESS && addr < VM_MIN_KERNEL_ADDRESS) || +#else + (addr >= tlb1_map_base && addr < VM_MIN_KERNEL_ADDRESS) || +#endif + (addr > VM_MAX_KERNEL_ADDRESS)) + return (EINVAL); /* Check TLB1 mappings */ for (i = 0; i < TLB1_ENTRIES; i++) { From owner-svn-src-all@freebsd.org Wed Nov 6 06:42:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1134C1AB1B9; Wed, 6 Nov 2019 06:42:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477H570D0Qz4tnq; Wed, 6 Nov 2019 06:42:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFD0421242; Wed, 6 Nov 2019 06:42:02 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA66g27k068331; Wed, 6 Nov 2019 06:42:02 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA66g0dn068321; Wed, 6 Nov 2019 06:42:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911060642.xA66g0dn068321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 6 Nov 2019 06:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354371 - in vendor/zstd/dist: . contrib/adaptive-compression contrib/gen_html contrib/pzstd contrib/seekable_format/examples doc doc/educational_decoder examples lib lib/common lib/com... X-SVN-Group: vendor X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in vendor/zstd/dist: . contrib/adaptive-compression contrib/gen_html contrib/pzstd contrib/seekable_format/examples doc doc/educational_decoder examples lib lib/common lib/compress lib/decompress lib/... X-SVN-Commit-Revision: 354371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 06:42:03 -0000 Author: cem Date: Wed Nov 6 06:42:00 2019 New Revision: 354371 URL: https://svnweb.freebsd.org/changeset/base/354371 Log: Import Zstd 1.4.4 Added: vendor/zstd/dist/lib/compress/zstd_cwksp.h (contents, props changed) vendor/zstd/dist/tests/fuzz/dictionary_loader.c (contents, props changed) vendor/zstd/dist/tests/fuzz/fuzz_data_producer.c (contents, props changed) vendor/zstd/dist/tests/fuzz/fuzz_data_producer.h (contents, props changed) vendor/zstd/dist/tests/golden-compression/ vendor/zstd/dist/tests/golden-compression/huffman-compressed-larger - copied unchanged from r354370, vendor/zstd/dist/tests/files/huffman-compressed-larger vendor/zstd/dist/tests/golden-decompression/ vendor/zstd/dist/tests/golden-decompression/rle-first-block.zst (contents, props changed) Deleted: vendor/zstd/dist/contrib/adaptive-compression/Makefile vendor/zstd/dist/contrib/adaptive-compression/README.md vendor/zstd/dist/contrib/adaptive-compression/adapt.c vendor/zstd/dist/contrib/adaptive-compression/datagencli.c vendor/zstd/dist/contrib/adaptive-compression/test-correctness.sh vendor/zstd/dist/contrib/adaptive-compression/test-performance.sh vendor/zstd/dist/contrib/gen_html/.gitignore vendor/zstd/dist/contrib/pzstd/.gitignore vendor/zstd/dist/contrib/seekable_format/examples/.gitignore vendor/zstd/dist/examples/.gitignore vendor/zstd/dist/lib/.gitignore vendor/zstd/dist/programs/.gitignore vendor/zstd/dist/tests/.gitignore vendor/zstd/dist/tests/files/huffman-compressed-larger vendor/zstd/dist/zlibWrapper/.gitignore Modified: vendor/zstd/dist/CHANGELOG vendor/zstd/dist/Makefile vendor/zstd/dist/README.md vendor/zstd/dist/appveyor.yml vendor/zstd/dist/doc/educational_decoder/Makefile vendor/zstd/dist/doc/educational_decoder/harness.c vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h vendor/zstd/dist/doc/zstd_compression_format.md vendor/zstd/dist/doc/zstd_manual.html vendor/zstd/dist/examples/streaming_compression.c vendor/zstd/dist/examples/streaming_decompression.c vendor/zstd/dist/lib/Makefile vendor/zstd/dist/lib/README.md vendor/zstd/dist/lib/common/bitstream.h vendor/zstd/dist/lib/common/compiler.h vendor/zstd/dist/lib/common/fse.h vendor/zstd/dist/lib/common/fse_decompress.c vendor/zstd/dist/lib/common/mem.h vendor/zstd/dist/lib/common/pool.c vendor/zstd/dist/lib/common/threading.c vendor/zstd/dist/lib/common/threading.h vendor/zstd/dist/lib/common/xxhash.c vendor/zstd/dist/lib/common/zstd_internal.h vendor/zstd/dist/lib/compress/zstd_compress.c vendor/zstd/dist/lib/compress/zstd_compress_internal.h vendor/zstd/dist/lib/compress/zstd_compress_literals.c vendor/zstd/dist/lib/compress/zstd_compress_literals.h vendor/zstd/dist/lib/compress/zstd_compress_sequences.c vendor/zstd/dist/lib/compress/zstd_compress_sequences.h vendor/zstd/dist/lib/compress/zstd_double_fast.c vendor/zstd/dist/lib/compress/zstd_fast.c vendor/zstd/dist/lib/compress/zstd_lazy.c vendor/zstd/dist/lib/compress/zstd_ldm.c vendor/zstd/dist/lib/compress/zstd_opt.c vendor/zstd/dist/lib/compress/zstdmt_compress.c vendor/zstd/dist/lib/decompress/huf_decompress.c vendor/zstd/dist/lib/decompress/zstd_decompress.c vendor/zstd/dist/lib/decompress/zstd_decompress_block.c vendor/zstd/dist/lib/deprecated/zbuff.h vendor/zstd/dist/lib/dictBuilder/cover.c vendor/zstd/dist/lib/dictBuilder/zdict.c vendor/zstd/dist/lib/legacy/zstd_v01.c vendor/zstd/dist/lib/legacy/zstd_v02.c vendor/zstd/dist/lib/legacy/zstd_v03.c vendor/zstd/dist/lib/legacy/zstd_v04.c vendor/zstd/dist/lib/legacy/zstd_v05.c vendor/zstd/dist/lib/legacy/zstd_v06.c vendor/zstd/dist/lib/legacy/zstd_v07.c vendor/zstd/dist/lib/libzstd.pc.in vendor/zstd/dist/lib/zstd.h vendor/zstd/dist/programs/README.md vendor/zstd/dist/programs/benchzstd.c vendor/zstd/dist/programs/benchzstd.h vendor/zstd/dist/programs/datagen.c vendor/zstd/dist/programs/dibio.c vendor/zstd/dist/programs/fileio.c vendor/zstd/dist/programs/fileio.h vendor/zstd/dist/programs/platform.h vendor/zstd/dist/programs/timefn.h vendor/zstd/dist/programs/util.c vendor/zstd/dist/programs/util.h vendor/zstd/dist/programs/zstd.1 vendor/zstd/dist/programs/zstd.1.md vendor/zstd/dist/programs/zstdcli.c vendor/zstd/dist/programs/zstdgrep.1 vendor/zstd/dist/programs/zstdless.1 vendor/zstd/dist/tests/Makefile vendor/zstd/dist/tests/decodecorpus.c vendor/zstd/dist/tests/fullbench.c vendor/zstd/dist/tests/fuzz/Makefile vendor/zstd/dist/tests/fuzz/README.md vendor/zstd/dist/tests/fuzz/block_decompress.c vendor/zstd/dist/tests/fuzz/block_round_trip.c vendor/zstd/dist/tests/fuzz/dictionary_decompress.c vendor/zstd/dist/tests/fuzz/dictionary_round_trip.c vendor/zstd/dist/tests/fuzz/fuzz.h vendor/zstd/dist/tests/fuzz/fuzz.py vendor/zstd/dist/tests/fuzz/fuzz_helpers.h vendor/zstd/dist/tests/fuzz/regression_driver.c vendor/zstd/dist/tests/fuzz/simple_compress.c vendor/zstd/dist/tests/fuzz/simple_decompress.c vendor/zstd/dist/tests/fuzz/simple_round_trip.c vendor/zstd/dist/tests/fuzz/stream_decompress.c vendor/zstd/dist/tests/fuzz/stream_round_trip.c vendor/zstd/dist/tests/fuzz/zstd_frame_info.c vendor/zstd/dist/tests/fuzz/zstd_helpers.c vendor/zstd/dist/tests/fuzz/zstd_helpers.h vendor/zstd/dist/tests/fuzzer.c vendor/zstd/dist/tests/playTests.sh vendor/zstd/dist/tests/poolTests.c vendor/zstd/dist/tests/regression/method.c vendor/zstd/dist/tests/regression/results.csv vendor/zstd/dist/tests/zbufftest.c vendor/zstd/dist/tests/zstreamtest.c vendor/zstd/dist/zlibWrapper/Makefile vendor/zstd/dist/zlibWrapper/examples/fitblk.c vendor/zstd/dist/zlibWrapper/examples/zwrapbench.c vendor/zstd/dist/zlibWrapper/gzclose.c vendor/zstd/dist/zlibWrapper/gzlib.c vendor/zstd/dist/zlibWrapper/gzread.c vendor/zstd/dist/zlibWrapper/gzwrite.c vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.c Modified: vendor/zstd/dist/CHANGELOG ============================================================================== --- vendor/zstd/dist/CHANGELOG Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/CHANGELOG Wed Nov 6 06:42:00 2019 (r354371) @@ -1,3 +1,34 @@ +v1.4.4 +perf: Improved decompression speed, by > 10%, by @terrelln +perf: Better compression speed when re-using a context, by @felixhandte +perf: Fix compression ratio when compressing large files with small dictionary, by @senhuang42 +perf: zstd reference encoder can generate RLE blocks, by @bimbashrestha +perf: minor generic speed optimization, by @davidbolvansky +api: new ability to extract sequences from the parser for analysis, by @bimbashrestha +api: fixed decoding of magic-less frames, by @terrelln +api: fixed ZSTD_initCStream_advanced() performance with fast modes, reported by @QrczakMK +cli: Named pipes support, by @bimbashrestha +cli: short tar's extension support, by @stokito +cli: command --output-dir-flat= , generates target files into requested directory, by @senhuang42 +cli: commands --stream-size=# and --size-hint=#, by @nmagerko +cli: command --exclude-compressed, by @shashank0791 +cli: faster `-t` test mode +cli: improved some error messages, by @vangyzen +cli: rare deadlock condition within dictionary builder, by @terrelln +build: single-file decoder with emscripten compilation script, by @cwoffenden +build: fixed zlibWrapper compilation on Visual Studio, reported by @bluenlive +build: fixed deprecation warning for certain gcc version, reported by @jasonma163 +build: fix compilation on old gcc versions, by @cemeyer +build: improved installation directories for cmake script, by Dmitri Shubin +pack: modified pkgconfig, for better integration into openwrt, requested by @neheb +misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, ZSTD_CDict, function deprecation, zstd format +misc: fixed educational decoder : accept larger literals section, and removed UNALIGNED() macro + +v1.4.3 +bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709) +bug: Fix Buffer Overflow in legacy v0.3 decompression by @felixhandte (#1722) +build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705) + v1.4.2 bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696) bug: Fix seekable decompression in-memory API by @iburinoc (#1695) Modified: vendor/zstd/dist/Makefile ============================================================================== --- vendor/zstd/dist/Makefile Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/Makefile Wed Nov 6 06:42:00 2019 (r354371) @@ -69,6 +69,7 @@ test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werr test: MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ + ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test ## shortest: same as `make check` .PHONY: shortest @@ -99,8 +100,8 @@ man: contrib: lib $(MAKE) -C contrib/pzstd all $(MAKE) -C contrib/seekable_format/examples all - $(MAKE) -C contrib/adaptive-compression all $(MAKE) -C contrib/largeNbDicts all + cd contrib/single_file_decoder/ ; ./build_test.sh .PHONY: cleanTabs cleanTabs: @@ -116,7 +117,6 @@ clean: @$(MAKE) -C contrib/gen_html $@ > $(VOID) @$(MAKE) -C contrib/pzstd $@ > $(VOID) @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) - @$(MAKE) -C contrib/adaptive-compression $@ > $(VOID) @$(MAKE) -C contrib/largeNbDicts $@ > $(VOID) @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* @$(RM) -r lz4 Modified: vendor/zstd/dist/README.md ============================================================================== --- vendor/zstd/dist/README.md Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/README.md Wed Nov 6 06:42:00 2019 (r354371) @@ -15,6 +15,7 @@ a list of known ports and bindings is provided on [Zst [![Build status][AppveyorDevBadge]][AppveyorLink] [![Build status][CircleDevBadge]][CircleLink] [![Build status][CirrusDevBadge]][CirrusLink] +[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink] [travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" [travisLink]: https://travis-ci.org/facebook/zstd @@ -24,6 +25,8 @@ a list of known ports and bindings is provided on [Zst [CircleLink]: https://circleci.com/gh/facebook/zstd [CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev [CirrusLink]: https://cirrus-ci.com/github/facebook/zstd +[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg +[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd ## Benchmarks Modified: vendor/zstd/dist/appveyor.yml ============================================================================== --- vendor/zstd/dist/appveyor.yml Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/appveyor.yml Wed Nov 6 06:42:00 2019 (r354371) @@ -1,3 +1,7 @@ +# Following tests are run _only_ on master branch +# To reproduce these tests, it's possible to push into a branch `appveyorTest` +# or a branch `visual*`, they will intentionnally trigger `master` tests + - version: 1.0.{build} branches: @@ -169,13 +173,16 @@ sh -e playTests.sh --test-large-data && fullbench.exe -i1 && fullbench.exe -i1 -P0 && - fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% && - fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% ) + +# The following tests are for regular pushes +# into `dev` or some feature branch +# There run less tests, for shorter feedback loop + - version: 1.0.{build} environment: @@ -248,4 +255,12 @@ MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ + ) + + + test_script: + - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% + - if [%HOST%]==[mingw] ( + set "CC=%COMPILER%" && + make check ) Modified: vendor/zstd/dist/doc/educational_decoder/Makefile ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/Makefile Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/educational_decoder/Makefile Wed Nov 6 06:42:00 2019 (r354371) @@ -1,15 +1,33 @@ +# ################################################################ +# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +ZSTD ?= zstd # note: requires zstd installation on local system + +UNAME?= $(shell uname) +ifeq ($(UNAME), SunOS) +DIFF ?= gdiff +else +DIFF ?= diff +endif + HARNESS_FILES=*.c MULTITHREAD_LDFLAGS = -pthread DEBUGFLAGS= -g -DZSTD_DEBUG=1 CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) -CFLAGS ?= -O3 +CFLAGS ?= -O2 CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef \ + -Wstrict-aliasing=1 -Wswitch-enum \ + -Wredundant-decls -Wstrict-prototypes -Wundef \ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls + -std=c99 CFLAGS += $(DEBUGFLAGS) CFLAGS += $(MOREFLAGS) FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MULTITHREAD_LDFLAGS) @@ -18,17 +36,27 @@ harness: $(HARNESS_FILES) $(CC) $(FLAGS) $^ -o $@ clean: - @$(RM) -f harness - @$(RM) -rf harness.dSYM + @$(RM) harness + @$(RM) -rf harness.dSYM # MacOS specific test: harness - @zstd README.md -o tmp.zst + # + # Testing single-file decompression with educational decoder + # + @$(ZSTD) -f README.md -o tmp.zst @./harness tmp.zst tmp - @diff -s tmp README.md - @$(RM) -f tmp* - @zstd --train harness.c zstd_decompress.c zstd_decompress.h README.md - @zstd -D dictionary README.md -o tmp.zst + @$(DIFF) -s tmp README.md + @$(RM) tmp* + # + # Testing dictionary decompression with education decoder + # + # note : files are presented multiple for training, to reach minimum threshold + @$(ZSTD) --train harness.c zstd_decompress.c zstd_decompress.h README.md \ + harness.c zstd_decompress.c zstd_decompress.h README.md \ + harness.c zstd_decompress.c zstd_decompress.h README.md \ + -o dictionary + @$(ZSTD) -f README.md -D dictionary -o tmp.zst @./harness tmp.zst tmp dictionary - @diff -s tmp README.md - @$(RM) -f tmp* dictionary - @make clean + @$(DIFF) -s tmp README.md + @$(RM) tmp* dictionary + @$(MAKE) clean Modified: vendor/zstd/dist/doc/educational_decoder/harness.c ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/harness.c Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/educational_decoder/harness.c Wed Nov 6 06:42:00 2019 (r354371) @@ -21,88 +21,90 @@ typedef unsigned char u8; // Protect against allocating too much memory for output #define MAX_OUTPUT_SIZE ((size_t)1024 * 1024 * 1024) -u8 *input; -u8 *output; -u8 *dict; - -size_t read_file(const char *path, u8 **ptr) { - FILE *f = fopen(path, "rb"); +static size_t read_file(const char *path, u8 **ptr) +{ + FILE* const f = fopen(path, "rb"); if (!f) { - fprintf(stderr, "failed to open file %s\n", path); + fprintf(stderr, "failed to open file %s \n", path); exit(1); } fseek(f, 0L, SEEK_END); - size_t size = ftell(f); + size_t const size = (size_t)ftell(f); rewind(f); *ptr = malloc(size); if (!ptr) { - fprintf(stderr, "failed to allocate memory to hold %s\n", path); + fprintf(stderr, "failed to allocate memory to hold %s \n", path); exit(1); } - size_t pos = 0; - while (!feof(f)) { - size_t read = fread(&(*ptr)[pos], 1, size, f); - if (ferror(f)) { - fprintf(stderr, "error while reading file %s\n", path); - exit(1); - } - pos += read; + size_t const read = fread(*ptr, 1, size, f); + if (read != size) { /* must read everything in one pass */ + fprintf(stderr, "error while reading file %s \n", path); + exit(1); } fclose(f); - return pos; + return read; } -void write_file(const char *path, const u8 *ptr, size_t size) { - FILE *f = fopen(path, "wb"); +static void write_file(const char *path, const u8 *ptr, size_t size) +{ + FILE* const f = fopen(path, "wb"); + if (!f) { + fprintf(stderr, "failed to open file %s \n", path); + exit(1); + } size_t written = 0; while (written < size) { - written += fwrite(&ptr[written], 1, size, f); + written += fwrite(ptr+written, 1, size, f); if (ferror(f)) { fprintf(stderr, "error while writing file %s\n", path); exit(1); - } - } + } } fclose(f); } -int main(int argc, char **argv) { +int main(int argc, char **argv) +{ if (argc < 3) { - fprintf(stderr, "usage: %s [dictionary]\n", + fprintf(stderr, "usage: %s [dictionary] \n", argv[0]); return 1; } - size_t input_size = read_file(argv[1], &input); + u8* input; + size_t const input_size = read_file(argv[1], &input); + + u8* dict = NULL; size_t dict_size = 0; if (argc >= 4) { dict_size = read_file(argv[3], &dict); } - size_t decompressed_size = ZSTD_get_decompressed_size(input, input_size); - if (decompressed_size == (size_t)-1) { - decompressed_size = MAX_COMPRESSION_RATIO * input_size; + size_t out_capacity = ZSTD_get_decompressed_size(input, input_size); + if (out_capacity == (size_t)-1) { + out_capacity = MAX_COMPRESSION_RATIO * input_size; fprintf(stderr, "WARNING: Compressed data does not contain " "decompressed size, going to assume the compression " "ratio is at most %d (decompressed size of at most " - "%zu)\n", - MAX_COMPRESSION_RATIO, decompressed_size); + "%u) \n", + MAX_COMPRESSION_RATIO, (unsigned)out_capacity); } - if (decompressed_size > MAX_OUTPUT_SIZE) { + if (out_capacity > MAX_OUTPUT_SIZE) { fprintf(stderr, - "Required output size too large for this implementation\n"); + "Required output size too large for this implementation \n"); return 1; } - output = malloc(decompressed_size); + + u8* const output = malloc(out_capacity); if (!output) { - fprintf(stderr, "failed to allocate memory\n"); + fprintf(stderr, "failed to allocate memory \n"); return 1; } @@ -110,16 +112,17 @@ int main(int argc, char **argv) { if (dict) { parse_dictionary(parsed_dict, dict, dict_size); } - size_t decompressed = - ZSTD_decompress_with_dict(output, decompressed_size, - input, input_size, parsed_dict); + size_t const decompressed_size = + ZSTD_decompress_with_dict(output, out_capacity, + input, input_size, + parsed_dict); free_dictionary(parsed_dict); - write_file(argv[2], output, decompressed); + write_file(argv[2], output, decompressed_size); free(input); free(output); free(dict); - input = output = dict = NULL; + return 0; } Modified: vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c Wed Nov 6 06:42:00 2019 (r354371) @@ -395,7 +395,7 @@ size_t ZSTD_decompress_with_dict(void *const dst, cons /* this decoder assumes decompression of a single frame */ decode_frame(&out, &in, parsed_dict); - return out.ptr - (u8 *)dst; + return (size_t)(out.ptr - (u8 *)dst); } /******* FRAME DECODING ******************************************************/ @@ -416,7 +416,7 @@ static void decompress_data(frame_context_t *const ctx static void decode_frame(ostream_t *const out, istream_t *const in, const dictionary_t *const dict) { - const u32 magic_number = IO_read_bits(in, 32); + const u32 magic_number = (u32)IO_read_bits(in, 32); // Zstandard frame // // "Magic_Number @@ -497,7 +497,7 @@ static void parse_frame_header(frame_header_t *const h // 3 Reserved_bit // 2 Content_Checksum_flag // 1-0 Dictionary_ID_flag" - const u8 descriptor = IO_read_bits(in, 8); + const u8 descriptor = (u8)IO_read_bits(in, 8); // decode frame header descriptor into flags const u8 frame_content_size_flag = descriptor >> 6; @@ -521,7 +521,7 @@ static void parse_frame_header(frame_header_t *const h // // Bit numbers 7-3 2-0 // Field name Exponent Mantissa" - u8 window_descriptor = IO_read_bits(in, 8); + u8 window_descriptor = (u8)IO_read_bits(in, 8); u8 exponent = window_descriptor >> 3; u8 mantissa = window_descriptor & 7; @@ -541,7 +541,7 @@ static void parse_frame_header(frame_header_t *const h const int bytes_array[] = {0, 1, 2, 4}; const int bytes = bytes_array[dictionary_id_flag]; - header->dictionary_id = IO_read_bits(in, bytes * 8); + header->dictionary_id = (u32)IO_read_bits(in, bytes * 8); } else { header->dictionary_id = 0; } @@ -633,8 +633,8 @@ static void decompress_data(frame_context_t *const ctx // // The next 2 bits represent the Block_Type, while the remaining 21 bits // represent the Block_Size. Format is little-endian." - last_block = IO_read_bits(in, 1); - const int block_type = IO_read_bits(in, 2); + last_block = (int)IO_read_bits(in, 1); + const int block_type = (int)IO_read_bits(in, 2); const size_t block_len = IO_read_bits(in, 21); switch (block_type) { @@ -748,8 +748,8 @@ static size_t decode_literals(frame_context_t *const c // types" // // size_format takes between 1 and 2 bits - int block_type = IO_read_bits(in, 2); - int size_format = IO_read_bits(in, 2); + int block_type = (int)IO_read_bits(in, 2); + int size_format = (int)IO_read_bits(in, 2); if (block_type <= 1) { // Raw or RLE literals block @@ -833,6 +833,7 @@ static size_t decode_literals_compressed(frame_context // bits (0-1023)." num_streams = 1; // Fall through as it has the same size format + /* fallthrough */ case 1: // "4 streams. Both Compressed_Size and Regenerated_Size use 10 bits // (0-1023)." @@ -855,8 +856,7 @@ static size_t decode_literals_compressed(frame_context // Impossible IMPOSSIBLE(); } - if (regenerated_size > MAX_LITERALS_SIZE || - compressed_size >= regenerated_size) { + if (regenerated_size > MAX_LITERALS_SIZE) { CORRUPTION(); } @@ -1005,7 +1005,7 @@ static const i16 SEQ_MATCH_LENGTH_DEFAULT_DIST[53] = { static const u32 SEQ_LITERAL_LENGTH_BASELINES[36] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 28, 32, 40, - 48, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65538}; + 48, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}; static const u8 SEQ_LITERAL_LENGTH_EXTRA_BITS[36] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; @@ -1021,7 +1021,7 @@ static const u8 SEQ_MATCH_LENGTH_EXTRA_BITS[53] = { 2, 2, 3, 3, 4, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; /// Offset decoding is simpler so we just need a maximum code value -static const u8 SEQ_MAX_CODES[3] = {35, -1, 52}; +static const u8 SEQ_MAX_CODES[3] = {35, (u8)-1, 52}; static void decompress_sequences(frame_context_t *const ctx, istream_t *const in, @@ -1132,7 +1132,7 @@ static void decompress_sequences(frame_context_t *cons // a single 1-bit and then fills the byte with 0-7 0 bits of padding." const int padding = 8 - highest_set_bit(src[len - 1]); // The offset starts at the end because FSE streams are read backwards - i64 bit_offset = len * 8 - padding; + i64 bit_offset = (i64)(len * 8 - (size_t)padding); // "The bitstream starts with initial state values, each using the required // number of bits in their respective accuracy, decoded previously from @@ -1409,7 +1409,7 @@ size_t ZSTD_get_decompressed_size(const void *src, con // get decompressed size from ZSTD frame header { - const u32 magic_number = IO_read_bits(&in, 32); + const u32 magic_number = (u32)IO_read_bits(&in, 32); if (magic_number == 0xFD2FB528U) { // ZSTD frame @@ -1418,7 +1418,7 @@ size_t ZSTD_get_decompressed_size(const void *src, con if (header.frame_content_size == 0 && !header.single_segment_flag) { // Content size not provided, we can't tell - return -1; + return (size_t)-1; } return header.frame_content_size; @@ -1529,7 +1529,7 @@ void free_dictionary(dictionary_t *const dict) { /******* END DICTIONARY PARSING ***********************************************/ /******* IO STREAM OPERATIONS *************************************************/ -#define UNALIGNED() ERROR("Attempting to operate on a non-byte aligned stream") + /// Reads `num` bits from a bitstream, and updates the internal offset static inline u64 IO_read_bits(istream_t *const in, const int num_bits) { if (num_bits > 64 || num_bits <= 0) { @@ -1608,7 +1608,7 @@ static inline const u8 *IO_get_read_ptr(istream_t *con INP_SIZE(); } if (in->bit_offset != 0) { - UNALIGNED(); + ERROR("Attempting to operate on a non-byte aligned stream"); } const u8 *const ptr = in->ptr; in->ptr += len; @@ -1634,7 +1634,7 @@ static inline void IO_advance_input(istream_t *const i INP_SIZE(); } if (in->bit_offset != 0) { - UNALIGNED(); + ERROR("Attempting to operate on a non-byte aligned stream"); } in->ptr += len; Modified: vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h ============================================================================== --- vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h Wed Nov 6 06:42:00 2019 (r354371) @@ -7,6 +7,8 @@ * in the COPYING file in the root directory of this source tree). */ +#include /* size_t */ + /******* EXPOSED TYPES ********************************************************/ /* * Contains the parsed contents of a dictionary @@ -39,7 +41,7 @@ size_t ZSTD_get_decompressed_size(const void *const sr * Return a valid dictionary_t pointer for use with dictionary initialization * or decompression */ -dictionary_t* create_dictionary(); +dictionary_t* create_dictionary(void); /* * Parse a provided dictionary blob for use in decompression Modified: vendor/zstd/dist/doc/zstd_compression_format.md ============================================================================== --- vendor/zstd/dist/doc/zstd_compression_format.md Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/zstd_compression_format.md Wed Nov 6 06:42:00 2019 (r354371) @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.3.2 (17/07/19) +0.3.4 (16/08/19) Introduction @@ -358,6 +358,7 @@ It may be followed by an optional `Content_Checksum` __`Block_Type`__ The next 2 bits represent the `Block_Type`. +`Block_Type` influences the meaning of `Block_Size`. There are 4 block types : | Value | 0 | 1 | 2 | 3 | @@ -384,9 +385,12 @@ There are 4 block types : __`Block_Size`__ The upper 21 bits of `Block_Header` represent the `Block_Size`. -`Block_Size` is the size of the block excluding the header. -A block can contain any number of bytes (even zero), up to -`Block_Maximum_Decompressed_Size`, which is the smallest of: +When `Block_Type` is `Compressed_Block` or `Raw_Block`, +`Block_Size` is the size of `Block_Content`, hence excluding `Block_Header`. +When `Block_Type` is `RLE_Block`, `Block_Content`’s size is always 1, +and `Block_Size` represents the number of times this byte must be repeated. +A block can contain and decompress into any number of bytes (even zero), +up to `Block_Maximum_Decompressed_Size`, which is the smallest of: - Window_Size - 128 KB @@ -1103,18 +1107,18 @@ It follows the following build rule : The table has a size of `Table_Size = 1 << Accuracy_Log`. Each cell describes the symbol decoded, -and instructions to get the next state. +and instructions to get the next state (`Number_of_Bits` and `Baseline`). Symbols are scanned in their natural order for "less than 1" probabilities. Symbols with this probability are being attributed a single cell, starting from the end of the table and retreating. These symbols define a full state reset, reading `Accuracy_Log` bits. -All remaining symbols are allocated in their natural order. -Starting from symbol `0` and table position `0`, +Then, all remaining symbols, sorted in natural order, are allocated cells. +Starting from symbol `0` (if it exists), and table position `0`, each symbol gets allocated as many cells as its probability. Cell allocation is spreaded, not linear : -each successor position follow this rule : +each successor position follows this rule : ``` position += (tableSize>>1) + (tableSize>>3) + 3; @@ -1126,40 +1130,41 @@ A position is skipped if already occupied by a "less t each position in the table, switching to the next symbol when enough states have been allocated to the current one. -The result is a list of state values. -Each state will decode the current symbol. +The process guarantees that the table is entirely filled. +Each cell corresponds to a state value, which contains the symbol being decoded. -To get the `Number_of_Bits` and `Baseline` required for next state, -it's first necessary to sort all states in their natural order. -The lower states will need 1 more bit than higher ones. +To add the `Number_of_Bits` and `Baseline` required to retrieve next state, +it's first necessary to sort all occurrences of each symbol in state order. +Lower states will need 1 more bit than higher ones. The process is repeated for each symbol. __Example__ : -Presuming a symbol has a probability of 5. -It receives 5 state values. States are sorted in natural order. +Presuming a symbol has a probability of 5, +it receives 5 cells, corresponding to 5 state values. +These state values are then sorted in natural order. -Next power of 2 is 8. -Space of probabilities is divided into 8 equal parts. -Presuming the `Accuracy_Log` is 7, it defines 128 states. +Next power of 2 after 5 is 8. +Space of probabilities must be divided into 8 equal parts. +Presuming the `Accuracy_Log` is 7, it defines a space of 128 states. Divided by 8, each share is 16 large. -In order to reach 8, 8-5=3 lowest states will count "double", -doubling the number of shares (32 in width), -requiring one more bit in the process. +In order to reach 8 shares, 8-5=3 lowest states will count "double", +doubling their shares (32 in width), hence requiring one more bit. Baseline is assigned starting from the higher states using fewer bits, -and proceeding naturally, then resuming at the first state, -each takes its allocated width from Baseline. +increasing at each state, then resuming at the first state, +each state takes its allocated width from Baseline. -| state order | 0 | 1 | 2 | 3 | 4 | -| ---------------- | ----- | ----- | ------ | ---- | ----- | -| width | 32 | 32 | 32 | 16 | 16 | -| `Number_of_Bits` | 5 | 5 | 5 | 4 | 4 | -| range number | 2 | 4 | 6 | 0 | 1 | -| `Baseline` | 32 | 64 | 96 | 0 | 16 | -| range | 32-63 | 64-95 | 96-127 | 0-15 | 16-31 | +| state value | 1 | 39 | 77 | 84 | 122 | +| state order | 0 | 1 | 2 | 3 | 4 | +| ---------------- | ----- | ----- | ------ | ---- | ------ | +| width | 32 | 32 | 32 | 16 | 16 | +| `Number_of_Bits` | 5 | 5 | 5 | 4 | 4 | +| range number | 2 | 4 | 6 | 0 | 1 | +| `Baseline` | 32 | 64 | 96 | 0 | 16 | +| range | 32-63 | 64-95 | 96-127 | 0-15 | 16-31 | -The next state is determined from current state +During decoding, the next state value is determined from current state value, by reading the required `Number_of_Bits`, and adding the specified `Baseline`. See [Appendix A] for the results of this process applied to the default distributions. @@ -1653,6 +1658,8 @@ or at least provide a meaningful error code explaining Version changes --------------- +- 0.3.4 : clarifications for FSE decoding table +- 0.3.3 : clarifications for field Block_Size - 0.3.2 : remove additional block size restriction on compressed blocks - 0.3.1 : minor clarification regarding offset history update rules - 0.3.0 : minor edits to match RFC8478 Modified: vendor/zstd/dist/doc/zstd_manual.html ============================================================================== --- vendor/zstd/dist/doc/zstd_manual.html Wed Nov 6 06:38:34 2019 (r354370) +++ vendor/zstd/dist/doc/zstd_manual.html Wed Nov 6 06:42:00 2019 (r354371) @@ -1,10 +1,10 @@ -zstd 1.4.2 Manual +zstd 1.4.4 Manual -

zstd 1.4.2 Manual

+

zstd 1.4.4 Manual


Contents

    @@ -27,10 +27,16 @@
  1. Advanced compression functions
  2. Advanced decompression functions
  3. Advanced streaming functions
  4. -
  5. Buffer-less and synchronous inner streaming functions
  6. -
  7. Buffer-less streaming compression (synchronous mode)
  8. -
  9. Buffer-less streaming decompression (synchronous mode)
  10. -
  11. Block level API
  12. +
  13. ! ZSTD_initCStream_usingDict() :
  14. +
  15. ! ZSTD_initCStream_advanced() :
  16. +
  17. ! ZSTD_initCStream_usingCDict() :
  18. +
  19. ! ZSTD_initCStream_usingCDict_advanced() :
  20. +
  21. This function is deprecated, and is equivalent to:
  22. +
  23. This function is deprecated, and is equivalent to:
  24. +
  25. Buffer-less and synchronous inner streaming functions
  26. +
  27. Buffer-less streaming compression (synchronous mode)
  28. +
  29. Buffer-less streaming decompression (synchronous mode)
  30. +
  31. Block level API

Introduction

@@ -157,9 +163,13 @@ size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);
                          void* dst, size_t dstCapacity,
                    const void* src, size_t srcSize,
                          int compressionLevel);
-

Same as ZSTD_compress(), using an explicit ZSTD_CCtx - The function will compress at requested compression level, - ignoring any other parameter +

Same as ZSTD_compress(), using an explicit ZSTD_CCtx. + Important : in order to behave similarly to `ZSTD_compress()`, + this function compresses at requested compression level, + __ignoring any other parameter__ . + If any advanced parameter was set using the advanced API, + they will all be reset. Only `compressionLevel` remains. +


Decompression context

  When decompressing many times,
@@ -199,18 +209,26 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
 
     /* compression parameters
      * Note: When compressing with a ZSTD_CDict these parameters are superseded
-     * by the parameters used to construct the ZSTD_CDict. See ZSTD_CCtx_refCDict()
-     * for more info (superseded-by-cdict). */
-    ZSTD_c_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
+     * by the parameters used to construct the ZSTD_CDict.
+     * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */
+    ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table.
+                              * Note that exact compression parameters are dynamically determined,
+                              * depending on both compression level and srcSize (when known).
                               * Default level is ZSTD_CLEVEL_DEFAULT==3.
                               * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
                               * Note 1 : it's possible to pass a negative compression level.
-                              * Note 2 : setting a level sets all default values of other compression parameters */
+                              * Note 2 : setting a level resets all other compression parameters to default */
+    /* Advanced compression parameters :
+     * It's possible to pin down compression parameters to some specific values.
+     * In which case, these values are no longer dynamically selected by the compressor */
     ZSTD_c_windowLog=101,    /* Maximum allowed back-reference distance, expressed as power of 2.
+                              * This will set a memory budget for streaming decompression,
+                              * with larger values requiring more memory
+                              * and typically compressing more.
                               * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
                               * Special: value 0 means "use default windowLog".
                               * Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT
-                              *       requires explicitly allowing such window size at decompression stage if using streaming. */
+                              *       requires explicitly allowing such size at streaming decompression stage. */
     ZSTD_c_hashLog=102,      /* Size of the initial probe table, as a power of 2.
                               * Resulting memory usage is (1 << (hashLog+2)).
                               * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
@@ -221,13 +239,13 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
                               * Resulting memory usage is (1 << (chainLog+2)).
                               * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
                               * Larger tables result in better and slower compression.
-                              * This parameter is useless when using "fast" strategy.
+                              * This parameter is useless for "fast" strategy.
                               * It's still useful when using "dfast" strategy,
                               * in which case it defines a secondary probe table.
                               * Special: value 0 means "use default chainLog". */
     ZSTD_c_searchLog=104,    /* Number of search attempts, as a power of 2.
                               * More attempts result in better and slower compression.
-                              * This parameter is useless when using "fast" and "dFast" strategies.
+                              * This parameter is useless for "fast" and "dFast" strategies.
                               * Special: value 0 means "use default searchLog". */
     ZSTD_c_minMatch=105,     /* Minimum size of searched matches.
                               * Note that Zstandard can still find matches of smaller size,
@@ -282,7 +300,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
     ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
                               * Content size must be known at the beginning of compression.
                               * This is automatically the case when using ZSTD_compress2(),
-                              * For streaming variants, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */
+                              * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */
     ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
     ZSTD_c_dictIDFlag=202,   /* When applicable, dictionary's ID is written into frame header (default:1) */
 
@@ -301,7 +319,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
                               * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
                               * 0 means default, which is dynamically determined based on compression parameters.
                               * Job size must be a minimum of overlap size, or 1 MB, whichever is largest.
-                              * The minimum size is automatically and transparently enforced */
+                              * The minimum size is automatically and transparently enforced. */
     ZSTD_c_overlapLog=402,   /* Control the overlap size, as a fraction of window size.
                               * The overlap size is an amount of data reloaded from previous job at the beginning of a new job.
                               * It helps preserve compression ratio, while each job is compressed in parallel.
@@ -324,6 +342,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      * ZSTD_c_forceAttachDict
      * ZSTD_c_literalCompressionMode
      * ZSTD_c_targetCBlockSize
+     * ZSTD_c_srcSizeHint
      * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
      * note : never ever use experimentalParam? names directly;
      *        also, the enums values themselves are unstable and can still change.
@@ -334,6 +353,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);
      ZSTD_c_experimentalParam4=1001,
      ZSTD_c_experimentalParam5=1002,
      ZSTD_c_experimentalParam6=1003,
+     ZSTD_c_experimentalParam7=1004
 } ZSTD_cParameter;
 

typedef struct {
@@ -672,12 +692,17 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
 
 
ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
                              int compressionLevel);
-

When compressing multiple messages / blocks using the same dictionary, it's recommended to load it only once. - ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup cost. +

When compressing multiple messages or blocks using the same dictionary, + it's recommended to digest the dictionary only once, since it's a costly operation. + ZSTD_createCDict() will create a state from digesting a dictionary. + The resulting state can be used for future compression operations with very limited startup cost. ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. - `dictBuffer` can be released after ZSTD_CDict creation, because its content is copied within CDict. - Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate `dictBuffer` content. - Note : A ZSTD_CDict can be created from an empty dictBuffer, but it is inefficient when used to compress small data. + @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. + Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content. + Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, + in which case the only thing that it transports is the @compressionLevel. + This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, + expecting a ZSTD_CDict parameter with any data, including those without a known dictionary.


size_t      ZSTD_freeCDict(ZSTD_CDict* CDict);
@@ -794,7 +819,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
   Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
            It's a CPU consuming operation, with non-negligible impact on latency.
            If there is a need to use the same prefix multiple times, consider loadDictionary instead.
-  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dm_rawContent).
+  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).
            Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation. 
 


@@ -838,7 +863,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds); Note 2 : Prefix buffer is referenced. It **must** outlive decompression. Prefix buffer must remain unmodified up to the end of frame, reached when ZSTD_decompressStream() returns 0. - Note 3 : By default, the prefix is treated as raw content (ZSTD_dm_rawContent). + Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section) Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. A full dictionary is more costly, as it requires building tables. @@ -865,6 +890,24 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
typedef struct {
+    unsigned int matchPos; /* Match pos in dst */
+    /* If seqDef.offset > 3, then this is seqDef.offset - 3
+     * If seqDef.offset < 3, then this is the corresponding repeat offset
+     * But if seqDef.offset < 3 and litLength == 0, this is the
+     *   repeat offset before the corresponding repeat offset
+     * And if seqDef.offset == 3 and litLength == 0, this is the
+     *   most recent repeat offset - 1
+     */
+    unsigned int offset;
+    unsigned int litLength; /* Literal length */
+    unsigned int matchLength; /* Match length */
+    /* 0 when seq not rep and seqDef.offset otherwise
+     * when litLength == 0 this will be <= 4, otherwise <= 3 like normal
+     */
+    unsigned int rep;
+} ZSTD_Sequence;
+

+
typedef struct {
     unsigned windowLog;       /**< largest match distance : larger == more compression, more memory needed during decompression */
     unsigned chainLog;        /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */
     unsigned hashLog;         /**< dispatch table : larger == faster, more memory */
@@ -893,21 +936,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
 

typedef enum {
     ZSTD_dlm_byCopy = 0,  /**< Copy dictionary content internally */
-    ZSTD_dlm_byRef = 1,   /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
+    ZSTD_dlm_byRef = 1    /**< Reference dictionary content -- the dictionary buffer must outlive its users. */
 } ZSTD_dictLoadMethod_e;
 

typedef enum {
-    /* Opened question : should we have a format ZSTD_f_auto ?
-     * Today, it would mean exactly the same as ZSTD_f_zstd1.
-     * But, in the future, should several formats become supported,
-     * on the compression side, it would mean "default format".
-     * On the decompression side, it would mean "automatic format detection",
-     * so that ZSTD_f_zstd1 would mean "accept *only* zstd frames".
-     * Since meaning is a little different, another option could be to define different enums for compression and decompression.
-     * This question could be kept for later, when there are actually multiple formats to support,
-     * but there is also the question of pinning enum values, and pinning value `0` is especially important */
     ZSTD_f_zstd1 = 0,           /* zstd frame format, specified in zstd_compression_format.md (default) */
-    ZSTD_f_zstd1_magicless = 1, /* Variant of zstd frame format, without initial 4-bytes magic number.
+    ZSTD_f_zstd1_magicless = 1  /* Variant of zstd frame format, without initial 4-bytes magic number.
                                  * Useful to save 4 bytes per generated frame.
                                  * Decoder cannot recognise automatically this format, requiring this instruction. */
 } ZSTD_format_e;
@@ -918,7 +952,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
      * to evolve and should be considered only in the context of extremely
      * advanced performance tuning.
      *
-     * Zstd currently supports the use of a CDict in two ways:
+     * Zstd currently supports the use of a CDict in three ways:
      *
      * - The contents of the CDict can be copied into the working context. This
      *   means that the compression can search both the dictionary and input
@@ -934,6 +968,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
      *   working context's tables can be reused). For small inputs, this can be
      *   faster than copying the CDict's tables.
      *
+     * - The CDict's tables are not used at all, and instead we use the working
+     *   context alone to reload the dictionary and use params based on the source
+     *   size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict().
+     *   This method is effective when the dictionary sizes are very small relative
+     *   to the input size, and the input size is fairly large to begin with.
+     *
      * Zstd has a simple internal heuristic that selects which strategy to use
      * at the beginning of a compression. However, if experimentation shows that
      * Zstd is making poor choices, it is possible to override that choice with
@@ -942,6 +982,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
     ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
     ZSTD_dictForceAttach   = 1, /* Never copy the dictionary. */
     ZSTD_dictForceCopy     = 2, /* Always copy the dictionary. */
+    ZSTD_dictForceLoad     = 3  /* Always reload the dictionary */
 } ZSTD_dictAttachPref_e;
 

typedef enum {
@@ -950,7 +991,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
                                *   levels will be compressed. */
   ZSTD_lcm_huffman = 1,       /**< Always attempt Huffman compression. Uncompressed literals will still be
                                *   emitted if Huffman compression is not profitable. */
-  ZSTD_lcm_uncompressed = 2,  /**< Always emit uncompressed literals. */
+  ZSTD_lcm_uncompressed = 2   /**< Always emit uncompressed literals. */
 } ZSTD_literalCompressionMode_e;
 

Frame size functions


@@ -999,20 +1040,38 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
            or an error code (if srcSize is too small) 
 


+
size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
+    size_t outSeqsSize, const void* src, size_t srcSize);
+

Extract sequences from the sequence store + zc can be used to insert custom compression params. + This function invokes ZSTD_compress2 + @return : number of sequences extracted + +


+

Memory management


 
 
size_t ZSTD_estimateCCtxSize(int compressionLevel);
 size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
 size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
 size_t ZSTD_estimateDCtxSize(void);
-

These functions make it possible to estimate memory usage - of a future {D,C}Ctx, before its creation. - ZSTD_estimateCCtxSize() will provide a budget large enough for any compression level up to selected one. - It will also consider src size to be arbitrarily "large", which is worst case. - If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. - ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. - ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1. - Note : CCtx size estimation is only correct for single-threaded compression. +

These functions make it possible to estimate memory usage of a future + {D,C}Ctx, before its creation. + + ZSTD_estimateCCtxSize() will provide a budget large enough for any + compression level up to selected one. Unlike ZSTD_estimateCStreamSize*(), + this estimate does not include space for a window buffer, so this estimate + is guaranteed to be enough for single-shot compressions, but not streaming + compressions. It will however assume the input may be arbitrarily large, + which is the worst case. If srcSize is known to always be small, + ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. + ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with + ZSTD_getCParams() to create cParams from compressionLevel. + ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with + ZSTD_CCtxParams_setParameter(). + + Note: only single-threaded compression is supported. This function will + return an error code if ZSTD_c_nbWorkers is >= 1.


size_t ZSTD_estimateCStreamSize(int compressionLevel);
@@ -1085,7 +1144,8 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
 

Create a digested dictionary for compression Dictionary content is just referenced, not duplicated. As a consequence, `dictBuffer` **must** outlive CDict, - and its content must remain unmodified throughout the lifetime of CDict. + and its content must remain unmodified throughout the lifetime of CDict. + note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef


ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
@@ -1116,7 +1176,9 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
                         const void* src, size_t srcSize,
                         const void* dict,size_t dictSize,
                               ZSTD_parameters params);
-

Same as ZSTD_compress_usingDict(), with fine-tune control over compression parameters (by structure) +

Note : this function is now DEPRECATED. + It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. + This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x


size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
@@ -1124,7 +1186,9 @@ static ZSTD_customMem const ZSTD_defaultCMem = { NULL,
                             const void* src, size_t srcSize,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@freebsd.org  Wed Nov  6 06:43:14 2019
Return-Path: 
Delivered-To: svn-src-all@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30C961AB262;
 Wed,  6 Nov 2019 06:43:14 +0000 (UTC) (envelope-from cem@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 477H6V1JTkz4txS;
 Wed,  6 Nov 2019 06:43:14 +0000 (UTC) (envelope-from cem@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10F6221269;
 Wed,  6 Nov 2019 06:43:14 +0000 (UTC) (envelope-from cem@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA66hDmC069992;
 Wed, 6 Nov 2019 06:43:13 GMT (envelope-from cem@FreeBSD.org)
Received: (from cem@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA66hDZN069989;
 Wed, 6 Nov 2019 06:43:13 GMT (envelope-from cem@FreeBSD.org)
Message-Id: <201911060643.xA66hDZN069989@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org
 using -f
From: Conrad Meyer 
Date: Wed, 6 Nov 2019 06:43:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r354372 - in vendor/zstd/1.4.4: .
 contrib/adaptive-compression contrib/gen_html contrib/pzstd
 contrib/seekable_format/examples doc doc/educational_decoder examples lib
 lib/common lib/co...
X-SVN-Group: vendor
X-SVN-Commit-Author: cem
X-SVN-Commit-Paths: in vendor/zstd/1.4.4: . contrib/adaptive-compression
 contrib/gen_html contrib/pzstd contrib/seekable_format/examples doc
 doc/educational_decoder examples lib lib/common lib/compress lib/decompress
 lib...
X-SVN-Commit-Revision: 354372
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 06 Nov 2019 06:43:14 -0000

Author: cem
Date: Wed Nov  6 06:43:13 2019
New Revision: 354372
URL: https://svnweb.freebsd.org/changeset/base/354372

Log:
  Tag Zstd 1.4.4

Added:
  vendor/zstd/1.4.4/
     - copied from r354369, vendor/zstd/dist/
  vendor/zstd/1.4.4/lib/compress/zstd_cwksp.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_cwksp.h
  vendor/zstd/1.4.4/tests/fuzz/dictionary_loader.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/dictionary_loader.c
  vendor/zstd/1.4.4/tests/fuzz/fuzz_data_producer.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/fuzz_data_producer.c
  vendor/zstd/1.4.4/tests/fuzz/fuzz_data_producer.h
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/fuzz_data_producer.h
  vendor/zstd/1.4.4/tests/golden-compression/
     - copied from r354371, vendor/zstd/dist/tests/golden-compression/
  vendor/zstd/1.4.4/tests/golden-decompression/
     - copied from r354371, vendor/zstd/dist/tests/golden-decompression/
Replaced:
  vendor/zstd/1.4.4/CHANGELOG
     - copied unchanged from r354371, vendor/zstd/dist/CHANGELOG
  vendor/zstd/1.4.4/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/Makefile
  vendor/zstd/1.4.4/README.md
     - copied unchanged from r354371, vendor/zstd/dist/README.md
  vendor/zstd/1.4.4/appveyor.yml
     - copied unchanged from r354371, vendor/zstd/dist/appveyor.yml
  vendor/zstd/1.4.4/doc/educational_decoder/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/doc/educational_decoder/Makefile
  vendor/zstd/1.4.4/doc/educational_decoder/harness.c
     - copied unchanged from r354371, vendor/zstd/dist/doc/educational_decoder/harness.c
  vendor/zstd/1.4.4/doc/educational_decoder/zstd_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.c
  vendor/zstd/1.4.4/doc/educational_decoder/zstd_decompress.h
     - copied unchanged from r354371, vendor/zstd/dist/doc/educational_decoder/zstd_decompress.h
  vendor/zstd/1.4.4/doc/zstd_compression_format.md
     - copied unchanged from r354371, vendor/zstd/dist/doc/zstd_compression_format.md
  vendor/zstd/1.4.4/doc/zstd_manual.html
     - copied unchanged from r354371, vendor/zstd/dist/doc/zstd_manual.html
  vendor/zstd/1.4.4/examples/streaming_compression.c
     - copied unchanged from r354371, vendor/zstd/dist/examples/streaming_compression.c
  vendor/zstd/1.4.4/examples/streaming_decompression.c
     - copied unchanged from r354371, vendor/zstd/dist/examples/streaming_decompression.c
  vendor/zstd/1.4.4/lib/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/lib/Makefile
  vendor/zstd/1.4.4/lib/README.md
     - copied unchanged from r354371, vendor/zstd/dist/lib/README.md
  vendor/zstd/1.4.4/lib/common/bitstream.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/bitstream.h
  vendor/zstd/1.4.4/lib/common/compiler.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/compiler.h
  vendor/zstd/1.4.4/lib/common/fse.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/fse.h
  vendor/zstd/1.4.4/lib/common/fse_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/fse_decompress.c
  vendor/zstd/1.4.4/lib/common/mem.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/mem.h
  vendor/zstd/1.4.4/lib/common/pool.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/pool.c
  vendor/zstd/1.4.4/lib/common/threading.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/threading.c
  vendor/zstd/1.4.4/lib/common/threading.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/threading.h
  vendor/zstd/1.4.4/lib/common/xxhash.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/xxhash.c
  vendor/zstd/1.4.4/lib/common/zstd_internal.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/common/zstd_internal.h
  vendor/zstd/1.4.4/lib/compress/zstd_compress.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress.c
  vendor/zstd/1.4.4/lib/compress/zstd_compress_internal.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress_internal.h
  vendor/zstd/1.4.4/lib/compress/zstd_compress_literals.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress_literals.c
  vendor/zstd/1.4.4/lib/compress/zstd_compress_literals.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress_literals.h
  vendor/zstd/1.4.4/lib/compress/zstd_compress_sequences.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress_sequences.c
  vendor/zstd/1.4.4/lib/compress/zstd_compress_sequences.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_compress_sequences.h
  vendor/zstd/1.4.4/lib/compress/zstd_double_fast.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_double_fast.c
  vendor/zstd/1.4.4/lib/compress/zstd_fast.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_fast.c
  vendor/zstd/1.4.4/lib/compress/zstd_lazy.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_lazy.c
  vendor/zstd/1.4.4/lib/compress/zstd_ldm.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_ldm.c
  vendor/zstd/1.4.4/lib/compress/zstd_opt.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstd_opt.c
  vendor/zstd/1.4.4/lib/compress/zstdmt_compress.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/compress/zstdmt_compress.c
  vendor/zstd/1.4.4/lib/decompress/huf_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/decompress/huf_decompress.c
  vendor/zstd/1.4.4/lib/decompress/zstd_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/decompress/zstd_decompress.c
  vendor/zstd/1.4.4/lib/decompress/zstd_decompress_block.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/decompress/zstd_decompress_block.c
  vendor/zstd/1.4.4/lib/deprecated/zbuff.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/deprecated/zbuff.h
  vendor/zstd/1.4.4/lib/dictBuilder/cover.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/dictBuilder/cover.c
  vendor/zstd/1.4.4/lib/dictBuilder/zdict.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/dictBuilder/zdict.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v01.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v01.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v02.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v02.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v03.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v03.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v04.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v04.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v05.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v05.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v06.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v06.c
  vendor/zstd/1.4.4/lib/legacy/zstd_v07.c
     - copied unchanged from r354371, vendor/zstd/dist/lib/legacy/zstd_v07.c
  vendor/zstd/1.4.4/lib/libzstd.pc.in
     - copied unchanged from r354371, vendor/zstd/dist/lib/libzstd.pc.in
  vendor/zstd/1.4.4/lib/zstd.h
     - copied unchanged from r354371, vendor/zstd/dist/lib/zstd.h
  vendor/zstd/1.4.4/programs/README.md
     - copied unchanged from r354371, vendor/zstd/dist/programs/README.md
  vendor/zstd/1.4.4/programs/benchzstd.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/benchzstd.c
  vendor/zstd/1.4.4/programs/benchzstd.h
     - copied unchanged from r354371, vendor/zstd/dist/programs/benchzstd.h
  vendor/zstd/1.4.4/programs/datagen.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/datagen.c
  vendor/zstd/1.4.4/programs/dibio.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/dibio.c
  vendor/zstd/1.4.4/programs/fileio.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/fileio.c
  vendor/zstd/1.4.4/programs/fileio.h
     - copied unchanged from r354371, vendor/zstd/dist/programs/fileio.h
  vendor/zstd/1.4.4/programs/platform.h
     - copied unchanged from r354371, vendor/zstd/dist/programs/platform.h
  vendor/zstd/1.4.4/programs/timefn.h
     - copied unchanged from r354371, vendor/zstd/dist/programs/timefn.h
  vendor/zstd/1.4.4/programs/util.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/util.c
  vendor/zstd/1.4.4/programs/util.h
     - copied unchanged from r354371, vendor/zstd/dist/programs/util.h
  vendor/zstd/1.4.4/programs/zstd.1
     - copied unchanged from r354371, vendor/zstd/dist/programs/zstd.1
  vendor/zstd/1.4.4/programs/zstd.1.md
     - copied unchanged from r354371, vendor/zstd/dist/programs/zstd.1.md
  vendor/zstd/1.4.4/programs/zstdcli.c
     - copied unchanged from r354371, vendor/zstd/dist/programs/zstdcli.c
  vendor/zstd/1.4.4/programs/zstdgrep.1
     - copied unchanged from r354371, vendor/zstd/dist/programs/zstdgrep.1
  vendor/zstd/1.4.4/programs/zstdless.1
     - copied unchanged from r354371, vendor/zstd/dist/programs/zstdless.1
  vendor/zstd/1.4.4/tests/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/tests/Makefile
  vendor/zstd/1.4.4/tests/decodecorpus.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/decodecorpus.c
  vendor/zstd/1.4.4/tests/fullbench.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fullbench.c
  vendor/zstd/1.4.4/tests/fuzz/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/Makefile
  vendor/zstd/1.4.4/tests/fuzz/README.md
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/README.md
  vendor/zstd/1.4.4/tests/fuzz/block_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/block_decompress.c
  vendor/zstd/1.4.4/tests/fuzz/block_round_trip.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/block_round_trip.c
  vendor/zstd/1.4.4/tests/fuzz/dictionary_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/dictionary_decompress.c
  vendor/zstd/1.4.4/tests/fuzz/dictionary_round_trip.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/dictionary_round_trip.c
  vendor/zstd/1.4.4/tests/fuzz/fuzz.h
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/fuzz.h
  vendor/zstd/1.4.4/tests/fuzz/fuzz.py
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/fuzz.py
  vendor/zstd/1.4.4/tests/fuzz/fuzz_helpers.h
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/fuzz_helpers.h
  vendor/zstd/1.4.4/tests/fuzz/regression_driver.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/regression_driver.c
  vendor/zstd/1.4.4/tests/fuzz/simple_compress.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/simple_compress.c
  vendor/zstd/1.4.4/tests/fuzz/simple_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/simple_decompress.c
  vendor/zstd/1.4.4/tests/fuzz/simple_round_trip.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/simple_round_trip.c
  vendor/zstd/1.4.4/tests/fuzz/stream_decompress.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/stream_decompress.c
  vendor/zstd/1.4.4/tests/fuzz/stream_round_trip.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/stream_round_trip.c
  vendor/zstd/1.4.4/tests/fuzz/zstd_frame_info.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/zstd_frame_info.c
  vendor/zstd/1.4.4/tests/fuzz/zstd_helpers.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/zstd_helpers.c
  vendor/zstd/1.4.4/tests/fuzz/zstd_helpers.h
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzz/zstd_helpers.h
  vendor/zstd/1.4.4/tests/fuzzer.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/fuzzer.c
  vendor/zstd/1.4.4/tests/playTests.sh
     - copied unchanged from r354371, vendor/zstd/dist/tests/playTests.sh
  vendor/zstd/1.4.4/tests/poolTests.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/poolTests.c
  vendor/zstd/1.4.4/tests/regression/method.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/regression/method.c
  vendor/zstd/1.4.4/tests/regression/results.csv
     - copied unchanged from r354371, vendor/zstd/dist/tests/regression/results.csv
  vendor/zstd/1.4.4/tests/zbufftest.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/zbufftest.c
  vendor/zstd/1.4.4/tests/zstreamtest.c
     - copied unchanged from r354371, vendor/zstd/dist/tests/zstreamtest.c
  vendor/zstd/1.4.4/zlibWrapper/Makefile
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/Makefile
  vendor/zstd/1.4.4/zlibWrapper/examples/fitblk.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/examples/fitblk.c
  vendor/zstd/1.4.4/zlibWrapper/examples/zwrapbench.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/examples/zwrapbench.c
  vendor/zstd/1.4.4/zlibWrapper/gzclose.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/gzclose.c
  vendor/zstd/1.4.4/zlibWrapper/gzlib.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/gzlib.c
  vendor/zstd/1.4.4/zlibWrapper/gzread.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/gzread.c
  vendor/zstd/1.4.4/zlibWrapper/gzwrite.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/gzwrite.c
  vendor/zstd/1.4.4/zlibWrapper/zstd_zlibwrapper.c
     - copied unchanged from r354371, vendor/zstd/dist/zlibWrapper/zstd_zlibwrapper.c
Deleted:
  vendor/zstd/1.4.4/contrib/adaptive-compression/Makefile
  vendor/zstd/1.4.4/contrib/adaptive-compression/README.md
  vendor/zstd/1.4.4/contrib/adaptive-compression/adapt.c
  vendor/zstd/1.4.4/contrib/adaptive-compression/datagencli.c
  vendor/zstd/1.4.4/contrib/adaptive-compression/test-correctness.sh
  vendor/zstd/1.4.4/contrib/adaptive-compression/test-performance.sh
  vendor/zstd/1.4.4/contrib/gen_html/.gitignore
  vendor/zstd/1.4.4/contrib/pzstd/.gitignore
  vendor/zstd/1.4.4/contrib/seekable_format/examples/.gitignore
  vendor/zstd/1.4.4/examples/.gitignore
  vendor/zstd/1.4.4/lib/.gitignore
  vendor/zstd/1.4.4/programs/.gitignore
  vendor/zstd/1.4.4/tests/.gitignore
  vendor/zstd/1.4.4/tests/files/huffman-compressed-larger
  vendor/zstd/1.4.4/zlibWrapper/.gitignore

Copied: vendor/zstd/1.4.4/CHANGELOG (from r354371, vendor/zstd/dist/CHANGELOG)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/zstd/1.4.4/CHANGELOG	Wed Nov  6 06:43:13 2019	(r354372, copy of r354371, vendor/zstd/dist/CHANGELOG)
@@ -0,0 +1,528 @@
+v1.4.4
+perf: Improved decompression speed, by > 10%, by @terrelln
+perf: Better compression speed when re-using a context, by @felixhandte
+perf: Fix compression ratio when compressing large files with small dictionary, by @senhuang42
+perf: zstd reference encoder can generate RLE blocks, by @bimbashrestha
+perf: minor generic speed optimization, by @davidbolvansky
+api: new ability to extract sequences from the parser for analysis, by @bimbashrestha
+api: fixed decoding of magic-less frames, by @terrelln
+api: fixed ZSTD_initCStream_advanced() performance with fast modes, reported by @QrczakMK
+cli: Named pipes support, by @bimbashrestha
+cli: short tar's extension support, by @stokito
+cli: command --output-dir-flat= , generates target files into requested directory, by @senhuang42
+cli: commands --stream-size=# and --size-hint=#, by @nmagerko
+cli: command --exclude-compressed, by @shashank0791
+cli: faster `-t` test mode
+cli: improved some error messages, by @vangyzen
+cli: rare deadlock condition within dictionary builder, by @terrelln
+build: single-file decoder with emscripten compilation script, by @cwoffenden
+build: fixed zlibWrapper compilation on Visual Studio, reported by @bluenlive
+build: fixed deprecation warning for certain gcc version, reported by @jasonma163
+build: fix compilation on old gcc versions, by @cemeyer
+build: improved installation directories for cmake script, by Dmitri Shubin
+pack: modified pkgconfig, for better integration into openwrt, requested by @neheb
+misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, ZSTD_CDict, function deprecation, zstd format
+misc: fixed educational decoder : accept larger literals section, and removed UNALIGNED() macro
+
+v1.4.3
+bug: Fix Dictionary Compression Ratio Regression by @cyan4973 (#1709)
+bug: Fix Buffer Overflow in legacy v0.3 decompression by @felixhandte (#1722)
+build: Add support for IAR C/C++ Compiler for Arm by @joseph0918 (#1705)
+
+v1.4.2
+bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696)
+bug: Fix seekable decompression in-memory API by @iburinoc (#1695)
+misc: Validate blocks are smaller than size limit by @vivekmg (#1685)
+misc: Restructure source files by @ephiepark (#1679)
+
+v1.4.1
+bug: Fix data corruption in niche use cases by @terrelln (#1659)
+bug: Fuzz legacy modes, fix uncovered bugs by @terrelln (#1593, #1594, #1595)
+bug: Fix out of bounds read by @terrelln (#1590)
+perf: Improve decode speed by ~7% @mgrice (#1668)
+perf: Slightly improved compression ratio of level 3 and 4 (ZSTD_dfast) by @cyan4973 (#1681)
+perf: Slightly faster compression speed when re-using a context by @cyan4973 (#1658)
+perf: Improve compression ratio for small windowLog by @cyan4973 (#1624)
+perf: Faster compression speed in high compression mode for repetitive data by @terrelln (#1635)
+api: Add parameter to generate smaller dictionaries by @tyler-tran (#1656)
+cli: Recognize symlinks when built in C99 mode by @felixhandte (#1640)
+cli: Expose cpu load indicator for each file on -vv mode by @ephiepark (#1631)
+cli: Restrict read permissions on destination files by @chungy (#1644)
+cli: zstdgrep: handle -f flag by @felixhandte (#1618)
+cli: zstdcat: follow symlinks by @vejnar (#1604)
+doc: Remove extra size limit on compressed blocks by @felixhandte (#1689)
+doc: Fix typo by @yk-tanigawa (#1633)
+doc: Improve documentation on streaming buffer sizes by @cyan4973 (#1629)
+build: CMake: support building with LZ4 @leeyoung624 (#1626)
+build: CMake: install zstdless and zstdgrep by @leeyoung624 (#1647)
+build: CMake: respect existing uninstall target by @j301scott (#1619)
+build: Make: skip multithread tests when built without support by @michaelforney (#1620)
+build: Make: Fix examples/ test target by @sjnam (#1603)
+build: Meson: rename options out of deprecated namespace by @lzutao (#1665)
+build: Meson: fix build by @lzutao (#1602)
+build: Visual Studio: don't export symbols in static lib by @scharan (#1650)
+build: Visual Studio: fix linking by @absotively (#1639)
+build: Fix MinGW-W64 build by @myzhang1029 (#1600)
+misc: Expand decodecorpus coverage by @ephiepark (#1664)
+
+v1.4.0
+perf: Improve level 1 compression speed in most scenarios by 6% by @gbtucker and @terrelln
+api: Move the advanced API, including all functions in the staging section, to the stable section
+api: Make ZSTD_e_flush and ZSTD_e_end block for maximum forward progress
+api: Rename ZSTD_CCtxParam_getParameter to ZSTD_CCtxParams_getParameter
+api: Rename ZSTD_CCtxParam_setParameter to ZSTD_CCtxParams_setParameter
+api: Don't export ZSTDMT functions from the shared library by default
+api: Require ZSTD_MULTITHREAD to be defined to use ZSTDMT
+api: Add ZSTD_decompressBound() to provide an upper bound on decompressed size by @shakeelrao
+api: Fix ZSTD_decompressDCtx() corner cases with a dictionary
+api: Move ZSTD_getDictID_*() functions to the stable section
+api: Add ZSTD_c_literalCompressionMode flag to enable or disable literal compression by @terrelln
+api: Allow compression parameters to be set when a dictionary is used
+api: Allow setting parameters before or after ZSTD_CCtx_loadDictionary() is called
+api: Fix ZSTD_estimateCStreamSize_usingCCtxParams()
+api: Setting ZSTD_d_maxWindowLog to 0 means use the default
+cli: Ensure that a dictionary is not used to compress itself by @shakeelrao
+cli: Add --[no-]compress-literals flag to enable or disable literal compression
+doc: Update the examples to use the advanced API
+doc: Explain how to transition from old streaming functions to the advanced API in the header
+build: Improve the Windows release packages
+build: Improve CMake build by @hjmjohnson
+build: Build fixes for FreeBSD by @lwhsu
+build: Remove redundant warnings by @thatsafunnyname
+build: Fix tests on OpenBSD by @bket
+build: Extend fuzzer build system to work with the new clang engine
+build: CMake now creates the libzstd.so.1 symlink
+build: Improve Menson build by @lzutao
+misc: Fix symbolic link detection on FreeBSD
+misc: Use physical core count for -T0 on FreeBSD by @cemeyer
+misc: Fix zstd --list on truncated files by @kostmo
+misc: Improve logging in debug mode by @felixhandte
+misc: Add CirrusCI tests by @lwhsu
+misc: Optimize dictionary memory usage in corner cases
+misc: Improve the dictionary builder on small or homogeneous data
+misc: Fix spelling across the repo by @jsoref
+
+v1.3.8
+perf: better decompression speed on large files (+7%) and cold dictionaries (+15%)
+perf: slightly better compression ratio at high compression modes
+api : finalized advanced API, last stage before "stable" status
+api : new --rsyncable mode, by @terrelln
+api : support decompression of empty frames into NULL (used to be an error) (#1385)
+build: new set of macros to build a minimal size decoder, by @felixhandte
+build: fix compilation on MIPS32, reported by @clbr (#1441)
+build: fix compilation with multiple -arch flags, by @ryandesign
+build: highly upgraded meson build, by @lzutao
+build: improved buck support, by @obelisk
+build: fix cmake script : can create debug build, by @pitrou
+build: Makefile : grep works on both colored consoles and systems without color support
+build: fixed zstd-pgo, by @bmwiedemann
+cli : support ZSTD_CLEVEL environment variable, by @yijinfb (#1423)
+cli : --no-progress flag, preserving final summary (#1371), by @terrelln
+cli : ensure destination file is not source file (#1422)
+cli : clearer error messages, especially when input file not present
+doc : clarified zstd_compression_format.md, by @ulikunitz
+misc: fixed zstdgrep, returns 1 on failure, by @lzutao
+misc: NEWS renamed as CHANGELOG, in accordance with fboss
+
+v1.3.7
+perf: slightly better decompression speed on clang (depending on hardware target)
+fix : performance of dictionary compression for small input < 4 KB at levels 9 and 10
+build: no longer build backtrace by default in release mode; restrict further automatic mode
+build: control backtrace support through build macro BACKTRACE
+misc: added man pages for zstdless and zstdgrep, by @samrussell
+
+v1.3.6
+perf: much faster dictionary builder, by @jenniferliu
+perf: faster dictionary compression on small data when using multiple contexts, by @felixhandte
+perf: faster dictionary decompression when using a very large number of dictionaries simultaneously
+cli : fix : does no longer overwrite destination when source does not exist (#1082)
+cli : new command --adapt, for automatic compression level adaptation
+api : fix : block api can be streamed with > 4 GB, reported by @catid
+api : reduced ZSTD_DDict size by 2 KB
+api : minimum negative compression level is defined, and can be queried using ZSTD_minCLevel().
+build: support Haiku target, by @korli
+build: Read Legacy format is limited to v0.5+ by default. Can be changed at compile time with macro ZSTD_LEGACY_SUPPORT.
+doc : zstd_compression_format.md updated to match wording in IETF RFC 8478
+misc: tests/paramgrill, a parameter optimizer, by @GeorgeLu97
+
+v1.3.5
+perf: much faster dictionary compression, by @felixhandte
+perf: small quality improvement for dictionary generation, by @terrelln
+perf: slightly improved high compression levels (notably level 19)
+mem : automatic memory release for long duration contexts
+cli : fix : overlapLog can be manually set
+cli : fix : decoding invalid lz4 frames
+api : fix : performance degradation for dictionary compression when using advanced API, by @terrelln
+api : change : clarify ZSTD_CCtx_reset() vs ZSTD_CCtx_resetParameters(), by @terrelln
+build: select custom libzstd scope through control macros, by @GeorgeLu97
+build: OpenBSD patch, by @bket
+build: make and make all are compatible with -j
+doc : clarify zstd_compression_format.md, updated for IETF RFC process
+misc: pzstd compatible with reproducible compilation, by @lamby
+
+v1.3.4
+perf: faster speed (especially decoding speed) on recent cpus (haswell+)
+perf: much better performance associating --long with multi-threading, by @terrelln
+perf: better compression at levels 13-15
+cli : asynchronous compression by default, for faster experience (use --single-thread for former behavior)
+cli : smoother status report in multi-threading mode
+cli : added command --fast=#, for faster compression modes
+cli : fix crash when not overwriting existing files, by Pádraig Brady (@pixelb)
+api : `nbThreads` becomes `nbWorkers` : 1 triggers asynchronous mode
+api : compression levels can be negative, for even more speed
+api : ZSTD_getFrameProgression() : get precise progress status of ZSTDMT anytime
+api : ZSTDMT can accept new compression parameters during compression
+api : implemented all advanced dictionary decompression prototypes
+build: improved meson recipe, by Shawn Landden (@shawnl)
+build: VS2017 scripts, by @HaydnTrigg
+misc: all /contrib projects fixed
+misc: added /contrib/docker script by @gyscos
+
+v1.3.3
+perf: faster zstd_opt strategy (levels 16-19)
+fix : bug #944 : multithreading with shared ditionary and large data, reported by @gsliepen
+cli : fix : content size written in header by default
+cli : fix : improved LZ4 format support, by @felixhandte
+cli : new : hidden command `-S`, to benchmark multiple files while generating one result per file
+api : fix : support large skippable frames, by @terrelln
+api : fix : streaming interface was adding a useless 3-bytes null block to small frames
+api : change : when setting `pledgedSrcSize`, use `ZSTD_CONTENTSIZE_UNKNOWN` macro value to mean "unknown"
+build: fix : compilation under rhel6 and centos6, reported by @pixelb
+build: added `check` target
+
+v1.3.2
+new : long range mode, using --long command, by Stella Lau (@stellamplau)
+new : ability to generate and decode magicless frames (#591)
+changed : maximum nb of threads reduced to 200, to avoid address space exhaustion in 32-bits mode
+fix : multi-threading compression works with custom allocators
+fix : ZSTD_sizeof_CStream() was over-evaluating memory usage
+fix : a rare compression bug when compression generates very large distances and bunch of other conditions (only possible at --ultra -22)
+fix : 32-bits build can now decode large offsets (levels 21+)
+cli : added LZ4 frame support by default, by Felix Handte (@felixhandte)
+cli : improved --list output
+cli : new : can split input file for dictionary training, using command -B#
+cli : new : clean operation artefact on Ctrl-C interruption
+cli : fix : do not change /dev/null permissions when using command -t with root access, reported by @mike155 (#851)
+cli : fix : write file size in header in multiple-files mode
+api : added macro ZSTD_COMPRESSBOUND() for static allocation
+api : experimental : new advanced decompression API
+api : fix : sizeof_CCtx() used to over-estimate
+build: fix : no-multithread variant compiles without pool.c dependency, reported by Mitchell Blank Jr (@mitchblank) (#819)
+build: better compatibility with reproducible builds, by Bernhard M. Wiedemann (@bmwiedemann) (#818)
+example : added streaming_memory_usage
+license : changed /examples license to BSD + GPLv2
+license : fix a few header files to reflect new license (#825)
+
+v1.3.1
+New license : BSD + GPLv2
+perf: substantially decreased memory usage in Multi-threading mode, thanks to reports by Tino Reichardt (@mcmilk)
+perf: Multi-threading supports up to 256 threads. Cap at 256 when more are requested (#760)
+cli : improved and fixed --list command, by @ib (#772)
+cli : command -vV to list supported formats, by @ib (#771)
+build : fixed binary variants, reported by @svenha (#788)
+build : fix Visual compilation for non x86/x64 targets, reported by Greg Slazinski (@GregSlazinski) (#718)
+API exp : breaking change : ZSTD_getframeHeader() provides more information
+API exp : breaking change : pinned down values of error codes
+doc : fixed huffman example, by Ulrich Kunitz (@ulikunitz)
+new : contrib/adaptive-compression, I/O driven compression strength, by Paul Cruz (@paulcruz74)
+new : contrib/long_distance_matching, statistics by Stella Lau (@stellamplau)
+updated : contrib/linux-kernel, by Nick Terrell (@terrelln)
+
+v1.3.0
+cli : new : `--list` command, by Paul Cruz
+cli : changed : xz/lzma support enabled by default
+cli : changed : `-t *` continue processing list after a decompression error
+API : added : ZSTD_versionString()
+API : promoted to stable status : ZSTD_getFrameContentSize(), by Sean Purcell
+API exp : new advanced API : ZSTD_compress_generic(), ZSTD_CCtx_setParameter()
+API exp : new : API for static or external allocation : ZSTD_initStatic?Ctx()
+API exp : added : ZSTD_decompressBegin_usingDDict(), requested by Guy Riddle (#700)
+API exp : clarified memory estimation / measurement functions.
+API exp : changed : strongest strategy renamed ZSTD_btultra, fastest strategy ZSTD_fast set to 1
+tools : decodecorpus can generate random dictionary-compressed samples, by Paul Cruz
+new : contrib/seekable_format, demo and API, by Sean Purcell
+changed : contrib/linux-kernel, updated version and license, by Nick Terrell
+
+v1.2.0
+cli : changed : Multithreading enabled by default (use target zstd-nomt or HAVE_THREAD=0 to disable)
+cli : new : command -T0 means "detect and use nb of cores", by Sean Purcell
+cli : new : zstdmt symlink hardwired to `zstd -T0`
+cli : new : command --threads=# (#671)
+cli : changed : cover dictionary builder by default, for improved quality, by Nick Terrell
+cli : new : commands --train-cover and --train-legacy, to select dictionary algorithm and parameters
+cli : experimental targets `zstd4` and `xzstd4`, with support for lz4 format, by Sean Purcell
+cli : fix : does not output compressed data on console
+cli : fix : ignore symbolic links unless --force specified,
+API : breaking change : ZSTD_createCDict_advanced(), only use compressionParameters as argument
+API : added : prototypes ZSTD_*_usingCDict_advanced(), for direct control over frameParameters.
+API : improved: ZSTDMT_compressCCtx() reduced memory usage
+API : fix : ZSTDMT_compressCCtx() now provides srcSize in header (#634)
+API : fix : src size stored in frame header is controlled at end of frame
+API : fix : enforced consistent rules for pledgedSrcSize==0 (#641)
+API : fix : error code "GENERIC" replaced by "dstSizeTooSmall" when appropriate
+build: improved cmake script, by @Majlen
+build: enabled Multi-threading support for *BSD, by Baptiste Daroussin
+tools: updated Paramgrill. Command -O# provides best parameters for sample and speed target.
+new : contrib/linux-kernel version, by Nick Terrell
+
+v1.1.4
+cli : new : can compress in *.gz format, using --format=gzip command, by Przemyslaw Skibinski
+cli : new : advanced benchmark command --priority=rt
+cli : fix : write on sparse-enabled file systems in 32-bits mode, by @ds77
+cli : fix : --rm remains silent when input is stdin
+cli : experimental : xzstd, with support for xz/lzma decoding, by Przemyslaw Skibinski
+speed : improved decompression speed in streaming mode for single shot scenarios (+5%)
+memory: DDict (decompression dictionary) memory usage down from 150 KB to 20 KB
+arch: 32-bits variant able to generate and decode very long matches (>32 MB), by Sean Purcell
+API : new : ZSTD_findFrameCompressedSize(), ZSTD_getFrameContentSize(), ZSTD_findDecompressedSize()
+API : changed : dropped support of legacy versions <= v0.3 (can be changed by modifying ZSTD_LEGACY_SUPPORT value)
+build : new: meson build system in contrib/meson, by Dima Krasner
+build : improved cmake script, by @Majlen
+build : added -Wformat-security flag, as recommended by Padraig Brady
+doc : new : educational decoder, by Sean Purcell
+
+v1.1.3
+cli : zstd can decompress .gz files (can be disabled with `make zstd-nogz` or `make HAVE_ZLIB=0`)
+cli : new : experimental target `make zstdmt`, with multi-threading support
+cli : new : improved dictionary builder "cover" (experimental), by Nick Terrell, based on prior work by Giuseppe Ottaviano.
+cli : new : advanced commands for detailed parameters, by Przemyslaw Skibinski
+cli : fix zstdless on Mac OS-X, by Andrew Janke
+cli : fix #232 "compress non-files"
+dictBuilder : improved dictionary generation quality, thanks to Nick Terrell
+API : new : lib/compress/ZSTDMT_compress.h multithreading API (experimental)
+API : new : ZSTD_create?Dict_byReference(), requested by Bartosz Taudul
+API : new : ZDICT_finalizeDictionary()
+API : fix : ZSTD_initCStream_usingCDict() properly writes dictID into frame header, by Gregory Szorc (#511)
+API : fix : all symbols properly exposed in libzstd, by Nick Terrell
+build : support for Solaris target, by Przemyslaw Skibinski
+doc : clarified specification, by Sean Purcell
+
+v1.1.2
+API : streaming : decompression : changed : automatic implicit reset when chain-decoding new frames without init
+API : experimental : added : dictID retrieval functions, and ZSTD_initCStream_srcSize()
+API : zbuff : changed : prototypes now generate deprecation warnings
+lib : improved : faster decompression speed at ultra compression settings and 32-bits mode
+lib : changed : only public ZSTD_ symbols are now exposed
+lib : changed : reduced usage  of stack memory
+lib : fixed : several corner case bugs, by Nick Terrell
+cli : new : gzstd, experimental version able to decode .gz files, by Przemyslaw Skibinski
+cli : new : preserve file attributes
+cli : new : added zstdless and zstdgrep tools
+cli : fixed : status displays total amount decoded, even for file consisting of multiple frames (like pzstd)
+cli : fixed : zstdcat
+zlib_wrapper : added support for gz* functions, by Przemyslaw Skibinski
+install : better compatibility with FreeBSD, by Dimitry Andric
+source tree : changed : zbuff source files moved to lib/deprecated
+
+v1.1.1
+New : command -M#, --memory=, --memlimit=, --memlimit-decompress= to limit allowed memory consumption
+New : doc/zstd_manual.html, by Przemyslaw Skibinski
+Improved : slightly better compression ratio at --ultra levels (>= 20)
+Improved : better memory usage when using streaming compression API, thanks to @Rogier-5 report
+Added : API : ZSTD_initCStream_usingCDict(), ZSTD_initDStream_usingDDict() (experimental section)
+Added : example/multiple_streaming_compression.c
+Changed : zstd_errors.h is now installed within /include (and replaces errors_public.h)
+Updated man page
+Fixed : zstd-small, zstd-compress and zstd-decompress compilation targets
+
+v1.1.0
+New : contrib/pzstd, parallel version of zstd, by Nick Terrell
+added : NetBSD install target (#338)
+Improved : speed for batches of small files
+Improved : speed of zlib wrapper, by Przemyslaw Skibinski
+Changed : libzstd on Windows supports legacy formats, by Christophe Chevalier
+Fixed : CLI -d output to stdout by default when input is stdin (#322)
+Fixed : CLI correctly detects console on Mac OS-X
+Fixed : CLI supports recursive mode `-r` on Mac OS-X
+Fixed : Legacy decoders use unified error codes, reported by benrg (#341), fixed by Przemyslaw Skibinski
+Fixed : compatibility with OpenBSD, reported by Juan Francisco Cantero Hurtado (#319)
+Fixed : compatibility with Hurd, by Przemyslaw Skibinski (#365)
+Fixed : zstd-pgo, reported by octoploid (#329)
+
+v1.0.0
+Change Licensing, all project is now BSD, Copyright Facebook
+Small decompression speed improvement
+API : Streaming API supports legacy format
+API : ZDICT_getDictID(), ZSTD_sizeof_{CCtx, DCtx, CStream, DStream}(), ZSTD_setDStreamParameter()
+CLI supports legacy formats v0.4+
+Fixed : compression fails on certain huge files, reported by Jesse McGrew
+Enhanced documentation, by Przemyslaw Skibinski
+
+v0.8.1
+New streaming API
+Changed : --ultra now enables levels beyond 19
+Changed : -i# now selects benchmark time in second
+Fixed : ZSTD_compress* can now compress > 4 GB in a single pass, reported by Nick Terrell
+Fixed : speed regression on specific patterns (#272)
+Fixed : support for Z_SYNC_FLUSH, by Dmitry Krot (#291)
+Fixed : ICC compilation, by Przemyslaw Skibinski
+
+v0.8.0
+Improved : better speed on clang and gcc -O2, thanks to Eric Biggers
+New : Build on FreeBSD and DragonFly, thanks to JrMarino
+Changed : modified API : ZSTD_compressEnd()
+Fixed : legacy mode with ZSTD_HEAPMODE=0, by Christopher Bergqvist
+Fixed : premature end of frame when zero-sized raw block, reported by Eric Biggers
+Fixed : large dictionaries (> 384 KB), reported by Ilona Papava
+Fixed : checksum correctly checked in single-pass mode
+Fixed : combined --test amd --rm, reported by Andreas M. Nilsson
+Modified : minor compression level adaptations
+Updated : compression format specification to v0.2.0
+changed : zstd.h moved to /lib directory
+
+v0.7.5
+Transition version, supporting decoding of v0.8.x
+
+v0.7.4
+Added : homebrew for Mac, by Daniel Cade
+Added : more examples
+Fixed : segfault when using small dictionaries, reported by Felix Handte
+Modified : default compression level for CLI is now 3
+Updated : specification, to v0.1.1
+
+v0.7.3
+New : compression format specification
+New : `--` separator, stating that all following arguments are file names. Suggested by Chip Turner.
+New : `ZSTD_getDecompressedSize()`
+New : OpenBSD target, by Juan Francisco Cantero Hurtado
+New : `examples` directory
+fixed : dictBuilder using HC levels, reported by Bartosz Taudul
+fixed : legacy support from ZSTD_decompress_usingDDict(), reported by Felix Handte
+fixed : multi-blocks decoding with intermediate uncompressed blocks, reported by Greg Slazinski
+modified : removed "mem.h" and "error_public.h" dependencies from "zstd.h" (experimental section)
+modified : legacy functions no longer need magic number
+
+v0.7.2
+fixed : ZSTD_decompressBlock() using multiple consecutive blocks. Reported by Greg Slazinski.
+fixed : potential segfault on very large files (many gigabytes). Reported by Chip Turner.
+fixed : CLI displays system error message when destination file cannot be created (#231). Reported by Chip Turner.
+
+v0.7.1
+fixed : ZBUFF_compressEnd() called multiple times with too small `dst` buffer, reported by Christophe Chevalier
+fixed : dictBuilder fails if first sample is too small, reported by Руслан Ковалёв
+fixed : corruption issue, reported by cj
+modified : checksum enabled by default in command line mode
+
+v0.7.0
+New : Support for directory compression, using `-r`, thanks to Przemyslaw Skibinski
+New : Command `--rm`, to remove source file after successful de/compression
+New : Visual build scripts, by Christophe Chevalier
+New : Support for Sparse File-systems (do not use space for zero-filled sectors)
+New : Frame checksum support
+New : Support pass-through mode (when using `-df`)
+API : more efficient Dictionary API : `ZSTD_compress_usingCDict()`, `ZSTD_decompress_usingDDict()`
+API : create dictionary files from custom content, by Giuseppe Ottaviano
+API : support for custom malloc/free functions
+New : controllable Dictionary ID
+New : Support for skippable frames
+
+v0.6.1
+New : zlib wrapper API, thanks to Przemyslaw Skibinski
+New : Ability to compile compressor / decompressor separately
+Changed : new lib directory structure
+Fixed : Legacy codec v0.5 compatible with dictionary decompression
+Fixed : Decoder corruption error (#173)
+Fixed : null-string roundtrip (#176)
+New : benchmark mode can select directory as input
+Experimental : midipix support, VMS support
+
+v0.6.0
+Stronger high compression modes, thanks to Przemyslaw Skibinski
+API : ZSTD_getFrameParams() provides size of decompressed content
+New : highest compression modes require `--ultra` command to fully unleash their capacity
+Fixed : zstd cli return error code > 0 and removes dst file artifact when decompression fails, thanks to Chip Turner
+
+v0.5.1
+New : Optimal parsing => Very high compression modes, thanks to Przemyslaw Skibinski
+Changed : Dictionary builder integrated into libzstd and zstd cli
+Changed (!) : zstd cli now uses "multiple input files" as default mode. See `zstd -h`.
+Fix : high compression modes for big-endian platforms
+New : zstd cli : `-t` | `--test` command
+
+v0.5.0
+New : dictionary builder utility
+Changed : streaming & dictionary API
+Improved : better compression of small data
+
+v0.4.7
+Improved : small compression speed improvement in HC mode
+Changed : `zstd_decompress.c` has ZSTD_LEGACY_SUPPORT to 0 by default
+fix : bt search bug
+
+v0.4.6
+fix : fast compression mode on Windows
+New : cmake configuration file, thanks to Artyom Dymchenko
+Improved : high compression mode on repetitive data
+New : block-level API
+New : ZSTD_duplicateCCtx()
+
+v0.4.5
+new : -m/--multiple : compress/decompress multiple files
+
+v0.4.4
+Fixed : high compression modes for Windows 32 bits
+new : external dictionary API extended to buffered mode and accessible through command line
+new : windows DLL project, thanks to Christophe Chevalier
+
+v0.4.3 :
+new : external dictionary API
+new : zstd-frugal
+
+v0.4.2 :
+Generic minor improvements for small blocks
+Fixed : big-endian compatibility, by Peter Harris (#85)
+
+v0.4.1
+Fixed : ZSTD_LEGACY_SUPPORT=0 build mode (reported by Luben)
+removed `zstd.c`
+
+v0.4.0
+Command line utility compatible with high compression levels
+Removed zstdhc => merged into zstd
+Added : ZBUFF API (see zstd_buffered.h)
+Rolling buffer support
+
+v0.3.6
+small blocks params
+
+v0.3.5
+minor generic compression improvements
+
+v0.3.4
+Faster fast cLevels
+
+v0.3.3
+Small compression ratio improvement
+
+v0.3.2
+Fixed Visual Studio
+
+v0.3.1 :
+Small compression ratio improvement
+
+v0.3
+HC mode : compression levels 2-26
+
+v0.2.2
+Fix : Visual Studio 2013 & 2015 release compilation, by Christophe Chevalier
+
+v0.2.1
+Fix : Read errors, advanced fuzzer tests, by Hanno Böck
+
+v0.2.0
+**Breaking format change**
+Faster decompression speed
+Can still decode v0.1 format
+
+v0.1.3
+fix uninitialization warning, reported by Evan Nemerson
+
+v0.1.2
+frame concatenation support
+
+v0.1.1
+fix compression bug
+detects write-flush errors
+
+v0.1.0
+first release

Copied: vendor/zstd/1.4.4/Makefile (from r354371, vendor/zstd/dist/Makefile)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/zstd/1.4.4/Makefile	Wed Nov  6 06:43:13 2019	(r354372, copy of r354371, vendor/zstd/dist/Makefile)
@@ -0,0 +1,392 @@
+# ################################################################
+# Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
+# All rights reserved.
+#
+# This source code is licensed under both the BSD-style license (found in the
+# LICENSE file in the root directory of this source tree) and the GPLv2 (found
+# in the COPYING file in the root directory of this source tree).
+# ################################################################
+
+PRGDIR   = programs
+ZSTDDIR  = lib
+BUILDIR  = build
+ZWRAPDIR = zlibWrapper
+TESTDIR  = tests
+FUZZDIR  = $(TESTDIR)/fuzz
+
+# Define nul output
+VOID = /dev/null
+
+ifneq (,$(filter Windows%,$(OS)))
+EXT =.exe
+else
+EXT =
+endif
+
+## default: Build lib-release and zstd-release
+.PHONY: default
+default: lib-release zstd-release
+
+.PHONY: all
+all: allmost examples manual contrib
+
+.PHONY: allmost
+allmost: allzstd zlibwrapper
+
+# skip zwrapper, can't build that on alternate architectures without the proper zlib installed
+.PHONY: allzstd
+allzstd: lib
+	$(MAKE) -C $(PRGDIR) all
+	$(MAKE) -C $(TESTDIR) all
+
+.PHONY: all32
+all32:
+	$(MAKE) -C $(PRGDIR) zstd32
+	$(MAKE) -C $(TESTDIR) all32
+
+.PHONY: lib lib-release libzstd.a
+lib lib-release :
+	@$(MAKE) -C $(ZSTDDIR) $@
+
+.PHONY: zstd zstd-release
+zstd zstd-release:
+	@$(MAKE) -C $(PRGDIR) $@
+	cp $(PRGDIR)/zstd$(EXT) .
+
+.PHONY: zstdmt
+zstdmt:
+	@$(MAKE) -C $(PRGDIR) $@
+	cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
+
+.PHONY: zlibwrapper
+zlibwrapper: lib
+	$(MAKE) -C $(ZWRAPDIR) all
+
+## test: run long-duration tests
+.PHONY: test
+DEBUGLEVEL ?= 1
+test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werror
+test:
+	MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
+	$(MAKE) -C $(TESTDIR) $@
+	ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test
+
+## shortest: same as `make check`
+.PHONY: shortest
+shortest:
+	$(MAKE) -C $(TESTDIR) $@
+
+## check: run basic tests for `zstd` cli
+.PHONY: check
+check: shortest
+
+## examples: build all examples in `/examples` directory
+.PHONY: examples
+examples: lib
+	CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all
+
+## manual: generate API documentation in html format
+.PHONY: manual
+manual:
+	$(MAKE) -C contrib/gen_html $@
+
+## man: generate man page
+.PHONY: man
+man:
+	$(MAKE) -C programs $@
+
+## contrib: build all supported projects in `/contrib` directory
+.PHONY: contrib
+contrib: lib
+	$(MAKE) -C contrib/pzstd all
+	$(MAKE) -C contrib/seekable_format/examples all
+	$(MAKE) -C contrib/largeNbDicts all
+	cd contrib/single_file_decoder/ ; ./build_test.sh
+
+.PHONY: cleanTabs
+cleanTabs:
+	cd contrib; ./cleanTabs
+
+.PHONY: clean
+clean:
+	@$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
+	@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
+	@$(MAKE) -C $(TESTDIR) $@ > $(VOID)
+	@$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
+	@$(MAKE) -C examples/ $@ > $(VOID)
+	@$(MAKE) -C contrib/gen_html $@ > $(VOID)
+	@$(MAKE) -C contrib/pzstd $@ > $(VOID)
+	@$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
+	@$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
+	@$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
+	@$(RM) -r lz4
+	@echo Cleaning completed
+
+#------------------------------------------------------------------------------
+# make install is validated only for Linux, macOS, Hurd and some BSD targets
+#------------------------------------------------------------------------------
+ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
+
+HOST_OS = POSIX
+CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
+
+HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
+EGREP_OPTIONS ?=
+ifeq ($HAVE_COLORNEVER, 1)
+EGREP_OPTIONS += --color=never
+endif
+EGREP = egrep $(EGREP_OPTIONS)
+
+# Print a two column output of targets and their description. To add a target description, put a
+# comment in the Makefile with the format "## : ".  For example:
+#
+## list: Print all targets and their descriptions (if provided)
+.PHONY: list
+list:
+	@TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
+		| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
+		| $(EGREP) -v  -e '^[^[:alnum:]]' | sort); \
+	{ \
+	    printf "Target Name\tDescription\n"; \
+	    printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
+	    for target in $$TARGETS; do \
+	        line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
+	        description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
+	        printf "$$target\t$$description\n"; \
+	    done \
+	} | column -t -s $$'\t'
+
+.PHONY: install armtest usan asan uasan
+install:
+	@$(MAKE) -C $(ZSTDDIR) $@
+	@$(MAKE) -C $(PRGDIR) $@
+
+.PHONY: uninstall
+uninstall:
+	@$(MAKE) -C $(ZSTDDIR) $@
+	@$(MAKE) -C $(PRGDIR) $@
+
+.PHONY: travis-install
+travis-install:
+	$(MAKE) install PREFIX=~/install_test_dir
+
+.PHONY: gcc5build
+gcc5build: clean
+	gcc-5 -v
+	CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
+
+.PHONY: gcc6build
+gcc6build: clean
+	gcc-6 -v
+	CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
+
+.PHONY: gcc7build
+gcc7build: clean
+	gcc-7 -v
+	CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
+
+.PHONY: clangbuild
+clangbuild: clean
+	clang -v
+	CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
+
+m32build: clean
+	gcc -v
+	$(MAKE) all32
+
+armbuild: clean
+	CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
+
+aarch64build: clean
+	CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
+
+ppcbuild: clean
+	CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd
+
+ppc64build: clean
+	CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
+
+armfuzz: clean
+	CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
+
+aarch64fuzz: clean
+	ld -v
+	CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
+
+ppcfuzz: clean
+	CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
+
+ppc64fuzz: clean
+	CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
+
+.PHONY: cxxtest
+cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
+cxxtest: clean
+	$(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)"   # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
+
+gcc5test: clean
+	gcc-5 -v
+	$(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
+
+gcc6test: clean
+	gcc-6 -v
+	$(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
+
+armtest: clean
+	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
+	$(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
+
+aarch64test:
+	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
+	$(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
+
+ppctest: clean
+	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
+	$(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests
+
+ppc64test: clean
+	$(MAKE) -C $(TESTDIR) datagen   # use native, faster
+	$(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests
+
+arm-ppc-compilation:
+	$(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
+	$(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
+	$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
+	$(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static"
+
+regressiontest:
+	$(MAKE) -C $(FUZZDIR) regressiontest
+
+uasanregressiontest:
+	$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=address,undefined" CXXFLAGS="-O3 -fsanitize=address,undefined"
+
+msanregressiontest:
+	$(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
+
+# run UBsan with -fsanitize-recover=signed-integer-overflow
+# due to a bug in UBsan when doing pointer subtraction
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
+
+usan: clean
+	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror"
+
+asan: clean
+	$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
+
+asan-%: clean
+	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $*
+
+msan: clean
+	$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer -Werror" HAVE_LZMA=0   # datagen.c fails this test for no obvious reason
+
+msan-%: clean
+	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer -Werror" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $*
+
+asan32: clean
+	$(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
+
+uasan: clean
+	$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror"
+
+uasan-%: clean
+	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
+
+tsan-%: clean
+	LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
+
+apt-install:
+	sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
+
+apt-add-repo:
+	sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+	sudo apt-get update -y -qq
+
+ppcinstall:
+	APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
+
+arminstall:
+	APT_PACKAGES="qemu-system-arm qemu-user-static gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross" $(MAKE) apt-install
+
+valgrindinstall:
+	APT_PACKAGES="valgrind" $(MAKE) apt-install
+
+libc6install:
+	APT_PACKAGES="libc6-dev-i386 gcc-multilib" $(MAKE) apt-install
+
+gcc6install: apt-add-repo
+	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install
+
+gcc7install: apt-add-repo
+	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install
+
+gcc8install: apt-add-repo
+	APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-8 gcc-8-multilib" $(MAKE) apt-install
+
+gpp6install: apt-add-repo
+	APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
+
+clang38install:
+	APT_PACKAGES="clang-3.8" $(MAKE) apt-install
+
+# Ubuntu 14.04 ships a too-old lz4
+lz4install:
+	[ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
+
+endif
+
+
+ifneq (,$(filter MSYS%,$(shell uname)))
+HOST_OS = MSYS
+CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
+endif
+
+
+#------------------------------------------------------------------------
+# target specific tests
+#------------------------------------------------------------------------
+ifneq (,$(filter $(HOST_OS),MSYS POSIX))
+cmakebuild:
+	cmake --version
+	$(RM) -r $(BUILDIR)/cmake/build
+	mkdir $(BUILDIR)/cmake/build
+	cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall
+
+c90build: clean
+	$(CC) -v
+	CFLAGS="-std=c90 -Werror" $(MAKE) allmost  # will fail, due to missing support for `long long`
+
+gnu90build: clean
+	$(CC) -v
+	CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
+
+c99build: clean
+	$(CC) -v
+	CFLAGS="-std=c99 -Werror" $(MAKE) allmost
+
+gnu99build: clean
+	$(CC) -v
+	CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
+
+c11build: clean
+	$(CC) -v
+	CFLAGS="-std=c11 -Werror" $(MAKE) allmost
+
+bmix64build: clean
+	$(CC) -v
+	CFLAGS="-O3 -mbmi -Werror" $(MAKE) -C $(TESTDIR) test
+
+bmix32build: clean
+	$(CC) -v
+	CFLAGS="-O3 -mbmi -mx32 -Werror" $(MAKE) -C $(TESTDIR) test
+
+bmi32build: clean
+	$(CC) -v
+	CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
+
+# static analyzer test uses clang's scan-build
+# does not analyze zlibWrapper, due to detected issues in zlib source code
+staticAnalyze: SCANBUILD ?= scan-build
+staticAnalyze:
+	$(CC) -v
+	CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
+endif

Copied: vendor/zstd/1.4.4/README.md (from r354371, vendor/zstd/dist/README.md)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/zstd/1.4.4/README.md	Wed Nov  6 06:43:13 2019	(r354372, copy of r354371, vendor/zstd/dist/README.md)
@@ -0,0 +1,173 @@
+

Zstandard

+ +__Zstandard__, or `zstd` as short version, is a fast lossless compression algorithm, +targeting real-time compression scenarios at zlib-level and better compression ratios. +It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy). + +The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, +and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files. +Should your project require another programming language, +a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages). + +**Development branch status:** + +[![Build Status][travisDevBadge]][travisLink] +[![Build status][AppveyorDevBadge]][AppveyorLink] +[![Build status][CircleDevBadge]][CircleLink] +[![Build status][CirrusDevBadge]][CirrusLink] +[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink] + +[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" +[travisLink]: https://travis-ci.org/facebook/zstd +[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite" +[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0 +[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite" +[CircleLink]: https://circleci.com/gh/facebook/zstd +[CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev +[CirrusLink]: https://cirrus-ci.com/github/facebook/zstd +[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg +[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd + +## Benchmarks + +For reference, several fast compression algorithms were tested and compared +on a server running Arch Linux (`Linux version 5.0.5-arch1-1`), +with a Core i9-9900K CPU @ 5.0GHz, +using [lzbench], an open-source in-memory benchmark by @inikep +compiled with [gcc] 8.2.1, +on the [Silesia compression corpus]. + +[lzbench]: https://github.com/inikep/lzbench +[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia +[gcc]: https://gcc.gnu.org/ + +| Compressor name | Ratio | Compression| Decompress.| +| --------------- | ------| -----------| ---------- | +| **zstd 1.4.0 -1** | 2.884 | 530 MB/s | 1360 MB/s | +| zlib 1.2.11 -1 | 2.743 | 110 MB/s | 440 MB/s | +| brotli 1.0.7 -0 | 2.701 | 430 MB/s | 470 MB/s | +| quicklz 1.5.0 -1 | 2.238 | 600 MB/s | 800 MB/s | +| lzo1x 2.09 -1 | 2.106 | 680 MB/s | 950 MB/s | +| lz4 1.8.3 | 2.101 | 800 MB/s | 4220 MB/s | +| snappy 1.1.4 | 2.073 | 580 MB/s | 2020 MB/s | +| lzf 3.6 -1 | 2.077 | 440 MB/s | 930 MB/s | + +[zlib]: http://www.zlib.net/ +[LZ4]: http://www.lz4.org/ + +Zstd can also offer stronger compression ratios at the cost of compression speed. +Speed vs Compression trade-off is configurable by small increments. +Decompression speed is preserved and remains roughly the same at all settings, +a property shared by most LZ compression algorithms, such as [zlib] or lzma. + +The following tests were run +on a server running Linux Debian (`Linux version 4.14.0-3-amd64`) +with a Core i7-6700K CPU @ 4.0GHz, +using [lzbench], an open-source in-memory benchmark by @inikep +compiled with [gcc] 7.3.0, +on the [Silesia compression corpus]. + +Compression Speed vs Ratio | Decompression Speed +---------------------------|-------------------- *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 06:50:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A94CA1AB681; Wed, 6 Nov 2019 06:50:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477HGM41pRz4vNj; Wed, 6 Nov 2019 06:50:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E07021289; Wed, 6 Nov 2019 06:50:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA66o3AK070381; Wed, 6 Nov 2019 06:50:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA66o3qo070380; Wed, 6 Nov 2019 06:50:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911060650.xA66o3qo070380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 6 Nov 2019 06:50:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354373 - head/sys/contrib/zstd X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/contrib/zstd X-SVN-Commit-Revision: 354373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 06:50:03 -0000 Author: cem Date: Wed Nov 6 06:50:02 2019 New Revision: 354373 URL: https://svnweb.freebsd.org/changeset/base/354373 Log: zstd: Add an Xlist and document use during import No functional change. Added: head/sys/contrib/zstd/FREEBSD-Xlist head/sys/contrib/zstd/FREEBSD-upgrade Added: head/sys/contrib/zstd/FREEBSD-Xlist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/FREEBSD-Xlist Wed Nov 6 06:50:02 2019 (r354373) @@ -0,0 +1,12 @@ +$FreeBSD$ + +.circleci +.cirrus.yml +.gitignore +.travis.yml +build +contrib/linux-kernel +contrib/single_file_decoder +contrib/VS2005 +lib/dll +programs/windres Added: head/sys/contrib/zstd/FREEBSD-upgrade ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/zstd/FREEBSD-upgrade Wed Nov 6 06:50:02 2019 (r354373) @@ -0,0 +1,14 @@ +$FreeBSD$ + +zstd + +To import new vendor sources, prune unwanted files with: + + tar -X FREEBSD-Xlist -xf zstd-x.y.z.tar.zst + +When importing a new version, be sure to check if there are any new bits that +we don't want. + +Please find instructions for importing new releases and merging to HEAD here: + +https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/subversion-primer.html#idp45937784 From owner-svn-src-all@freebsd.org Wed Nov 6 08:33:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 850B81AE067; Wed, 6 Nov 2019 08:33:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477KZF3kWpz3Gky; Wed, 6 Nov 2019 08:33:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6478B22637; Wed, 6 Nov 2019 08:33:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68XvbW034361; Wed, 6 Nov 2019 08:33:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68Xvpf034359; Wed, 6 Nov 2019 08:33:57 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060833.xA68Xvpf034359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354374 - in stable/12: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:33:57 -0000 Author: avg Date: Wed Nov 6 08:33:56 2019 New Revision: 354374 URL: https://svnweb.freebsd.org/changeset/base/354374 Log: MFC r353616: MFV r353615: 9485 Optimize possible split block search space Modified: stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Nov 6 06:50:02 2019 (r354373) +++ stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Nov 6 08:33:56 2019 (r354374) @@ -198,6 +198,7 @@ extern boolean_t zfs_compressed_arc_enabled; extern boolean_t zfs_abd_scatter_enabled; extern int dmu_object_alloc_chunk_shift; extern boolean_t zfs_force_some_double_word_sm_entries; +extern unsigned long zfs_reconstruct_indirect_damage_fraction; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5696,7 +5697,8 @@ ztest_run_zdb(char *pool) isa = strdup(isa); /* LINTED */ (void) sprintf(bin, - "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s", + "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s " + "-o zfs_reconstruct_indirect_combinations_max=65536 %s", isalen, isa, ztest_opts.zo_verbose >= 3 ? "s" : "", @@ -6652,6 +6654,13 @@ main(int argc, char **argv) * of them so the feature get tested. */ zfs_force_some_double_word_sm_entries = B_TRUE; + + /* + * Verify that even extensively damaged split blocks with many + * segments can be reconstructed in a reasonable amount of time + * when reconstruction is known to be possible. + */ + zfs_reconstruct_indirect_damage_fraction = 4; ztest_fd_rand = open("/dev/urandom", O_RDONLY); ASSERT3S(ztest_fd_rand, >=, 0); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Nov 6 06:50:02 2019 (r354373) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Nov 6 08:33:56 2019 (r354374) @@ -206,19 +206,23 @@ uint64_t zfs_condense_min_mapping_bytes = 128 * 1024; int zfs_condense_indirect_commit_entry_delay_ticks = 0; /* - * If a split block contains more than this many segments, consider it too - * computationally expensive to check all (2^num_segments) possible - * combinations. Instead, try at most 2^_segments_max randomly-selected - * combinations. - * - * This is reasonable if only a few segment copies are damaged and the - * majority of segment copies are good. This allows all the segment copies to - * participate fairly in the reconstruction and prevents the repeated use of - * one bad copy. + * If an indirect split block contains more than this many possible unique + * combinations when being reconstructed, consider it too computationally + * expensive to check them all. Instead, try at most 100 randomly-selected + * combinations each time the block is accessed. This allows all segment + * copies to participate fairly in the reconstruction when all combinations + * cannot be checked and prevents repeated use of one bad copy. */ -int zfs_reconstruct_indirect_segments_max = 10; +int zfs_reconstruct_indirect_combinations_max = 256; + /* + * Enable to simulate damaged segments and validate reconstruction. + * Used by ztest + */ +unsigned long zfs_reconstruct_indirect_damage_fraction = 0; + +/* * The indirect_child_t represents the vdev that we will read from, when we * need to read all copies of the data (e.g. for scrub or reconstruction). * For plain (non-mirror) top-level vdevs (i.e. is_vdev is not a mirror), @@ -228,6 +232,13 @@ int zfs_reconstruct_indirect_segments_max = 10; typedef struct indirect_child { abd_t *ic_data; vdev_t *ic_vdev; + + /* + * ic_duplicate is NULL when the ic_data contents are unique, when it + * is determined to be a duplicate it references the primary child. + */ + struct indirect_child *ic_duplicate; + list_node_t ic_node; /* node on is_unique_child */ } indirect_child_t; /* @@ -249,12 +260,14 @@ typedef struct indirect_split { uint64_t is_target_offset; /* offset on is_vdev */ uint64_t is_size; int is_children; /* number of entries in is_child[] */ + int is_unique_children; /* number of entries in is_unique_child */ + list_t is_unique_child; /* * is_good_child is the child that we are currently using to * attempt reconstruction. */ - int is_good_child; + indirect_child_t *is_good_child; indirect_child_t is_child[1]; /* variable-length */ } indirect_split_t; @@ -266,6 +279,9 @@ typedef struct indirect_split { typedef struct indirect_vsd { boolean_t iv_split_block; boolean_t iv_reconstruct; + uint64_t iv_unique_combinations; + uint64_t iv_attempts; + uint64_t iv_attempts_max; list_t iv_splits; /* list of indirect_split_t's */ } indirect_vsd_t; @@ -283,6 +299,13 @@ vdev_indirect_map_free(zio_t *zio) abd_free(ic->ic_data); } list_remove(&iv->iv_splits, is); + + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + list_destroy(&is->is_unique_child); + kmem_free(is, offsetof(indirect_split_t, is_child[is->is_children])); } @@ -1181,6 +1204,8 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde is->is_split_offset = split_offset; is->is_target_offset = offset; is->is_vdev = vd; + list_create(&is->is_unique_child, sizeof (indirect_child_t), + offsetof(indirect_child_t, ic_node)); /* * Note that we only consider multiple copies of the data for @@ -1191,6 +1216,7 @@ vdev_indirect_gather_splits(uint64_t split_offset, vde if (vd->vdev_ops == &vdev_mirror_ops) { for (int i = 0; i < n; i++) { is->is_child[i].ic_vdev = vd->vdev_child[i]; + list_link_init(&is->is_child[i].ic_node); } } else { is->is_child[0].ic_vdev = vd; @@ -1243,6 +1269,7 @@ vdev_indirect_read_all(zio_t *zio) ic->ic_data = abd_alloc_sametype(zio->io_abd, is->is_size); + ic->ic_duplicate = NULL; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, ic->ic_data, @@ -1364,7 +1391,7 @@ vdev_indirect_checksum_error(zio_t *zio, zio_bad_cksum_t zbc = { 0 }; void *bad_buf = abd_borrow_buf_copy(ic->ic_data, is->is_size); - abd_t *good_abd = is->is_child[is->is_good_child].ic_data; + abd_t *good_abd = is->is_good_child->ic_data; void *good_buf = abd_borrow_buf_copy(good_abd, is->is_size); zfs_ereport_post_checksum(zio->io_spa, vd, zio, is->is_target_offset, is->is_size, good_buf, bad_buf, &zbc); @@ -1397,21 +1424,18 @@ vdev_indirect_repair(zio_t *zio) for (indirect_split_t *is = list_head(&iv->iv_splits); is != NULL; is = list_next(&iv->iv_splits, is)) { - indirect_child_t *good_child = &is->is_child[is->is_good_child]; - for (int c = 0; c < is->is_children; c++) { indirect_child_t *ic = &is->is_child[c]; - if (ic == good_child) + if (ic == is->is_good_child) continue; if (ic->ic_data == NULL) continue; - if (abd_cmp(good_child->ic_data, ic->ic_data, - is->is_size) == 0) + if (ic->ic_duplicate == is->is_good_child) continue; zio_nowait(zio_vdev_child_io(zio, NULL, ic->ic_vdev, is->is_target_offset, - good_child->ic_data, is->is_size, + is->is_good_child->ic_data, is->is_size, ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_IO_REPAIR | ZIO_FLAG_SELF_HEAL, NULL, NULL)); @@ -1454,21 +1478,194 @@ vdev_indirect_all_checksum_errors(zio_t *zio) } /* + * Copy data from all the splits to a main zio then validate the checksum. + * If then checksum is successfully validated return success. + */ +static int +vdev_indirect_splits_checksum_validate(indirect_vsd_t *iv, zio_t *zio) +{ + zio_bad_cksum_t zbc; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + + ASSERT3P(is->is_good_child->ic_data, !=, NULL); + ASSERT3P(is->is_good_child->ic_duplicate, ==, NULL); + + abd_copy_off(zio->io_abd, is->is_good_child->ic_data, + is->is_split_offset, 0, is->is_size); + } + + return (zio_checksum_error(zio, &zbc)); +} + +/* + * There are relatively few possible combinations making it feasible to + * deterministically check them all. We do this by setting the good_child + * to the next unique split version. If we reach the end of the list then + * "carry over" to the next unique split version (like counting in base + * is_unique_children, but each digit can have a different base). + */ +static int +vdev_indirect_splits_enumerate_all(indirect_vsd_t *iv, zio_t *zio) +{ + boolean_t more = B_TRUE; + + iv->iv_attempts = 0; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) + is->is_good_child = list_head(&is->is_unique_child); + + while (more == B_TRUE) { + iv->iv_attempts++; + more = B_FALSE; + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_good_child = list_next(&is->is_unique_child, + is->is_good_child); + if (is->is_good_child != NULL) { + more = B_TRUE; + break; + } + + is->is_good_child = list_head(&is->is_unique_child); + } + } + + ASSERT3S(iv->iv_attempts, <=, iv->iv_unique_combinations); + + return (SET_ERROR(ECKSUM)); +} + +/* + * There are too many combinations to try all of them in a reasonable amount + * of time. So try a fixed number of random combinations from the unique + * split versions, after which we'll consider the block unrecoverable. + */ +static int +vdev_indirect_splits_enumerate_randomly(indirect_vsd_t *iv, zio_t *zio) +{ + iv->iv_attempts = 0; + + while (iv->iv_attempts < iv->iv_attempts_max) { + iv->iv_attempts++; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic = list_head(&is->is_unique_child); + int children = is->is_unique_children; + + for (int i = spa_get_random(children); i > 0; i--) + ic = list_next(&is->is_unique_child, ic); + + ASSERT3P(ic, !=, NULL); + is->is_good_child = ic; + } + + if (vdev_indirect_splits_checksum_validate(iv, zio) == 0) + return (0); + } + + return (SET_ERROR(ECKSUM)); +} + +/* + * This is a validation function for reconstruction. It randomly selects + * a good combination, if one can be found, and then it intentionally + * damages all other segment copes by zeroing them. This forces the + * reconstruction algorithm to locate the one remaining known good copy. + */ +static int +vdev_indirect_splits_damage(indirect_vsd_t *iv, zio_t *zio) +{ + /* Presume all the copies are unique for initial selection. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; + + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic = &is->is_child[i]; + if (ic->ic_data != NULL) { + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic); + } + } + } + + /* + * Set each is_good_child to a randomly-selected child which + * is known to contain validated data. + */ + int error = vdev_indirect_splits_enumerate_randomly(iv, zio); + if (error) + goto out; + + /* + * Damage all but the known good copy by zeroing it. This will + * result in two or less unique copies per indirect_child_t. + * Both may need to be checked in order to reconstruct the block. + * Set iv->iv_attempts_max such that all unique combinations will + * enumerated, but limit the damage to at most 16 indirect splits. + */ + iv->iv_attempts_max = 1; + + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int c = 0; c < is->is_children; c++) { + indirect_child_t *ic = &is->is_child[c]; + + if (ic == is->is_good_child) + continue; + if (ic->ic_data == NULL) + continue; + + abd_zero(ic->ic_data, ic->ic_data->abd_size); + } + + iv->iv_attempts_max *= 2; + if (iv->iv_attempts_max > (1ULL << 16)) { + iv->iv_attempts_max = UINT64_MAX; + break; + } + } + +out: + /* Empty the unique children lists so they can be reconstructed. */ + for (indirect_split_t *is = list_head(&iv->iv_splits); + is != NULL; is = list_next(&iv->iv_splits, is)) { + indirect_child_t *ic; + while ((ic = list_head(&is->is_unique_child)) != NULL) + list_remove(&is->is_unique_child, ic); + + is->is_unique_children = 0; + } + + return (error); +} + +/* * This function is called when we have read all copies of the data and need * to try to find a combination of copies that gives us the right checksum. * * If we pointed to any mirror vdevs, this effectively does the job of the * mirror. The mirror vdev code can't do its own job because we don't know - * the checksum of each split segment individually. We have to try every - * combination of copies of split segments, until we find one that checksums - * correctly. (Or until we have tried all combinations, or have tried - * 2^zfs_reconstruct_indirect_segments_max combinations. In these cases we - * set io_error to ECKSUM to propagate the error up to the user.) + * the checksum of each split segment individually. * - * For example, if we have 3 segments in the split, - * and each points to a 2-way mirror, we will have the following pieces of - * data: + * We have to try every unique combination of copies of split segments, until + * we find one that checksums correctly. Duplicate segment copies are first + * identified and latter skipped during reconstruction. This optimization + * reduces the search space and ensures that of the remaining combinations + * at most one is correct. * + * When the total number of combinations is small they can all be checked. + * For example, if we have 3 segments in the split, and each points to a + * 2-way mirror with unique copies, we will have the following pieces of data: + * * | mirror child * split | [0] [1] * ======|===================== @@ -1494,10 +1691,10 @@ vdev_indirect_all_checksum_errors(zio_t *zio) * data_A_1 data_B_1 data_C_1 * * Note that the split segments may be on the same or different top-level - * vdevs. In either case, we try lots of combinations (see - * zfs_reconstruct_indirect_segments_max). This ensures that if a mirror has - * small silent errors on all of its children, we can still reconstruct the - * correct data, as long as those errors are at sufficiently-separated + * vdevs. In either case, we may need to try lots of combinations (see + * zfs_reconstruct_indirect_combinations_max). This ensures that if a mirror + * has small silent errors on all of its children, we can still reconstruct + * the correct data, as long as those errors are at sufficiently-separated * offsets (specifically, separated by the largest block size - default of * 128KB, but up to 16MB). */ @@ -1505,90 +1702,91 @@ static void vdev_indirect_reconstruct_io_done(zio_t *zio) { indirect_vsd_t *iv = zio->io_vsd; - uint64_t attempts = 0; - uint64_t attempts_max = 1ULL << zfs_reconstruct_indirect_segments_max; - int segments = 0; + boolean_t known_good = B_FALSE; + int error; + iv->iv_unique_combinations = 1; + iv->iv_attempts_max = UINT64_MAX; + + if (zfs_reconstruct_indirect_combinations_max > 0) + iv->iv_attempts_max = zfs_reconstruct_indirect_combinations_max; + + /* + * If nonzero, every 1/x blocks will be damaged, in order to validate + * reconstruction when there are split segments with damaged copies. + * Known_good will TRUE when reconstruction is known to be possible. + */ + if (zfs_reconstruct_indirect_damage_fraction != 0 && + spa_get_random(zfs_reconstruct_indirect_damage_fraction) == 0) + known_good = (vdev_indirect_splits_damage(iv, zio) == 0); + + /* + * Determine the unique children for a split segment and add them + * to the is_unique_child list. By restricting reconstruction + * to these children, only unique combinations will be considered. + * This can vastly reduce the search space when there are a large + * number of indirect splits. + */ for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) - segments++; + is != NULL; is = list_next(&iv->iv_splits, is)) { + is->is_unique_children = 0; - for (;;) { - /* copy data from splits to main zio */ - int ret; - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { + for (int i = 0; i < is->is_children; i++) { + indirect_child_t *ic_i = &is->is_child[i]; - /* - * If this child failed, its ic_data will be NULL. - * Skip this combination. - */ - if (is->is_child[is->is_good_child].ic_data == NULL) { - ret = EIO; - goto next; - } + if (ic_i->ic_data == NULL || + ic_i->ic_duplicate != NULL) + continue; - abd_copy_off(zio->io_abd, - is->is_child[is->is_good_child].ic_data, - is->is_split_offset, 0, is->is_size); - } + for (int j = i + 1; j < is->is_children; j++) { + indirect_child_t *ic_j = &is->is_child[j]; - /* See if this checksum matches. */ - zio_bad_cksum_t zbc; - ret = zio_checksum_error(zio, &zbc); - if (ret == 0) { - /* Found a matching checksum. Issue repair i/os. */ - vdev_indirect_repair(zio); - zio_checksum_verified(zio); - return; - } + if (ic_j->ic_data == NULL || + ic_j->ic_duplicate != NULL) + continue; - /* - * Checksum failed; try a different combination of split - * children. - */ - boolean_t more; -next: - more = B_FALSE; - if (segments <= zfs_reconstruct_indirect_segments_max) { - /* - * There are relatively few segments, so - * deterministically check all combinations. We do - * this by by adding one to the first split's - * good_child. If it overflows, then "carry over" to - * the next split (like counting in base is_children, - * but each digit can have a different base). - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child++; - if (is->is_good_child < is->is_children) { - more = B_TRUE; - break; + if (abd_cmp(ic_i->ic_data, ic_j->ic_data, + is->is_size) == 0) { + ic_j->ic_duplicate = ic_i; } - is->is_good_child = 0; } - } else if (++attempts < attempts_max) { - /* - * There are too many combinations to try all of them - * in a reasonable amount of time, so try a fixed - * number of random combinations, after which we'll - * consider the block unrecoverable. - */ - for (indirect_split_t *is = list_head(&iv->iv_splits); - is != NULL; is = list_next(&iv->iv_splits, is)) { - is->is_good_child = - spa_get_random(is->is_children); - } - more = B_TRUE; + + is->is_unique_children++; + list_insert_tail(&is->is_unique_child, ic_i); } - if (!more) { - /* All combinations failed. */ - zio->io_error = ret; + + /* Reconstruction is impossible, no valid children */ + EQUIV(list_is_empty(&is->is_unique_child), + is->is_unique_children == 0); + if (list_is_empty(&is->is_unique_child)) { + zio->io_error = EIO; vdev_indirect_all_checksum_errors(zio); zio_checksum_verified(zio); return; } + + iv->iv_unique_combinations *= is->is_unique_children; + } + + if (iv->iv_unique_combinations <= iv->iv_attempts_max) + error = vdev_indirect_splits_enumerate_all(iv, zio); + else + error = vdev_indirect_splits_enumerate_randomly(iv, zio); + + if (error != 0) { + /* All attempted combinations failed. */ + ASSERT3B(known_good, ==, B_FALSE); + zio->io_error = error; + vdev_indirect_all_checksum_errors(zio); + } else { + /* + * The checksum has been successfully validated. Issue + * repair I/Os to any copies of splits which don't match + * the validated version. + */ + ASSERT0(vdev_indirect_splits_checksum_validate(iv, zio)); + vdev_indirect_repair(zio); + zio_checksum_verified(zio); } } From owner-svn-src-all@freebsd.org Wed Nov 6 08:36:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3DA81AE10A; Wed, 6 Nov 2019 08:36:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Kcs550pz3Gsx; Wed, 6 Nov 2019 08:36:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9193722639; Wed, 6 Nov 2019 08:36:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68aDOg034540; Wed, 6 Nov 2019 08:36:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68aCAp034534; Wed, 6 Nov 2019 08:36:12 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060836.xA68aCAp034534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354375 - in stable/12: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 354375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:36:13 -0000 Author: avg Date: Wed Nov 6 08:36:12 2019 New Revision: 354375 URL: https://svnweb.freebsd.org/changeset/base/354375 Log: MFC r353634: MFV r348596: 9689 zfs range lock code should not be zpl-specific Modified: stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Nov 6 08:33:56 2019 (r354374) +++ stable/12/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Nov 6 08:36:12 2019 (r354375) @@ -242,7 +242,9 @@ typedef struct bufwad { } bufwad_t; /* - * XXX -- fix zfs range locks to be generic so we can use them here. + * It would be better to use a rangelock_t per object. Unfortunately + * the rangelock_t is not a drop-in replacement for rl_t, because we + * still need to map from object ID to rangelock_t. */ typedef enum { RL_READER, @@ -1943,12 +1945,12 @@ static void ztest_get_done(zgd_t *zgd, int error) { ztest_ds_t *zd = zgd->zgd_private; - uint64_t object = zgd->zgd_rl->rl_object; + uint64_t object = ((rl_t *)zgd->zgd_lr)->rl_object; if (zgd->zgd_db) dmu_buf_rele(zgd->zgd_db, zgd); - ztest_range_unlock(zgd->zgd_rl); + ztest_range_unlock((rl_t *)zgd->zgd_lr); ztest_object_unlock(zd, object); umem_free(zgd, sizeof (*zgd)); @@ -1998,8 +2000,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s zgd->zgd_private = zd; if (buf != NULL) { /* immediate write */ - zgd->zgd_rl = ztest_range_lock(zd, object, offset, size, - RL_READER); + zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd, + object, offset, size, RL_READER); error = dmu_read(os, object, offset, size, buf, DMU_READ_NO_PREFETCH); @@ -2013,8 +2015,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, s offset = 0; } - zgd->zgd_rl = ztest_range_lock(zd, object, offset, size, - RL_READER); + zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd, + object, offset, size, RL_READER); error = dmu_buf_hold(os, object, offset, zgd, &db, DMU_READ_NO_PREFETCH); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Nov 6 08:33:56 2019 (r354374) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Nov 6 08:36:12 2019 (r354375) @@ -75,6 +75,7 @@ struct arc_buf; struct zio_prop; struct sa_handle; struct file; +struct locked_range; typedef struct objset objset_t; typedef struct dmu_tx dmu_tx_t; @@ -966,7 +967,7 @@ typedef struct zgd { struct lwb *zgd_lwb; struct blkptr *zgd_bp; dmu_buf_t *zgd_db; - struct rl *zgd_rl; + struct locked_range *zgd_lr; void *zgd_private; } zgd_t; Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Wed Nov 6 08:33:56 2019 (r354374) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Wed Nov 6 08:36:12 2019 (r354375) @@ -22,6 +22,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2018 by Delphix. All rights reserved. + */ #ifndef _SYS_FS_ZFS_RLOCK_H #define _SYS_FS_ZFS_RLOCK_H @@ -30,54 +33,53 @@ extern "C" { #endif -#ifdef _KERNEL +#ifdef __FreeBSD__ +#define rangelock_init zfs_rangelock_init +#define rangelock_fini zfs_rangelock_fini +#endif -#include - typedef enum { RL_READER, RL_WRITER, RL_APPEND -} rl_type_t; +} rangelock_type_t; -typedef struct rl { - znode_t *r_zp; /* znode this lock applies to */ - avl_node_t r_node; /* avl node link */ - uint64_t r_off; /* file range offset */ - uint64_t r_len; /* file range length */ - uint_t r_cnt; /* range reference count in tree */ - rl_type_t r_type; /* range type */ - kcondvar_t r_wr_cv; /* cv for waiting writers */ - kcondvar_t r_rd_cv; /* cv for waiting readers */ - uint8_t r_proxy; /* acting for original range */ - uint8_t r_write_wanted; /* writer wants to lock this range */ - uint8_t r_read_wanted; /* reader wants to lock this range */ -} rl_t; +struct locked_range; -/* - * Lock a range (offset, length) as either shared (RL_READER) - * or exclusive (RL_WRITER or RL_APPEND). RL_APPEND is a special type that - * is converted to RL_WRITER that specified to lock from the start of the - * end of file. Returns the range lock structure. - */ -rl_t *zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type); +typedef void (rangelock_cb_t)(struct locked_range *, void *); -/* Unlock range and destroy range lock structure. */ -void zfs_range_unlock(rl_t *rl); +#ifdef __FreeBSD__ +typedef struct zfs_rangelock { +#else +typedef struct rangelock { +#endif + avl_tree_t rl_tree; /* contains locked_range_t */ + kmutex_t rl_lock; + rangelock_cb_t *rl_cb; + void *rl_arg; +} rangelock_t; -/* - * Reduce range locked as RW_WRITER from whole file to specified range. - * Asserts the whole file was previously locked. - */ -void zfs_range_reduce(rl_t *rl, uint64_t off, uint64_t len); +typedef struct locked_range { + rangelock_t *lr_rangelock; /* rangelock that this lock applies to */ + avl_node_t lr_node; /* avl node link */ + uint64_t lr_offset; /* file range offset */ + uint64_t lr_length; /* file range length */ + uint_t lr_count; /* range reference count in tree */ + rangelock_type_t lr_type; /* range type */ + kcondvar_t lr_write_cv; /* cv for waiting writers */ + kcondvar_t lr_read_cv; /* cv for waiting readers */ + uint8_t lr_proxy; /* acting for original range */ + uint8_t lr_write_wanted; /* writer wants to lock this range */ + uint8_t lr_read_wanted; /* reader wants to lock this range */ +} locked_range_t; -/* - * AVL comparison function used to order range locks - * Locks are ordered on the start offset of the range. - */ -int zfs_range_compare(const void *arg1, const void *arg2); +void rangelock_init(rangelock_t *, rangelock_cb_t *, void *); +void rangelock_fini(rangelock_t *); -#endif /* _KERNEL */ +locked_range_t *rangelock_enter(rangelock_t *, + uint64_t, uint64_t, rangelock_type_t); +void rangelock_exit(locked_range_t *); +void rangelock_reduce(locked_range_t *, uint64_t, uint64_t); #ifdef __cplusplus } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Wed Nov 6 08:33:56 2019 (r354374) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Wed Nov 6 08:36:12 2019 (r354375) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ @@ -36,6 +36,7 @@ #include #include #include +#include #endif #include #include @@ -57,8 +58,8 @@ extern "C" { #define ZFS_APPENDONLY 0x0000004000000000 #define ZFS_NODUMP 0x0000008000000000 #define ZFS_OPAQUE 0x0000010000000000 -#define ZFS_AV_QUARANTINED 0x0000020000000000 -#define ZFS_AV_MODIFIED 0x0000040000000000 +#define ZFS_AV_QUARANTINED 0x0000020000000000 +#define ZFS_AV_MODIFIED 0x0000040000000000 #define ZFS_REPARSE 0x0000080000000000 #define ZFS_OFFLINE 0x0000100000000000 #define ZFS_SPARSE 0x0000200000000000 @@ -78,8 +79,8 @@ extern "C" { */ #define ZFS_XATTR 0x1 /* is an extended attribute */ #define ZFS_INHERIT_ACE 0x2 /* ace has inheritable ACEs */ -#define ZFS_ACL_TRIVIAL 0x4 /* files ACL is trivial */ -#define ZFS_ACL_OBJ_ACE 0x8 /* ACL has CMPLX Object ACE */ +#define ZFS_ACL_TRIVIAL 0x4 /* files ACL is trivial */ +#define ZFS_ACL_OBJ_ACE 0x8 /* ACL has CMPLX Object ACE */ #define ZFS_ACL_PROTECTED 0x10 /* ACL protected */ #define ZFS_ACL_DEFAULTED 0x20 /* ACL should be defaulted */ #define ZFS_ACL_AUTO_INHERIT 0x40 /* ACL should be inherited */ @@ -177,8 +178,7 @@ typedef struct znode { krwlock_t z_name_lock; /* "master" lock for dirent locks */ zfs_dirlock_t *z_dirlocks; /* directory entry lock list */ #endif - kmutex_t z_range_lock; /* protects changes to z_range_avl */ - avl_tree_t z_range_avl; /* avl tree of file range locks */ + rangelock_t z_rangelock; /* file range locks */ uint8_t z_unlinked; /* file has been unlinked */ uint8_t z_atime_dirty; /* atime needs to be synced */ uint8_t z_zn_prefetch; /* Prefetch znodes? */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Nov 6 08:33:56 2019 (r354374) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Wed Nov 6 08:36:12 2019 (r354375) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. */ /* @@ -34,9 +34,9 @@ * Interface * --------- * Defined in zfs_rlock.h but essentially: - * rl = zfs_range_lock(zp, off, len, lock_type); - * zfs_range_unlock(rl); - * zfs_range_reduce(rl, off, len); + * lr = rangelock_enter(zp, off, len, lock_type); + * rangelock_reduce(lr, off, len); // optional + * rangelock_exit(lr); * * AVL tree * -------- @@ -46,9 +46,10 @@ * * Common case * ----------- - * The (hopefully) usual case is of no overlaps or contention for - * locks. On entry to zfs_lock_range() a rl_t is allocated; the tree - * searched that finds no overlap, and *this* rl_t is placed in the tree. + * The (hopefully) usual case is of no overlaps or contention for locks. On + * entry to rangelock_enter(), a locked_range_t is allocated; the tree + * searched that finds no overlap, and *this* locked_range_t is placed in the + * tree. * * Overlaps/Reference counting/Proxy locks * --------------------------------------- @@ -87,67 +88,90 @@ * * Grow block handling * ------------------- - * ZFS supports multiple block sizes currently upto 128K. The smallest + * ZFS supports multiple block sizes, up to 16MB. The smallest * block size is used for the file which is grown as needed. During this * growth all other writers and readers must be excluded. * So if the block size needs to be grown then the whole file is * exclusively locked, then later the caller will reduce the lock - * range to just the range to be written using zfs_reduce_range. + * range to just the range to be written using rangelock_reduce(). */ +#include +#include #include /* + * AVL comparison function used to order range locks + * Locks are ordered on the start offset of the range. + */ +static int +rangelock_compare(const void *arg1, const void *arg2) +{ + const locked_range_t *rl1 = arg1; + const locked_range_t *rl2 = arg2; + + if (rl1->lr_offset > rl2->lr_offset) + return (1); + if (rl1->lr_offset < rl2->lr_offset) + return (-1); + return (0); +} + +/* + * The callback is invoked when acquiring a RL_WRITER or RL_APPEND lock. + * It must convert RL_APPEND to RL_WRITER (starting at the end of the file), + * and may increase the range that's locked for RL_WRITER. + */ +void +rangelock_init(rangelock_t *rl, rangelock_cb_t *cb, void *arg) +{ + mutex_init(&rl->rl_lock, NULL, MUTEX_DEFAULT, NULL); + avl_create(&rl->rl_tree, rangelock_compare, + sizeof (locked_range_t), offsetof(locked_range_t, lr_node)); + rl->rl_cb = cb; + rl->rl_arg = arg; +} + +void +rangelock_fini(rangelock_t *rl) +{ + mutex_destroy(&rl->rl_lock); + avl_destroy(&rl->rl_tree); +} + +/* * Check if a write lock can be grabbed, or wait and recheck until available. */ static void -zfs_range_lock_writer(znode_t *zp, rl_t *new) +rangelock_enter_writer(rangelock_t *rl, locked_range_t *new) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *rl; + avl_tree_t *tree = &rl->rl_tree; + locked_range_t *lr; avl_index_t where; - uint64_t end_size; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + uint64_t orig_off = new->lr_offset; + uint64_t orig_len = new->lr_length; + rangelock_type_t orig_type = new->lr_type; for (;;) { /* - * Range locking is also used by zvol and uses a - * dummied up znode. However, for zvol, we don't need to - * append or grow blocksize, and besides we don't have - * a "sa" data or z_zfsvfs - so skip that processing. - * - * Yes, this is ugly, and would be solved by not handling - * grow or append in range lock code. If that was done then - * we could make the range locking code generically available - * to other non-zfs consumers. + * Call callback which can modify new->r_off,len,type. + * Note, the callback is used by the ZPL to handle appending + * and changing blocksizes. It isn't needed for zvols. */ - if (zp->z_vnode) { /* caller is ZPL */ - /* - * If in append mode pick up the current end of file. - * This is done under z_range_lock to avoid races. - */ - if (new->r_type == RL_APPEND) - new->r_off = zp->z_size; - - /* - * If we need to grow the block size then grab the whole - * file range. This is also done under z_range_lock to - * avoid races. - */ - end_size = MAX(zp->z_size, new->r_off + len); - if (end_size > zp->z_blksz && (!ISP2(zp->z_blksz) || - zp->z_blksz < zp->z_zfsvfs->z_max_blksz)) { - new->r_off = 0; - new->r_len = UINT64_MAX; - } + if (rl->rl_cb != NULL) { + rl->rl_cb(new, rl->rl_arg); } /* + * If the type was APPEND, the callback must convert it to + * WRITER. + */ + ASSERT3U(new->lr_type, ==, RL_WRITER); + + /* * First check for the usual case of no locks */ if (avl_numnodes(tree) == 0) { - new->r_type = RL_WRITER; /* convert to writer */ avl_add(tree, new); return; } @@ -155,31 +179,33 @@ zfs_range_lock_writer(znode_t *zp, rl_t *new) /* * Look for any locks in the range. */ - rl = avl_find(tree, new, &where); - if (rl) + lr = avl_find(tree, new, &where); + if (lr != NULL) goto wait; /* already locked at same offset */ - rl = (rl_t *)avl_nearest(tree, where, AVL_AFTER); - if (rl && (rl->r_off < new->r_off + new->r_len)) + lr = (locked_range_t *)avl_nearest(tree, where, AVL_AFTER); + if (lr != NULL && + lr->lr_offset < new->lr_offset + new->lr_length) goto wait; - rl = (rl_t *)avl_nearest(tree, where, AVL_BEFORE); - if (rl && rl->r_off + rl->r_len > new->r_off) + lr = (locked_range_t *)avl_nearest(tree, where, AVL_BEFORE); + if (lr != NULL && + lr->lr_offset + lr->lr_length > new->lr_offset) goto wait; - new->r_type = RL_WRITER; /* convert possible RL_APPEND */ avl_insert(tree, new, where); return; wait: - if (!rl->r_write_wanted) { - cv_init(&rl->r_wr_cv, NULL, CV_DEFAULT, NULL); - rl->r_write_wanted = B_TRUE; + if (!lr->lr_write_wanted) { + cv_init(&lr->lr_write_cv, NULL, CV_DEFAULT, NULL); + lr->lr_write_wanted = B_TRUE; } - cv_wait(&rl->r_wr_cv, &zp->z_range_lock); + cv_wait(&lr->lr_write_cv, &rl->rl_lock); /* reset to original */ - new->r_off = off; - new->r_len = len; + new->lr_offset = orig_off; + new->lr_length = orig_len; + new->lr_type = orig_type; } } @@ -187,29 +213,29 @@ wait: * If this is an original (non-proxy) lock then replace it by * a proxy and return the proxy. */ -static rl_t * -zfs_range_proxify(avl_tree_t *tree, rl_t *rl) +static locked_range_t * +rangelock_proxify(avl_tree_t *tree, locked_range_t *lr) { - rl_t *proxy; + locked_range_t *proxy; - if (rl->r_proxy) - return (rl); /* already a proxy */ + if (lr->lr_proxy) + return (lr); /* already a proxy */ - ASSERT3U(rl->r_cnt, ==, 1); - ASSERT(rl->r_write_wanted == B_FALSE); - ASSERT(rl->r_read_wanted == B_FALSE); - avl_remove(tree, rl); - rl->r_cnt = 0; + ASSERT3U(lr->lr_count, ==, 1); + ASSERT(lr->lr_write_wanted == B_FALSE); + ASSERT(lr->lr_read_wanted == B_FALSE); + avl_remove(tree, lr); + lr->lr_count = 0; /* create a proxy range lock */ - proxy = kmem_alloc(sizeof (rl_t), KM_SLEEP); - proxy->r_off = rl->r_off; - proxy->r_len = rl->r_len; - proxy->r_cnt = 1; - proxy->r_type = RL_READER; - proxy->r_proxy = B_TRUE; - proxy->r_write_wanted = B_FALSE; - proxy->r_read_wanted = B_FALSE; + proxy = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + proxy->lr_offset = lr->lr_offset; + proxy->lr_length = lr->lr_length; + proxy->lr_count = 1; + proxy->lr_type = RL_READER; + proxy->lr_proxy = B_TRUE; + proxy->lr_write_wanted = B_FALSE; + proxy->lr_read_wanted = B_FALSE; avl_add(tree, proxy); return (proxy); @@ -219,29 +245,27 @@ zfs_range_proxify(avl_tree_t *tree, rl_t *rl) * Split the range lock at the supplied offset * returning the *front* proxy. */ -static rl_t * -zfs_range_split(avl_tree_t *tree, rl_t *rl, uint64_t off) +static locked_range_t * +rangelock_split(avl_tree_t *tree, locked_range_t *lr, uint64_t off) { - rl_t *front, *rear; + ASSERT3U(lr->lr_length, >, 1); + ASSERT3U(off, >, lr->lr_offset); + ASSERT3U(off, <, lr->lr_offset + lr->lr_length); + ASSERT(lr->lr_write_wanted == B_FALSE); + ASSERT(lr->lr_read_wanted == B_FALSE); - ASSERT3U(rl->r_len, >, 1); - ASSERT3U(off, >, rl->r_off); - ASSERT3U(off, <, rl->r_off + rl->r_len); - ASSERT(rl->r_write_wanted == B_FALSE); - ASSERT(rl->r_read_wanted == B_FALSE); - /* create the rear proxy range lock */ - rear = kmem_alloc(sizeof (rl_t), KM_SLEEP); - rear->r_off = off; - rear->r_len = rl->r_off + rl->r_len - off; - rear->r_cnt = rl->r_cnt; - rear->r_type = RL_READER; - rear->r_proxy = B_TRUE; - rear->r_write_wanted = B_FALSE; - rear->r_read_wanted = B_FALSE; + locked_range_t *rear = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + rear->lr_offset = off; + rear->lr_length = lr->lr_offset + lr->lr_length - off; + rear->lr_count = lr->lr_count; + rear->lr_type = RL_READER; + rear->lr_proxy = B_TRUE; + rear->lr_write_wanted = B_FALSE; + rear->lr_read_wanted = B_FALSE; - front = zfs_range_proxify(tree, rl); - front->r_len = off - rl->r_off; + locked_range_t *front = rangelock_proxify(tree, lr); + front->lr_length = off - lr->lr_offset; avl_insert_here(tree, rear, front, AVL_AFTER); return (front); @@ -251,28 +275,27 @@ zfs_range_split(avl_tree_t *tree, rl_t *rl, uint64_t o * Create and add a new proxy range lock for the supplied range. */ static void -zfs_range_new_proxy(avl_tree_t *tree, uint64_t off, uint64_t len) +rangelock_new_proxy(avl_tree_t *tree, uint64_t off, uint64_t len) { - rl_t *rl; - - ASSERT(len); - rl = kmem_alloc(sizeof (rl_t), KM_SLEEP); - rl->r_off = off; - rl->r_len = len; - rl->r_cnt = 1; - rl->r_type = RL_READER; - rl->r_proxy = B_TRUE; - rl->r_write_wanted = B_FALSE; - rl->r_read_wanted = B_FALSE; - avl_add(tree, rl); + ASSERT(len != 0); + locked_range_t *lr = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + lr->lr_offset = off; + lr->lr_length = len; + lr->lr_count = 1; + lr->lr_type = RL_READER; + lr->lr_proxy = B_TRUE; + lr->lr_write_wanted = B_FALSE; + lr->lr_read_wanted = B_FALSE; + avl_add(tree, lr); } static void -zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t *prev, avl_index_t where) +rangelock_add_reader(avl_tree_t *tree, locked_range_t *new, + locked_range_t *prev, avl_index_t where) { - rl_t *next; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + locked_range_t *next; + uint64_t off = new->lr_offset; + uint64_t len = new->lr_length; /* * prev arrives either: @@ -281,37 +304,37 @@ zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t * range may overlap with the new range * - null, if there were no ranges starting before the new one */ - if (prev) { - if (prev->r_off + prev->r_len <= off) { + if (prev != NULL) { + if (prev->lr_offset + prev->lr_length <= off) { prev = NULL; - } else if (prev->r_off != off) { + } else if (prev->lr_offset != off) { /* * convert to proxy if needed then * split this entry and bump ref count */ - prev = zfs_range_split(tree, prev, off); + prev = rangelock_split(tree, prev, off); prev = AVL_NEXT(tree, prev); /* move to rear range */ } } - ASSERT((prev == NULL) || (prev->r_off == off)); + ASSERT((prev == NULL) || (prev->lr_offset == off)); - if (prev) + if (prev != NULL) next = prev; else - next = (rl_t *)avl_nearest(tree, where, AVL_AFTER); + next = avl_nearest(tree, where, AVL_AFTER); - if (next == NULL || off + len <= next->r_off) { + if (next == NULL || off + len <= next->lr_offset) { /* no overlaps, use the original new rl_t in the tree */ avl_insert(tree, new, where); return; } - if (off < next->r_off) { + if (off < next->lr_offset) { /* Add a proxy for initial range before the overlap */ - zfs_range_new_proxy(tree, off, next->r_off - off); + rangelock_new_proxy(tree, off, next->lr_offset - off); } - new->r_cnt = 0; /* will use proxies in tree */ + new->lr_count = 0; /* will use proxies in tree */ /* * We now search forward through the ranges, until we go past the end * of the new range. For each entry we make it a proxy if it @@ -319,47 +342,51 @@ zfs_range_add_reader(avl_tree_t *tree, rl_t *new, rl_t * gaps between the ranges then we create a new proxy range. */ for (prev = NULL; next; prev = next, next = AVL_NEXT(tree, next)) { - if (off + len <= next->r_off) + if (off + len <= next->lr_offset) break; - if (prev && prev->r_off + prev->r_len < next->r_off) { + if (prev != NULL && prev->lr_offset + prev->lr_length < + next->lr_offset) { /* there's a gap */ - ASSERT3U(next->r_off, >, prev->r_off + prev->r_len); - zfs_range_new_proxy(tree, prev->r_off + prev->r_len, - next->r_off - (prev->r_off + prev->r_len)); + ASSERT3U(next->lr_offset, >, + prev->lr_offset + prev->lr_length); + rangelock_new_proxy(tree, + prev->lr_offset + prev->lr_length, + next->lr_offset - + (prev->lr_offset + prev->lr_length)); } - if (off + len == next->r_off + next->r_len) { + if (off + len == next->lr_offset + next->lr_length) { /* exact overlap with end */ - next = zfs_range_proxify(tree, next); - next->r_cnt++; + next = rangelock_proxify(tree, next); + next->lr_count++; return; } - if (off + len < next->r_off + next->r_len) { + if (off + len < next->lr_offset + next->lr_length) { /* new range ends in the middle of this block */ - next = zfs_range_split(tree, next, off + len); - next->r_cnt++; + next = rangelock_split(tree, next, off + len); + next->lr_count++; return; } - ASSERT3U(off + len, >, next->r_off + next->r_len); - next = zfs_range_proxify(tree, next); - next->r_cnt++; + ASSERT3U(off + len, >, next->lr_offset + next->lr_length); + next = rangelock_proxify(tree, next); + next->lr_count++; } /* Add the remaining end range. */ - zfs_range_new_proxy(tree, prev->r_off + prev->r_len, - (off + len) - (prev->r_off + prev->r_len)); + rangelock_new_proxy(tree, prev->lr_offset + prev->lr_length, + (off + len) - (prev->lr_offset + prev->lr_length)); } /* * Check if a reader lock can be grabbed, or wait and recheck until available. */ static void -zfs_range_lock_reader(znode_t *zp, rl_t *new) +rangelock_enter_reader(rangelock_t *rl, locked_range_t *new) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *prev, *next; + avl_tree_t *tree = &rl->rl_tree; + locked_range_t *prev, *next; avl_index_t where; - uint64_t off = new->r_off; - uint64_t len = new->r_len; + uint64_t off = new->lr_offset; + uint64_t len = new->lr_length; /* * Look for any writer locks in the range. @@ -367,21 +394,22 @@ zfs_range_lock_reader(znode_t *zp, rl_t *new) retry: prev = avl_find(tree, new, &where); if (prev == NULL) - prev = (rl_t *)avl_nearest(tree, where, AVL_BEFORE); + prev = (locked_range_t *)avl_nearest(tree, where, AVL_BEFORE); /* * Check the previous range for a writer lock overlap. */ - if (prev && (off < prev->r_off + prev->r_len)) { - if ((prev->r_type == RL_WRITER) || (prev->r_write_wanted)) { - if (!prev->r_read_wanted) { - cv_init(&prev->r_rd_cv, NULL, CV_DEFAULT, NULL); - prev->r_read_wanted = B_TRUE; + if (prev && (off < prev->lr_offset + prev->lr_length)) { + if ((prev->lr_type == RL_WRITER) || (prev->lr_write_wanted)) { + if (!prev->lr_read_wanted) { + cv_init(&prev->lr_read_cv, + NULL, CV_DEFAULT, NULL); + prev->lr_read_wanted = B_TRUE; } - cv_wait(&prev->r_rd_cv, &zp->z_range_lock); + cv_wait(&prev->lr_read_cv, &rl->rl_lock); goto retry; } - if (off + len < prev->r_off + prev->r_len) + if (off + len < prev->lr_offset + prev->lr_length) goto got_lock; } @@ -389,70 +417,71 @@ retry: * Search through the following ranges to see if there's * write lock any overlap. */ - if (prev) + if (prev != NULL) next = AVL_NEXT(tree, prev); else - next = (rl_t *)avl_nearest(tree, where, AVL_AFTER); - for (; next; next = AVL_NEXT(tree, next)) { - if (off + len <= next->r_off) + next = (locked_range_t *)avl_nearest(tree, where, AVL_AFTER); + for (; next != NULL; next = AVL_NEXT(tree, next)) { + if (off + len <= next->lr_offset) goto got_lock; - if ((next->r_type == RL_WRITER) || (next->r_write_wanted)) { - if (!next->r_read_wanted) { - cv_init(&next->r_rd_cv, NULL, CV_DEFAULT, NULL); - next->r_read_wanted = B_TRUE; + if ((next->lr_type == RL_WRITER) || (next->lr_write_wanted)) { + if (!next->lr_read_wanted) { + cv_init(&next->lr_read_cv, + NULL, CV_DEFAULT, NULL); + next->lr_read_wanted = B_TRUE; } - cv_wait(&next->r_rd_cv, &zp->z_range_lock); + cv_wait(&next->lr_read_cv, &rl->rl_lock); goto retry; } - if (off + len <= next->r_off + next->r_len) + if (off + len <= next->lr_offset + next->lr_length) goto got_lock; } got_lock: /* * Add the read lock, which may involve splitting existing - * locks and bumping ref counts (r_cnt). + * locks and bumping ref counts (r_count). */ - zfs_range_add_reader(tree, new, prev, where); + rangelock_add_reader(tree, new, prev, where); } /* - * Lock a range (offset, length) as either shared (RL_READER) - * or exclusive (RL_WRITER). Returns the range lock structure - * for later unlocking or reduce range (if entire file - * previously locked as RL_WRITER). + * Lock a range (offset, length) as either shared (RL_READER) or exclusive + * (RL_WRITER or RL_APPEND). If RL_APPEND is specified, rl_cb() will convert + * it to a RL_WRITER lock (with the offset at the end of the file). Returns + * the range lock structure for later unlocking (or reduce range if the + * entire file is locked as RL_WRITER). */ -rl_t * -zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type) +locked_range_t * +rangelock_enter(rangelock_t *rl, uint64_t off, uint64_t len, + rangelock_type_t type) { - rl_t *new; - ASSERT(type == RL_READER || type == RL_WRITER || type == RL_APPEND); - new = kmem_alloc(sizeof (rl_t), KM_SLEEP); - new->r_zp = zp; - new->r_off = off; + locked_range_t *new = kmem_alloc(sizeof (locked_range_t), KM_SLEEP); + new->lr_rangelock = rl; + new->lr_offset = off; if (len + off < off) /* overflow */ len = UINT64_MAX - off; - new->r_len = len; - new->r_cnt = 1; /* assume it's going to be in the tree */ - new->r_type = type; - new->r_proxy = B_FALSE; - new->r_write_wanted = B_FALSE; - new->r_read_wanted = B_FALSE; + new->lr_length = len; + new->lr_count = 1; /* assume it's going to be in the tree */ + new->lr_type = type; + new->lr_proxy = B_FALSE; + new->lr_write_wanted = B_FALSE; + new->lr_read_wanted = B_FALSE; - mutex_enter(&zp->z_range_lock); + mutex_enter(&rl->rl_lock); if (type == RL_READER) { /* * First check for the usual case of no locks */ - if (avl_numnodes(&zp->z_range_avl) == 0) - avl_add(&zp->z_range_avl, new); + if (avl_numnodes(&rl->rl_tree) == 0) + avl_add(&rl->rl_tree, new); else - zfs_range_lock_reader(zp, new); + rangelock_enter_reader(rl, new); } else - zfs_range_lock_writer(zp, new); /* RL_WRITER or RL_APPEND */ - mutex_exit(&zp->z_range_lock); + rangelock_enter_writer(rl, new); /* RL_WRITER or RL_APPEND */ + mutex_exit(&rl->rl_lock); return (new); } @@ -460,10 +489,9 @@ zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len * Unlock a reader lock */ static void -zfs_range_unlock_reader(znode_t *zp, rl_t *remove) +rangelock_exit_reader(rangelock_t *rl, locked_range_t *remove) { - avl_tree_t *tree = &zp->z_range_avl; - rl_t *rl, *next = NULL; + avl_tree_t *tree = &rl->rl_tree; uint64_t len; /* @@ -473,129 +501,118 @@ zfs_range_unlock_reader(znode_t *zp, rl_t *remove) * removed from the tree and replaced by proxies (one or * more ranges mapping to the entire range). */ - if (remove->r_cnt == 1) { + if (remove->lr_count == 1) { avl_remove(tree, remove); - if (remove->r_write_wanted) { - cv_broadcast(&remove->r_wr_cv); - cv_destroy(&remove->r_wr_cv); + if (remove->lr_write_wanted) { + cv_broadcast(&remove->lr_write_cv); + cv_destroy(&remove->lr_write_cv); } - if (remove->r_read_wanted) { - cv_broadcast(&remove->r_rd_cv); - cv_destroy(&remove->r_rd_cv); + if (remove->lr_read_wanted) { + cv_broadcast(&remove->lr_read_cv); + cv_destroy(&remove->lr_read_cv); } } else { - ASSERT0(remove->r_cnt); - ASSERT0(remove->r_write_wanted); - ASSERT0(remove->r_read_wanted); + ASSERT0(remove->lr_count); + ASSERT0(remove->lr_write_wanted); + ASSERT0(remove->lr_read_wanted); /* * Find start proxy representing this reader lock, * then decrement ref count on all proxies * that make up this range, freeing them as needed. */ - rl = avl_find(tree, remove, NULL); - ASSERT(rl); - ASSERT(rl->r_cnt); - ASSERT(rl->r_type == RL_READER); - for (len = remove->r_len; len != 0; rl = next) { - len -= rl->r_len; - if (len) { - next = AVL_NEXT(tree, rl); - ASSERT(next); - ASSERT(rl->r_off + rl->r_len == next->r_off); - ASSERT(next->r_cnt); - ASSERT(next->r_type == RL_READER); + locked_range_t *lr = avl_find(tree, remove, NULL); + ASSERT3P(lr, !=, NULL); + ASSERT3U(lr->lr_count, !=, 0); + ASSERT3U(lr->lr_type, ==, RL_READER); + locked_range_t *next = NULL; + for (len = remove->lr_length; len != 0; lr = next) { + len -= lr->lr_length; + if (len != 0) { + next = AVL_NEXT(tree, lr); + ASSERT3P(next, !=, NULL); + ASSERT3U(lr->lr_offset + lr->lr_length, ==, + next->lr_offset); + ASSERT3U(next->lr_count, !=, 0); + ASSERT3U(next->lr_type, ==, RL_READER); } - rl->r_cnt--; - if (rl->r_cnt == 0) { - avl_remove(tree, rl); - if (rl->r_write_wanted) { - cv_broadcast(&rl->r_wr_cv); - cv_destroy(&rl->r_wr_cv); + lr->lr_count--; + if (lr->lr_count == 0) { + avl_remove(tree, lr); + if (lr->lr_write_wanted) { + cv_broadcast(&lr->lr_write_cv); + cv_destroy(&lr->lr_write_cv); } - if (rl->r_read_wanted) { - cv_broadcast(&rl->r_rd_cv); - cv_destroy(&rl->r_rd_cv); + if (lr->lr_read_wanted) { + cv_broadcast(&lr->lr_read_cv); + cv_destroy(&lr->lr_read_cv); } - kmem_free(rl, sizeof (rl_t)); + kmem_free(lr, sizeof (locked_range_t)); } } } - kmem_free(remove, sizeof (rl_t)); + kmem_free(remove, sizeof (locked_range_t)); } /* * Unlock range and destroy range lock structure. */ void -zfs_range_unlock(rl_t *rl) +rangelock_exit(locked_range_t *lr) { - znode_t *zp = rl->r_zp; + rangelock_t *rl = lr->lr_rangelock; - ASSERT(rl->r_type == RL_WRITER || rl->r_type == RL_READER); - ASSERT(rl->r_cnt == 1 || rl->r_cnt == 0); - ASSERT(!rl->r_proxy); + ASSERT(lr->lr_type == RL_WRITER || lr->lr_type == RL_READER); + ASSERT(lr->lr_count == 1 || lr->lr_count == 0); + ASSERT(!lr->lr_proxy); - mutex_enter(&zp->z_range_lock); - if (rl->r_type == RL_WRITER) { + mutex_enter(&rl->rl_lock); + if (lr->lr_type == RL_WRITER) { /* writer locks can't be shared or split */ - avl_remove(&zp->z_range_avl, rl); - mutex_exit(&zp->z_range_lock); - if (rl->r_write_wanted) { - cv_broadcast(&rl->r_wr_cv); - cv_destroy(&rl->r_wr_cv); + avl_remove(&rl->rl_tree, lr); + mutex_exit(&rl->rl_lock); + if (lr->lr_write_wanted) { + cv_broadcast(&lr->lr_write_cv); + cv_destroy(&lr->lr_write_cv); } - if (rl->r_read_wanted) { - cv_broadcast(&rl->r_rd_cv); - cv_destroy(&rl->r_rd_cv); + if (lr->lr_read_wanted) { + cv_broadcast(&lr->lr_read_cv); + cv_destroy(&lr->lr_read_cv); } - kmem_free(rl, sizeof (rl_t)); + kmem_free(lr, sizeof (locked_range_t)); } else { /* - * lock may be shared, let zfs_range_unlock_reader() + * lock may be shared, let rangelock_exit_reader() * release the lock and free the rl_t */ - zfs_range_unlock_reader(zp, rl); - mutex_exit(&zp->z_range_lock); + rangelock_exit_reader(rl, lr); + mutex_exit(&rl->rl_lock); } } /* * Reduce range locked as RL_WRITER from whole file to specified range. - * Asserts the whole file is exclusivly locked and so there's only one + * Asserts the whole file is exclusively locked and so there's only one * entry in the tree. */ void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 08:37:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BB961AE4D0; Wed, 6 Nov 2019 08:37:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Kfs18Mfz3HBR; Wed, 6 Nov 2019 08:37:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B0F02263C; Wed, 6 Nov 2019 08:37:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68bvLO034803; Wed, 6 Nov 2019 08:37:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68btcT034796; Wed, 6 Nov 2019 08:37:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060837.xA68btcT034796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354376 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 354376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:37:57 -0000 Author: avg Date: Wed Nov 6 08:37:55 2019 New Revision: 354376 URL: https://svnweb.freebsd.org/changeset/base/354376 Log: MFC r353638: MFV r353637: 10844 Serialize ZTHR operations to eliminate races Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Nov 6 08:37:55 2019 (r354376) @@ -4896,7 +4896,7 @@ arc_adjust_cb_check(void *arg, zthr_t *zthr) * Keep arc_size under arc_c by running arc_adjust which evicts data * from the ARC. */ /* ARGSUSED */ -static int +static void arc_adjust_cb(void *arg, zthr_t *zthr) { uint64_t evicted = 0; @@ -4927,8 +4927,6 @@ arc_adjust_cb(void *arg, zthr_t *zthr) cv_broadcast(&arc_adjust_waiters_cv); } mutex_exit(&arc_adjust_lock); - - return (0); } /* ARGSUSED */ @@ -4970,7 +4968,7 @@ arc_reap_cb_check(void *arg, zthr_t *zthr) * to free more buffers. */ /* ARGSUSED */ -static int +static void arc_reap_cb(void *arg, zthr_t *zthr) { int64_t free_memory; @@ -5011,8 +5009,6 @@ arc_reap_cb(void *arg, zthr_t *zthr) #endif arc_reduce_target_size(to_free); } - - return (0); } static u_int arc_dnlc_evicts_arg; Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 6 08:37:55 2019 (r354376) @@ -1438,13 +1438,11 @@ spa_unload(spa_t *spa) } if (spa->spa_condense_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_condense_zthr)); zthr_destroy(spa->spa_condense_zthr); spa->spa_condense_zthr = NULL; } if (spa->spa_checkpoint_discard_zthr != NULL) { - ASSERT(!zthr_isrunning(spa->spa_checkpoint_discard_zthr)); zthr_destroy(spa->spa_checkpoint_discard_zthr); spa->spa_checkpoint_discard_zthr = NULL; } @@ -7310,12 +7308,12 @@ spa_async_suspend(spa_t *spa) spa_vdev_remove_suspend(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && zthr_isrunning(condense_thread)) - VERIFY0(zthr_cancel(condense_thread)); + if (condense_thread != NULL) + zthr_cancel(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && zthr_isrunning(discard_thread)) - VERIFY0(zthr_cancel(discard_thread)); + if (discard_thread != NULL) + zthr_cancel(discard_thread); } void @@ -7328,11 +7326,11 @@ spa_async_resume(spa_t *spa) spa_restart_removal(spa); zthr_t *condense_thread = spa->spa_condense_zthr; - if (condense_thread != NULL && !zthr_isrunning(condense_thread)) + if (condense_thread != NULL) zthr_resume(condense_thread); zthr_t *discard_thread = spa->spa_checkpoint_discard_zthr; - if (discard_thread != NULL && !zthr_isrunning(discard_thread)) + if (discard_thread != NULL) zthr_resume(discard_thread); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_checkpoint.c Wed Nov 6 08:37:55 2019 (r354376) @@ -391,7 +391,7 @@ spa_checkpoint_discard_thread_check(void *arg, zthr_t return (B_TRUE); } -int +void spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -406,7 +406,7 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) dmu_buf_t **dbp; if (zthr_iscancelled(zthr)) - return (0); + return; ASSERT3P(vd->vdev_ops, !=, &vdev_indirect_ops); @@ -443,8 +443,6 @@ spa_checkpoint_discard_thread(void *arg, zthr_t *zthr) VERIFY0(dsl_sync_task(spa->spa_name, NULL, spa_checkpoint_discard_complete_sync, spa, 0, ZFS_SPACE_CHECK_NONE)); - - return (0); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_checkpoint.h Wed Nov 6 08:37:55 2019 (r354376) @@ -37,7 +37,7 @@ int spa_checkpoint(const char *); int spa_checkpoint_discard(const char *); boolean_t spa_checkpoint_discard_thread_check(void *, zthr_t *); -int spa_checkpoint_discard_thread(void *, zthr_t *); +void spa_checkpoint_discard_thread(void *, zthr_t *); int spa_checkpoint_get_stats(spa_t *, pool_checkpoint_stat_t *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h Wed Nov 6 08:37:55 2019 (r354376) @@ -14,42 +14,26 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2018 by Delphix. All rights reserved. */ #ifndef _SYS_ZTHR_H #define _SYS_ZTHR_H typedef struct zthr zthr_t; -typedef int (zthr_func_t)(void *, zthr_t *); +typedef void (zthr_func_t)(void *, zthr_t *); typedef boolean_t (zthr_checkfunc_t)(void *, zthr_t *); -struct zthr { - kthread_t *zthr_thread; - kmutex_t zthr_lock; - kcondvar_t zthr_cv; - boolean_t zthr_cancel; - hrtime_t zthr_wait_time; - - zthr_checkfunc_t *zthr_checkfunc; - zthr_func_t *zthr_func; - void *zthr_arg; - int zthr_rc; -}; - extern zthr_t *zthr_create(zthr_checkfunc_t checkfunc, zthr_func_t *func, void *arg); extern zthr_t *zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_func_t *func, void *arg, hrtime_t nano_wait); - -extern void zthr_exit(zthr_t *t, int rc); extern void zthr_destroy(zthr_t *t); extern void zthr_wakeup(zthr_t *t); -extern int zthr_cancel(zthr_t *t); +extern void zthr_cancel(zthr_t *t); extern void zthr_resume(zthr_t *t); extern boolean_t zthr_iscancelled(zthr_t *t); -extern boolean_t zthr_isrunning(zthr_t *t); #endif /* _SYS_ZTHR_H */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Nov 6 08:37:55 2019 (r354376) @@ -642,7 +642,7 @@ spa_condense_indirect_thread_check(void *arg, zthr_t * } /* ARGSUSED */ -static int +static void spa_condense_indirect_thread(void *arg, zthr_t *zthr) { spa_t *spa = arg; @@ -739,13 +739,11 @@ spa_condense_indirect_thread(void *arg, zthr_t *zthr) * shutting down. */ if (zthr_iscancelled(zthr)) - return (0); + return; VERIFY0(dsl_sync_task(spa_name(spa), NULL, spa_condense_indirect_complete_sync, sci, 0, ZFS_SPACE_CHECK_EXTRA_RESERVED)); - - return (0); } /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Wed Nov 6 08:36:12 2019 (r354375) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c Wed Nov 6 08:37:55 2019 (r354376) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, 2019 by Delphix. All rights reserved. */ /* @@ -28,7 +28,7 @@ * * 1] The operation needs to run over multiple txgs. * 2] There is be a single point of reference in memory or on disk that - * indicates whether the operation should run/is running or is + * indicates whether the operation should run/is running or has * stopped. * * If the operation satisfies the above then the following rules guarantee @@ -51,6 +51,9 @@ * during creation to wakeup on it's own after a specified interval * [see zthr_create_timer()]. * + * Note: ZTHR threads are NOT a replacement for generic threads! Please + * ensure that they fit your use-case well before using them. + * * == ZTHR creation * * Every zthr needs three inputs to start running: @@ -64,17 +67,17 @@ * 2] A user-defined ZTHR function (func) which the zthr executes when * it is not sleeping. The function should adhere to the following * signature type: - * int func_name(void *args, zthr_t *t); + * void func_name(void *args, zthr_t *t); * * 3] A void args pointer that will be passed to checkfunc and func * implicitly by the infrastructure. * * The reason why the above API needs two different functions, * instead of one that both checks and does the work, has to do with - * the zthr's internal lock (zthr_lock) and the allowed cancellation - * windows. We want to hold the zthr_lock while running checkfunc - * but not while running func. This way the zthr can be cancelled - * while doing work and not while checking for work. + * the zthr's internal state lock (zthr_state_lock) and the allowed + * cancellation windows. We want to hold the zthr_state_lock while + * running checkfunc but not while running func. This way the zthr + * can be cancelled while doing work and not while checking for work. * * To start a zthr: * zthr_t *zthr_pointer = zthr_create(checkfunc, func, args); @@ -83,7 +86,7 @@ * args, max_sleep); * * After that you should be able to wakeup, cancel, and resume the - * zthr from another thread using zthr_pointer. + * zthr from another thread using the zthr_pointer. * * NOTE: ZTHR threads could potentially wake up spuriously and the * user should take this into account when writing a checkfunc. @@ -102,8 +105,8 @@ * zthr_resume(zthr_pointer); * * A zthr will implicitly check if it has received a cancellation - * signal every time func returns and everytime it wakes up [see ZTHR - * state transitions below]. + * signal every time func returns and every time it wakes up [see + * ZTHR state transitions below]. * * At times, waiting for the zthr's func to finish its job may take * time. This may be very time-consuming for some operations that @@ -119,17 +122,8 @@ * while (!work_done && !zthr_iscancelled(t)) { * ... ... * } - * return (0); * } * - * == ZTHR exit - * - * For the rare cases where the zthr wants to stop running voluntarily - * while running its ZTHR function (func), we provide zthr_exit(). - * When a zthr has voluntarily stopped running, it can be resumed with - * zthr_resume(), just like it would if it was cancelled by some other - * thread. - * * == ZTHR cleanup * * Cancelling a zthr doesn't clean up its metadata (internal locks, @@ -165,49 +159,86 @@ * v * zthr stopped running * + * == Implementation of ZTHR requests + * + * ZTHR wakeup, cancel, and resume are requests on a zthr to + * change its internal state. Requests on a zthr are serialized + * using the zthr_request_lock, while changes in its internal + * state are protected by the zthr_state_lock. A request will + * first acquire the zthr_request_lock and then immediately + * acquire the zthr_state_lock. We do this so that incoming + * requests are serialized using the request lock, while still + * allowing us to use the state lock for thread communication + * via zthr_cv. */ #include #include -void -zthr_exit(zthr_t *t, int rc) -{ - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - t->zthr_thread = NULL; - t->zthr_rc = rc; - cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); - thread_exit(); -} +struct zthr { + /* running thread doing the work */ + kthread_t *zthr_thread; + /* lock protecting internal data & invariants */ + kmutex_t zthr_state_lock; + + /* mutex that serializes external requests */ + kmutex_t zthr_request_lock; + + /* notification mechanism for requests */ + kcondvar_t zthr_cv; + + /* flag set to true if we are canceling the zthr */ + boolean_t zthr_cancel; + + /* + * maximum amount of time that the zthr is spent sleeping; + * if this is 0, the thread doesn't wake up until it gets + * signaled. + */ + hrtime_t zthr_wait_time; + + /* consumer-provided callbacks & data */ + zthr_checkfunc_t *zthr_checkfunc; + zthr_func_t *zthr_func; + void *zthr_arg; +}; + static void zthr_procedure(void *arg) { zthr_t *t = arg; - int rc = 0; - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); + ASSERT3P(t->zthr_thread, ==, curthread); + while (!t->zthr_cancel) { if (t->zthr_checkfunc(t->zthr_arg, t)) { - mutex_exit(&t->zthr_lock); - rc = t->zthr_func(t->zthr_arg, t); - mutex_enter(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + t->zthr_func(t->zthr_arg, t); + mutex_enter(&t->zthr_state_lock); } else { /* go to sleep */ if (t->zthr_wait_time == 0) { - cv_wait(&t->zthr_cv, &t->zthr_lock); + cv_wait(&t->zthr_cv, &t->zthr_state_lock); } else { (void) cv_timedwait_hires(&t->zthr_cv, - &t->zthr_lock, t->zthr_wait_time, + &t->zthr_state_lock, t->zthr_wait_time, MSEC2NSEC(1), 0); } } } - mutex_exit(&t->zthr_lock); - zthr_exit(t, rc); + /* + * Clear out the kernel thread metadata and notify the + * zthr_cancel() thread that we've stopped running. + */ + t->zthr_thread = NULL; + t->zthr_cancel = B_FALSE; + cv_broadcast(&t->zthr_cv); + + mutex_exit(&t->zthr_state_lock); + thread_exit(); } zthr_t * @@ -226,10 +257,11 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void *arg, hrtime_t max_sleep) { zthr_t *t = kmem_zalloc(sizeof (*t), KM_SLEEP); - mutex_init(&t->zthr_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_state_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&t->zthr_request_lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&t->zthr_cv, NULL, CV_DEFAULT, NULL); - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_state_lock); t->zthr_checkfunc = checkfunc; t->zthr_func = func; t->zthr_arg = arg; @@ -237,7 +269,7 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, 0, &p0, TS_RUN, minclsyspri); - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); return (t); } @@ -245,71 +277,130 @@ zthr_create_timer(zthr_checkfunc_t *checkfunc, zthr_fu void zthr_destroy(zthr_t *t) { + ASSERT(!MUTEX_HELD(&t->zthr_state_lock)); + ASSERT(!MUTEX_HELD(&t->zthr_request_lock)); VERIFY3P(t->zthr_thread, ==, NULL); - mutex_destroy(&t->zthr_lock); + mutex_destroy(&t->zthr_request_lock); + mutex_destroy(&t->zthr_state_lock); cv_destroy(&t->zthr_cv); kmem_free(t, sizeof (*t)); } /* - * Note: If the zthr is not sleeping and misses the wakeup - * (e.g it is running its ZTHR function), it will check if - * there is work to do before going to sleep using its checker - * function [see ZTHR state transition in ZTHR block comment]. - * Thus, missing the wakeup still yields the expected behavior. + * Wake up the zthr if it is sleeping. If the thread has been + * cancelled that does nothing. */ void zthr_wakeup(zthr_t *t) { - mutex_enter(&t->zthr_lock); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); + + /* + * There are 4 states that we can find the zthr when issuing + * this broadcast: + * + * [1] The common case of the thread being asleep, at which + * point the broadcast will wake it up. + * [2] The thread has been cancelled. Waking up a cancelled + * thread is a no-op. Any work that is still left to be + * done should be handled the next time the thread is + * resumed. + * [3] The thread is doing work and is already up, so this + * is basically a no-op. + * [4] The thread was just created/resumed, in which case the + * behavior is similar to [3]. + */ cv_broadcast(&t->zthr_cv); - mutex_exit(&t->zthr_lock); + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* - * Note: If the zthr is not running (e.g. has been cancelled + * Sends a cancel request to the zthr and blocks until the zthr is + * cancelled. If the zthr is not running (e.g. has been cancelled * already), this is a no-op. */ -int +void zthr_cancel(zthr_t *t) { - int rc = 0; + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); + /* + * Since we are holding the zthr_state_lock at this point + * we can find the state in one of the following 4 states: + * + * [1] The thread has already been cancelled, therefore + * there is nothing for us to do. + * [2] The thread is sleeping, so we broadcast the CV first + * to wake it up and then we set the flag and we are + * waiting for it to exit. + * [3] The thread is doing work, in which case we just set + * the flag and wait for it to finish. + * [4] The thread was just created/resumed, in which case + * the behavior is similar to [3]. + * + * Since requests are serialized, by the time that we get + * control back we expect that the zthr is cancelled and + * not running anymore. + */ + if (t->zthr_thread != NULL) { + t->zthr_cancel = B_TRUE; - /* broadcast in case the zthr is sleeping */ - cv_broadcast(&t->zthr_cv); + /* broadcast in case the zthr is sleeping */ + cv_broadcast(&t->zthr_cv); - t->zthr_cancel = B_TRUE; - while (t->zthr_thread != NULL) - cv_wait(&t->zthr_cv, &t->zthr_lock); - t->zthr_cancel = B_FALSE; - rc = t->zthr_rc; - mutex_exit(&t->zthr_lock); + while (t->zthr_thread != NULL) + cv_wait(&t->zthr_cv, &t->zthr_state_lock); - return (rc); + ASSERT(!t->zthr_cancel); + } + + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } +/* + * Sends a resume request to the supplied zthr. If the zthr is + * already running this is a no-op. + */ void zthr_resume(zthr_t *t) { - ASSERT3P(t->zthr_thread, ==, NULL); + mutex_enter(&t->zthr_request_lock); + mutex_enter(&t->zthr_state_lock); - mutex_enter(&t->zthr_lock); - ASSERT3P(&t->zthr_checkfunc, !=, NULL); ASSERT3P(&t->zthr_func, !=, NULL); ASSERT(!t->zthr_cancel); - t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, - 0, &p0, TS_RUN, minclsyspri); + /* + * There are 4 states that we find the zthr in at this point + * given the locks that we hold: + * + * [1] The zthr was cancelled, so we spawn a new thread for + * the zthr (common case). + * [2] The zthr is running at which point this is a no-op. + * [3] The zthr is sleeping at which point this is a no-op. + * [4] The zthr was just spawned at which point this is a + * no-op. + */ + if (t->zthr_thread == NULL) { + t->zthr_thread = thread_create(NULL, 0, zthr_procedure, t, + 0, &p0, TS_RUN, minclsyspri); + } - mutex_exit(&t->zthr_lock); + mutex_exit(&t->zthr_state_lock); + mutex_exit(&t->zthr_request_lock); } /* * This function is intended to be used by the zthr itself - * to check if another thread has signal it to stop running. + * (specifically the zthr_func callback provided) to check + * if another thread has signaled it to stop running before + * doing some expensive operation. * * returns TRUE if we are in the middle of trying to cancel * this thread. @@ -319,25 +410,22 @@ zthr_resume(zthr_t *t) boolean_t zthr_iscancelled(zthr_t *t) { - boolean_t cancelled; - ASSERT3P(t->zthr_thread, ==, curthread); - mutex_enter(&t->zthr_lock); - cancelled = t->zthr_cancel; - mutex_exit(&t->zthr_lock); - + /* + * The majority of the functions here grab zthr_request_lock + * first and then zthr_state_lock. This function only grabs + * the zthr_state_lock. That is because this function should + * only be called from the zthr_func to check if someone has + * issued a zthr_cancel() on the thread. If there is a zthr_cancel() + * happening concurrently, attempting to grab the request lock + * here would result in a deadlock. + * + * By grabbing only the zthr_state_lock this function is allowed + * to run concurrently with a zthr_cancel() request. + */ + mutex_enter(&t->zthr_state_lock); + boolean_t cancelled = t->zthr_cancel; + mutex_exit(&t->zthr_state_lock); return (cancelled); -} - -boolean_t -zthr_isrunning(zthr_t *t) -{ - boolean_t running; - - mutex_enter(&t->zthr_lock); - running = (t->zthr_thread != NULL); - mutex_exit(&t->zthr_lock); - - return (running); } From owner-svn-src-all@freebsd.org Wed Nov 6 08:44:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 718721AE6FD; Wed, 6 Nov 2019 08:44:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477KpX2Mpzz3HZR; Wed, 6 Nov 2019 08:44:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30748227F1; Wed, 6 Nov 2019 08:44:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68iavL040498; Wed, 6 Nov 2019 08:44:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68iZ0Z040496; Wed, 6 Nov 2019 08:44:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060844.xA68iZ0Z040496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:44:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354377 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzfs_core/common vendo... X-SVN-Commit-Revision: 354377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:44:36 -0000 Author: avg Date: Wed Nov 6 08:44:35 2019 New Revision: 354377 URL: https://svnweb.freebsd.org/changeset/base/354377 Log: 10554 Implemented zpool sync command illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220 https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220 https://www.illumos.org/issues/10554 During the port of MMP (illumos bug 10499) from ZoL, I found this earlier ZoL project is a prerequisite. Here is the original description. This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to 'sync(2)' but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the 'sync(2)' cmd. Portions contributed by: Jerry Jelinek Author: Alek Pinchuk Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zpool.1m Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 6 08:37:55 2019 (r354376) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Nov 6 08:44:35 2019 (r354377) @@ -5522,6 +5522,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_ static int zfs_ioc_get_holds(const char *snapname, nvlist_t *args, nvlist_t *outnvl) { + ASSERT3P(args, ==, NULL); return (dsl_dataset_get_holds(snapname, outnvl)); } @@ -5790,6 +5791,44 @@ out: return (error); } +/* + * Sync the currently open TXG to disk for the specified pool. + * This is somewhat similar to 'zfs_sync()'. + * For cases that do not result in error this ioctl will wait for + * the currently open TXG to commit before returning back to the caller. + * + * innvl: { + * "force" -> when true, force uberblock update even if there is no dirty data. + * In addition this will cause the vdev configuration to be written + * out including updating the zpool cache file. (boolean_t) + * } + * + * onvl is unused + */ +/* ARGSUSED */ +static int +zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl) +{ + int err; + boolean_t force; + spa_t *spa; + + if ((err = spa_open(pool, &spa, FTAG)) != 0) + return (err); + + force = fnvlist_lookup_boolean_value(innvl, "force"); + if (force) { + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER); + vdev_config_dirty(spa->spa_root_vdev); + spa_config_exit(spa, SCL_CONFIG, FTAG); + } + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_close(spa, FTAG); + + return (err); +} + static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST]; static void @@ -5979,6 +6018,10 @@ zfs_ioctl_init(void) zfs_ioctl_register("initialize", ZFS_IOC_POOL_INITIALIZE, zfs_ioc_pool_initialize, zfs_secpolicy_config, POOL_NAME, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_TRUE, B_TRUE); + + zfs_ioctl_register("sync", ZFS_IOC_POOL_SYNC, + zfs_ioc_pool_sync, zfs_secpolicy_none, POOL_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_FALSE); /* IOCTLS that use the legacy function signature */ Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Wed Nov 6 08:37:55 2019 (r354376) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Wed Nov 6 08:44:35 2019 (r354377) @@ -988,6 +988,7 @@ typedef enum zfs_ioc { ZFS_IOC_POOL_CHECKPOINT, ZFS_IOC_POOL_DISCARD_CHECKPOINT, ZFS_IOC_POOL_INITIALIZE, + ZFS_IOC_POOL_SYNC, ZFS_IOC_LAST } zfs_ioc_t; From owner-svn-src-all@freebsd.org Wed Nov 6 08:44:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFD9D1AE703; Wed, 6 Nov 2019 08:44:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477KpY473lz3HZW; Wed, 6 Nov 2019 08:44:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72725227F3; Wed, 6 Nov 2019 08:44:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68ibtS040509; Wed, 6 Nov 2019 08:44:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68ia9d040503; Wed, 6 Nov 2019 08:44:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060844.xA68ia9d040503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354377 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zpool vendor/illumos/dist/lib/libzfs/common vendor/illumos/dist/lib/libzfs_core/common vendo... X-SVN-Commit-Revision: 354377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:44:37 -0000 Author: avg Date: Wed Nov 6 08:44:35 2019 New Revision: 354377 URL: https://svnweb.freebsd.org/changeset/base/354377 Log: 10554 Implemented zpool sync command illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220 https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220 https://www.illumos.org/issues/10554 During the port of MMP (illumos bug 10499) from ZoL, I found this earlier ZoL project is a prerequisite. Here is the original description. This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to 'sync(2)' but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the 'sync(2)' cmd. Portions contributed by: Jerry Jelinek Author: Alek Pinchuk Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h vendor/illumos/dist/man/man1m/zpool.1m Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:44:35 2019 (r354377) @@ -97,6 +97,8 @@ static int zpool_do_history(int, char **); static int zpool_do_get(int, char **); static int zpool_do_set(int, char **); +static int zpool_do_sync(int, char **); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -141,6 +143,7 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, + HELP_SYNC, HELP_REGUID, HELP_REOPEN } zpool_help_t; @@ -197,6 +200,7 @@ static zpool_command_t command_table[] = { { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, { "set", zpool_do_set, HELP_SET }, + { "sync", zpool_do_sync, HELP_SYNC }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -283,6 +287,8 @@ get_usage(zpool_help_t idx) "[ ...]\n")); case HELP_REGUID: return (gettext("\treguid \n")); + case HELP_SYNC: + return (gettext("\tsync [pool] ...\n")); } abort(); @@ -2614,6 +2620,45 @@ error: free(searchdirs); return (err ? 1 : 0); +} + +/* + * zpool sync [-f] [pool] ... + * + * -f (undocumented) force uberblock (and config including zpool cache file) + * update. + * + * Sync the specified pool(s). + * Without arguments "zpool sync" will sync all pools. + * This command initiates TXG sync(s) and will return after the TXG(s) commit. + * + */ +static int +zpool_do_sync(int argc, char **argv) +{ + int ret; + boolean_t force = B_FALSE; + + /* check options */ + while ((ret = getopt(argc, argv, "f")) != -1) { + switch (ret) { + case 'f': + force = B_TRUE; + break; + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* if argc == 0 we will execute zpool_sync_one on all pools */ + ret = for_each_pool(argc, argv, B_FALSE, NULL, zpool_sync_one, &force); + + return (ret); } typedef struct iostat_cbdata { Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Nov 6 08:44:35 2019 (r354377) @@ -269,6 +269,8 @@ extern int zpool_clear(zpool_handle_t *, const char *, extern int zpool_reguid(zpool_handle_t *); extern int zpool_reopen(zpool_handle_t *); +extern int zpool_sync_one(zpool_handle_t *, void *); + extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c Wed Nov 6 08:44:35 2019 (r354377) @@ -3504,6 +3504,27 @@ zpool_reopen(zpool_handle_t *zhp) return (zpool_standard_error(hdl, errno, msg)); } +/* call into libzfs_core to execute the sync IOCTL per pool */ +int +zpool_sync_one(zpool_handle_t *zhp, void *data) +{ + int ret; + libzfs_handle_t *hdl = zpool_get_handle(zhp); + const char *pool_name = zpool_get_name(zhp); + boolean_t *force = data; + nvlist_t *innvl = fnvlist_alloc(); + + fnvlist_add_boolean_value(innvl, "force", *force); + if ((ret = lzc_sync(pool_name, innvl, NULL)) != 0) { + nvlist_free(innvl); + return (zpool_standard_error_fmt(hdl, ret, + dgettext(TEXT_DOMAIN, "sync '%s' failed"), pool_name)); + } + nvlist_free(innvl); + + return (0); +} + /* * Convert from a devid string to a path. */ Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Nov 6 08:44:35 2019 (r354377) @@ -24,6 +24,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ /* @@ -128,17 +129,20 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, { zfs_cmd_t zc = { 0 }; int error = 0; - char *packed; - size_t size; + char *packed = NULL; + size_t size = 0; ASSERT3S(g_refcount, >, 0); VERIFY3S(g_fd, !=, -1); - (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); + if (name != NULL) + (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); - packed = fnvlist_pack(source, &size); - zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; - zc.zc_nvlist_src_size = size; + if (source != NULL) { + packed = fnvlist_pack(source, &size); + zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; + zc.zc_nvlist_src_size = size; + } if (resultp != NULL) { *resultp = NULL; @@ -416,6 +420,18 @@ lzc_exists(const char *dataset) } /* + * outnvl is unused. + * It was added to preserve the function signature in case it is + * needed in the future. + */ +/*ARGSUSED*/ +int +lzc_sync(const char *pool_name, nvlist_t *innvl, nvlist_t **outnvl) +{ + return (lzc_ioctl(ZFS_IOC_POOL_SYNC, pool_name, innvl, NULL)); +} + +/* * Create "user holds" on snapshots. If there is a hold on a snapshot, * the snapshot can not be destroyed. (However, it can be marked for deletion * by lzc_destroy_snaps(defer=B_TRUE).) @@ -515,11 +531,7 @@ lzc_release(nvlist_t *holds, nvlist_t **errlist) int lzc_get_holds(const char *snapname, nvlist_t **holdsp) { - int error; - nvlist_t *innvl = fnvlist_alloc(); - error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp); - fnvlist_free(innvl); - return (error); + return (lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, NULL, holdsp)); } /* Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Nov 6 08:44:35 2019 (r354377) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_CORE_H @@ -90,6 +91,8 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); + +int lzc_sync(const char *, nvlist_t *, nvlist_t **); int lzc_rename(const char *, const char *); int lzc_destroy(const char *); Modified: vendor/illumos/dist/man/man1m/zpool.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:37:55 2019 (r354376) +++ vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:44:35 2019 (r354377) @@ -174,6 +174,9 @@ .Oo Ar pool Oc Ns ... .Op Ar interval Op Ar count .Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Nm .Cm upgrade .Nm .Cm upgrade @@ -1780,6 +1783,19 @@ Only display status for pools that are exhibiting erro unavailable. Warnings about pools not using the latest on-disk format will not be included. .El +.It Xo +.Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Xc +Forces all in-core dirty data to be written to the primary pool storage and +not the ZIL. +It will also update administrative information including quota reporting. +Without arguments, +.Nm zpool Cm sync +will sync all pools on the system. +Otherwise, it will only sync the specified +.Ar pool . .It Xo .Nm .Cm upgrade From owner-svn-src-all@freebsd.org Wed Nov 6 08:46:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2554E1AE8E7; Wed, 6 Nov 2019 08:46:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Krf0kvXz3J5M; Wed, 6 Nov 2019 08:46:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0677227F9; Wed, 6 Nov 2019 08:46:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68kPNh040873; Wed, 6 Nov 2019 08:46:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68kOqc040866; Wed, 6 Nov 2019 08:46:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060846.xA68kOqc040866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354378 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumo... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs ... X-SVN-Commit-Revision: 354378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:46:26 -0000 Author: avg Date: Wed Nov 6 08:46:24 2019 New Revision: 354378 URL: https://svnweb.freebsd.org/changeset/base/354378 Log: 10499 Multi-modifier protection (MMP) illumos/illumos-gate@e0f1c0afa46cc84d4b1e40124032a9a87310386e https://github.com/illumos/illumos-gate/commit/e0f1c0afa46cc84d4b1e40124032a9a87310386e https://www.illumos.org/issues/10499 Port the following ZFS commits from ZoL to illumos. 379ca9cf2 Multi-modifier protection (MMP) bbffb59ef Fix multihost stale cache file import 0d398b256 Do not initiate MMP writes while pool is suspended Portions contributed by: Jerry Jelinek Portions contributed by: Tim Chase Portions contributed by: sanjeevbagewadi Portions contributed by: John L. Hammond Portions contributed by: Giuseppe Di Natale Portions contributed by: Prakash Surya Author: Olaf Faaland Added: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.h vendor-sys/illumos/dist/common/zfs/zpool_prop.c vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zhack/zhack.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_status.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/man/man1m/zpool.1m Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_comutil.h Wed Nov 6 08:44:35 2019 (r354377) +++ vendor-sys/illumos/dist/common/zfs/zfs_comutil.h Wed Nov 6 08:46:24 2019 (r354378) @@ -21,6 +21,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2017 by Delphix. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #ifndef _ZFS_COMUTIL_H @@ -32,6 +33,9 @@ #ifdef __cplusplus extern "C" { #endif + +/* Needed for ZoL errno usage in MMP kernel and user code */ +#define EREMOTEIO EREMOTE extern boolean_t zfs_allocatable_devs(nvlist_t *); extern void zpool_get_load_policy(nvlist_t *, zpool_load_policy_t *); Modified: vendor-sys/illumos/dist/common/zfs/zpool_prop.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zpool_prop.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor-sys/illumos/dist/common/zfs/zpool_prop.c Wed Nov 6 08:46:24 2019 (r354378) @@ -125,6 +125,9 @@ zpool_prop_init(void) PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "EXPAND", boolean_table); zprop_register_index(ZPOOL_PROP_READONLY, "readonly", 0, PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "RDONLY", boolean_table); + zprop_register_index(ZPOOL_PROP_MULTIHOST, "multihost", 0, + PROP_DEFAULT, ZFS_TYPE_POOL, "on | off", "MULTIHOST", + boolean_table); /* default index properties */ zprop_register_index(ZPOOL_PROP_FAILUREMODE, "failmode", Modified: vendor-sys/illumos/dist/uts/common/Makefile.files ============================================================================== --- vendor-sys/illumos/dist/uts/common/Makefile.files Wed Nov 6 08:44:35 2019 (r354377) +++ vendor-sys/illumos/dist/uts/common/Makefile.files Wed Nov 6 08:46:24 2019 (r354378) @@ -1376,6 +1376,7 @@ ZFS_COMMON_OBJS += \ lz4.o \ lzjb.o \ metaslab.o \ + mmp.o \ multilist.o \ range_tree.o \ refcount.o \ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c Wed Nov 6 08:46:24 2019 (r354378) @@ -50,6 +50,7 @@ #include #include #include +#include /* * ZFS Write Throttle @@ -192,6 +193,7 @@ dsl_pool_open_impl(spa_t *spa, uint64_t txg) dp->dp_meta_rootbp = *bp; rrw_init(&dp->dp_config_rwlock, B_TRUE); txg_init(dp, txg); + mmp_init(spa); txg_list_create(&dp->dp_dirty_datasets, spa, offsetof(dsl_dataset_t, ds_dirty_link)); @@ -393,6 +395,7 @@ dsl_pool_close(dsl_pool_t *dp) */ arc_flush(dp->dp_spa, FALSE); + mmp_fini(dp->dp_spa); txg_fini(dp); dsl_scan_fini(dp); dmu_buf_user_evict_wait(); Added: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c Wed Nov 6 08:46:24 2019 (r354378) @@ -0,0 +1,582 @@ +/* + * 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) 2017 by Lawrence Livermore National Security, LLC. + * Copyright 2019 Joyent, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Multi-Modifier Protection (MMP) attempts to prevent a user from importing + * or opening a pool on more than one host at a time. In particular, it + * prevents "zpool import -f" on a host from succeeding while the pool is + * already imported on another host. There are many other ways in which a + * device could be used by two hosts for different purposes at the same time + * resulting in pool damage. This implementation does not attempt to detect + * those cases. + * + * MMP operates by ensuring there are frequent visible changes on disk (a + * "heartbeat") at all times. And by altering the import process to check + * for these changes and failing the import when they are detected. This + * functionality is enabled by setting the 'multihost' pool property to on. + * + * Uberblocks written by the txg_sync thread always go into the first + * (N-MMP_BLOCKS_PER_LABEL) slots, the remaining slots are reserved for MMP. + * They are used to hold uberblocks which are exactly the same as the last + * synced uberblock except that the ub_timestamp is frequently updated. + * Like all other uberblocks, the slot is written with an embedded checksum, + * and slots with invalid checksums are ignored. This provides the + * "heartbeat", with no risk of overwriting good uberblocks that must be + * preserved, e.g. previous txgs and associated block pointers. + * + * Two optional fields are added to uberblock structure: ub_mmp_magic and + * ub_mmp_delay. The magic field allows zfs to tell whether ub_mmp_delay is + * valid. The delay field is a decaying average of the amount of time between + * completion of successive MMP writes, in nanoseconds. It is used to predict + * how long the import must wait to detect activity in the pool, before + * concluding it is not in use. + * + * During import an activity test may now be performed to determine if + * the pool is in use. The activity test is typically required if the + * ZPOOL_CONFIG_HOSTID does not match the system hostid, the pool state is + * POOL_STATE_ACTIVE, and the pool is not a root pool. + * + * The activity test finds the "best" uberblock (highest txg & timestamp), + * waits some time, and then finds the "best" uberblock again. If the txg + * and timestamp in both "best" uberblocks do not match, the pool is in use + * by another host and the import fails. Since the granularity of the + * timestamp is in seconds this activity test must take a bare minimum of one + * second. In order to assure the accuracy of the activity test, the default + * values result in an activity test duration of 10x the mmp write interval. + * + * The "zpool import" activity test can be expected to take a minimum time of + * zfs_multihost_import_intervals * zfs_multihost_interval milliseconds. If the + * "best" uberblock has a valid ub_mmp_delay field, then the duration of the + * test may take longer if MMP writes were occurring less frequently than + * expected. Additionally, the duration is then extended by a random 25% to + * attempt to to detect simultaneous imports. For example, if both partner + * hosts are rebooted at the same time and automatically attempt to import the + * pool. + */ + +/* + * Used to control the frequency of mmp writes which are performed when the + * 'multihost' pool property is on. This is one factor used to determine the + * length of the activity check during import. + * + * The mmp write period is zfs_multihost_interval / leaf-vdevs milliseconds. + * This means that on average an mmp write will be issued for each leaf vdev + * every zfs_multihost_interval milliseconds. In practice, the observed period + * can vary with the I/O load and this observed value is the delay which is + * stored in the uberblock. The minimum allowed value is 100 ms. + */ +ulong_t zfs_multihost_interval = MMP_DEFAULT_INTERVAL; + +/* + * Used to control the duration of the activity test on import. Smaller values + * of zfs_multihost_import_intervals will reduce the import time but increase + * the risk of failing to detect an active pool. The total activity check time + * is never allowed to drop below one second. A value of 0 is ignored and + * treated as if it was set to 1. + */ +uint_t zfs_multihost_import_intervals = MMP_DEFAULT_IMPORT_INTERVALS; + +/* + * Controls the behavior of the pool when mmp write failures are detected. + * + * When zfs_multihost_fail_intervals = 0 then mmp write failures are ignored. + * The failures will still be reported to the ZED which depending on its + * configuration may take action such as suspending the pool or taking a + * device offline. + * + * When zfs_multihost_fail_intervals > 0 then sequential mmp write failures will + * cause the pool to be suspended. This occurs when + * zfs_multihost_fail_intervals * zfs_multihost_interval milliseconds have + * passed since the last successful mmp write. This guarantees the activity + * test will see mmp writes if the + * pool is imported. + */ +uint_t zfs_multihost_fail_intervals = MMP_DEFAULT_FAIL_INTERVALS; + +char *mmp_tag = "mmp_write_uberblock"; +static void mmp_thread(void *arg); + +void +mmp_init(spa_t *spa) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + mutex_init(&mmp->mmp_thread_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&mmp->mmp_thread_cv, NULL, CV_DEFAULT, NULL); + mutex_init(&mmp->mmp_io_lock, NULL, MUTEX_DEFAULT, NULL); + mmp->mmp_kstat_id = 1; +} + +void +mmp_fini(spa_t *spa) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + mutex_destroy(&mmp->mmp_thread_lock); + cv_destroy(&mmp->mmp_thread_cv); + mutex_destroy(&mmp->mmp_io_lock); +} + +static void +mmp_thread_enter(mmp_thread_t *mmp, callb_cpr_t *cpr) +{ + CALLB_CPR_INIT(cpr, &mmp->mmp_thread_lock, callb_generic_cpr, FTAG); + mutex_enter(&mmp->mmp_thread_lock); +} + +static void +mmp_thread_exit(mmp_thread_t *mmp, kthread_t **mpp, callb_cpr_t *cpr) +{ + ASSERT(*mpp != NULL); + *mpp = NULL; + cv_broadcast(&mmp->mmp_thread_cv); + CALLB_CPR_EXIT(cpr); /* drops &mmp->mmp_thread_lock */ + thread_exit(); +} + +void +mmp_thread_start(spa_t *spa) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + if (spa_writeable(spa)) { + mutex_enter(&mmp->mmp_thread_lock); + if (!mmp->mmp_thread) { + dprintf("mmp_thread_start pool %s\n", + spa->spa_name); + mmp->mmp_thread = thread_create(NULL, 0, mmp_thread, + spa, 0, &p0, TS_RUN, minclsyspri); + } + mutex_exit(&mmp->mmp_thread_lock); + } +} + +void +mmp_thread_stop(spa_t *spa) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + mutex_enter(&mmp->mmp_thread_lock); + mmp->mmp_thread_exiting = 1; + cv_broadcast(&mmp->mmp_thread_cv); + + while (mmp->mmp_thread) { + cv_wait(&mmp->mmp_thread_cv, &mmp->mmp_thread_lock); + } + mutex_exit(&mmp->mmp_thread_lock); + + ASSERT(mmp->mmp_thread == NULL); + mmp->mmp_thread_exiting = 0; +} + +typedef enum mmp_vdev_state_flag { + MMP_FAIL_NOT_WRITABLE = (1 << 0), + MMP_FAIL_WRITE_PENDING = (1 << 1), +} mmp_vdev_state_flag_t; + +/* + * Find a leaf vdev to write an MMP block to. It must not have an outstanding + * mmp write (if so a new write will also likely block). If there is no usable + * leaf, a nonzero error value is returned. The error value returned is a bit + * field. + * + * MMP_FAIL_WRITE_PENDING One or more leaf vdevs are writeable, but have an + * outstanding MMP write. + * MMP_FAIL_NOT_WRITABLE One or more leaf vdevs are not writeable. + */ + +static int +mmp_next_leaf(spa_t *spa) +{ + vdev_t *leaf; + vdev_t *starting_leaf; + int fail_mask = 0; + + ASSERT(MUTEX_HELD(&spa->spa_mmp.mmp_io_lock)); + ASSERT(spa_config_held(spa, SCL_STATE, RW_READER)); + ASSERT(list_link_active(&spa->spa_leaf_list.list_head) == B_TRUE); + ASSERT(!list_is_empty(&spa->spa_leaf_list)); + + if (spa->spa_mmp.mmp_leaf_last_gen != spa->spa_leaf_list_gen) { + spa->spa_mmp.mmp_last_leaf = list_head(&spa->spa_leaf_list); + spa->spa_mmp.mmp_leaf_last_gen = spa->spa_leaf_list_gen; + } + + leaf = spa->spa_mmp.mmp_last_leaf; + if (leaf == NULL) + leaf = list_head(&spa->spa_leaf_list); + starting_leaf = leaf; + + do { + leaf = list_next(&spa->spa_leaf_list, leaf); + if (leaf == NULL) + leaf = list_head(&spa->spa_leaf_list); + + if (!vdev_writeable(leaf)) { + fail_mask |= MMP_FAIL_NOT_WRITABLE; + } else if (leaf->vdev_mmp_pending != 0) { + fail_mask |= MMP_FAIL_WRITE_PENDING; + } else { + spa->spa_mmp.mmp_last_leaf = leaf; + return (0); + } + } while (leaf != starting_leaf); + + ASSERT(fail_mask); + + return (fail_mask); +} + +/* + * MMP writes are issued on a fixed schedule, but may complete at variable, + * much longer, intervals. The mmp_delay captures long periods between + * successful writes for any reason, including disk latency, scheduling delays, + * etc. + * + * The mmp_delay is usually calculated as a decaying average, but if the latest + * delay is higher we do not average it, so that we do not hide sudden spikes + * which the importing host must wait for. + * + * If writes are occurring frequently, such as due to a high rate of txg syncs, + * the mmp_delay could become very small. Since those short delays depend on + * activity we cannot count on, we never allow mmp_delay to get lower than rate + * expected if only mmp_thread writes occur. + * + * If an mmp write was skipped or fails, and we have already waited longer than + * mmp_delay, we need to update it so the next write reflects the longer delay. + * + * Do not set mmp_delay if the multihost property is not on, so as not to + * trigger an activity check on import. + */ +static void +mmp_delay_update(spa_t *spa, boolean_t write_completed) +{ + mmp_thread_t *mts = &spa->spa_mmp; + hrtime_t delay = gethrtime() - mts->mmp_last_write; + + ASSERT(MUTEX_HELD(&mts->mmp_io_lock)); + + if (spa_multihost(spa) == B_FALSE) { + mts->mmp_delay = 0; + return; + } + + if (delay > mts->mmp_delay) + mts->mmp_delay = delay; + + if (write_completed == B_FALSE) + return; + + mts->mmp_last_write = gethrtime(); + + /* + * strictly less than, in case delay was changed above. + */ + if (delay < mts->mmp_delay) { + hrtime_t min_delay = MSEC2NSEC(zfs_multihost_interval) / + MAX(1, vdev_count_leaves(spa)); + mts->mmp_delay = MAX(((delay + mts->mmp_delay * 127) / 128), + min_delay); + } +} + +static void +mmp_write_done(zio_t *zio) +{ + spa_t *spa = zio->io_spa; + vdev_t *vd = zio->io_vd; + mmp_thread_t *mts = zio->io_private; + + mutex_enter(&mts->mmp_io_lock); + uint64_t mmp_kstat_id = vd->vdev_mmp_kstat_id; + hrtime_t mmp_write_duration = gethrtime() - vd->vdev_mmp_pending; + + mmp_delay_update(spa, (zio->io_error == 0)); + + vd->vdev_mmp_pending = 0; + vd->vdev_mmp_kstat_id = 0; + + mutex_exit(&mts->mmp_io_lock); + spa_config_exit(spa, SCL_STATE, mmp_tag); + + abd_free(zio->io_abd); +} + +/* + * When the uberblock on-disk is updated by a spa_sync, + * creating a new "best" uberblock, update the one stored + * in the mmp thread state, used for mmp writes. + */ +void +mmp_update_uberblock(spa_t *spa, uberblock_t *ub) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + mutex_enter(&mmp->mmp_io_lock); + mmp->mmp_ub = *ub; + mmp->mmp_ub.ub_timestamp = gethrestime_sec(); + mmp_delay_update(spa, B_TRUE); + mutex_exit(&mmp->mmp_io_lock); +} + +/* + * Choose a random vdev, label, and MMP block, and write over it + * with a copy of the last-synced uberblock, whose timestamp + * has been updated to reflect that the pool is in use. + */ +static void +mmp_write_uberblock(spa_t *spa) +{ + int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; + mmp_thread_t *mmp = &spa->spa_mmp; + uberblock_t *ub; + vdev_t *vd = NULL; + int label, error; + uint64_t offset; + + hrtime_t lock_acquire_time = gethrtime(); + spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER); + lock_acquire_time = gethrtime() - lock_acquire_time; + if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10)) + zfs_dbgmsg("SCL_STATE acquisition took %llu ns\n", + (u_longlong_t)lock_acquire_time); + + mutex_enter(&mmp->mmp_io_lock); + + error = mmp_next_leaf(spa); + + /* + * spa_mmp_history has two types of entries: + * Issued MMP write: records time issued, error status, etc. + * Skipped MMP write: an MMP write could not be issued because no + * suitable leaf vdev was available. See comment above struct + * spa_mmp_history for details. + */ + + if (error) { + mmp_delay_update(spa, B_FALSE); + if (mmp->mmp_skip_error == error) { + /* + * ZoL porting note: the following is TBD + * spa_mmp_history_set_skip(spa, mmp->mmp_kstat_id - 1); + */ + } else { + mmp->mmp_skip_error = error; + /* + * ZoL porting note: the following is TBD + * spa_mmp_history_add(spa, mmp->mmp_ub.ub_txg, + * gethrestime_sec(), mmp->mmp_delay, NULL, 0, + * mmp->mmp_kstat_id++, error); + */ + } + mutex_exit(&mmp->mmp_io_lock); + spa_config_exit(spa, SCL_STATE, mmp_tag); + return; + } + + vd = spa->spa_mmp.mmp_last_leaf; + mmp->mmp_skip_error = 0; + + if (mmp->mmp_zio_root == NULL) + mmp->mmp_zio_root = zio_root(spa, NULL, NULL, + flags | ZIO_FLAG_GODFATHER); + + ub = &mmp->mmp_ub; + ub->ub_timestamp = gethrestime_sec(); + ub->ub_mmp_magic = MMP_MAGIC; + ub->ub_mmp_delay = mmp->mmp_delay; + vd->vdev_mmp_pending = gethrtime(); + vd->vdev_mmp_kstat_id = mmp->mmp_kstat_id; + + zio_t *zio = zio_null(mmp->mmp_zio_root, spa, NULL, NULL, NULL, flags); + abd_t *ub_abd = abd_alloc_for_io(VDEV_UBERBLOCK_SIZE(vd), B_TRUE); + abd_zero(ub_abd, VDEV_UBERBLOCK_SIZE(vd)); + abd_copy_from_buf(ub_abd, ub, sizeof (uberblock_t)); + + mmp->mmp_kstat_id++; + mutex_exit(&mmp->mmp_io_lock); + + offset = VDEV_UBERBLOCK_OFFSET(vd, VDEV_UBERBLOCK_COUNT(vd) - + MMP_BLOCKS_PER_LABEL + spa_get_random(MMP_BLOCKS_PER_LABEL)); + + label = spa_get_random(VDEV_LABELS); + vdev_label_write(zio, vd, label, ub_abd, offset, + VDEV_UBERBLOCK_SIZE(vd), mmp_write_done, mmp, + flags | ZIO_FLAG_DONT_PROPAGATE); + + /* + * ZoL porting note: the following is TBD + * (void) spa_mmp_history_add(spa, ub->ub_txg, ub->ub_timestamp, + * ub->ub_mmp_delay, vd, label, vd->vdev_mmp_kstat_id, 0); + */ + + zio_nowait(zio); +} + +static void +mmp_thread(void *arg) +{ + spa_t *spa = (spa_t *)arg; + mmp_thread_t *mmp = &spa->spa_mmp; + boolean_t last_spa_suspended = spa_suspended(spa); + boolean_t last_spa_multihost = spa_multihost(spa); + callb_cpr_t cpr; + hrtime_t max_fail_ns = zfs_multihost_fail_intervals * + MSEC2NSEC(MAX(zfs_multihost_interval, MMP_MIN_INTERVAL)); + + mmp_thread_enter(mmp, &cpr); + + /* + * The mmp_write_done() function calculates mmp_delay based on the + * prior value of mmp_delay and the elapsed time since the last write. + * For the first mmp write, there is no "last write", so we start + * with fake, but reasonable, default non-zero values. + */ + mmp->mmp_delay = MSEC2NSEC(MAX(zfs_multihost_interval, + MMP_MIN_INTERVAL)) / MAX(vdev_count_leaves(spa), 1); + mmp->mmp_last_write = gethrtime() - mmp->mmp_delay; + + while (!mmp->mmp_thread_exiting) { + uint64_t mmp_fail_intervals = zfs_multihost_fail_intervals; + uint64_t mmp_interval = MSEC2NSEC( + MAX(zfs_multihost_interval, MMP_MIN_INTERVAL)); + boolean_t suspended = spa_suspended(spa); + boolean_t multihost = spa_multihost(spa); + hrtime_t next_time; + + if (multihost) + next_time = gethrtime() + mmp_interval / + MAX(vdev_count_leaves(spa), 1); + else + next_time = gethrtime() + + MSEC2NSEC(MMP_DEFAULT_INTERVAL); + + /* + * MMP off => on, or suspended => !suspended: + * No writes occurred recently. Update mmp_last_write to give + * us some time to try. + */ + if ((!last_spa_multihost && multihost) || + (last_spa_suspended && !suspended)) { + mutex_enter(&mmp->mmp_io_lock); + mmp->mmp_last_write = gethrtime(); + mutex_exit(&mmp->mmp_io_lock); + } + + /* + * MMP on => off: + * mmp_delay == 0 tells importing node to skip activity check. + */ + if (last_spa_multihost && !multihost) { + mutex_enter(&mmp->mmp_io_lock); + mmp->mmp_delay = 0; + mutex_exit(&mmp->mmp_io_lock); + } + last_spa_multihost = multihost; + last_spa_suspended = suspended; + + /* + * Smooth max_fail_ns when its factors are decreased, because + * making (max_fail_ns < mmp_interval) results in the pool being + * immediately suspended before writes can occur at the new + * higher frequency. + */ + if ((mmp_interval * mmp_fail_intervals) < max_fail_ns) { + max_fail_ns = ((31 * max_fail_ns) + (mmp_interval * + mmp_fail_intervals)) / 32; + } else { + max_fail_ns = mmp_interval * mmp_fail_intervals; + } + + /* + * Suspend the pool if no MMP write has succeeded in over + * mmp_interval * mmp_fail_intervals nanoseconds. + */ + if (!suspended && mmp_fail_intervals && multihost && + (gethrtime() - mmp->mmp_last_write) > max_fail_ns) { + cmn_err(CE_WARN, "MMP writes to pool '%s' have not " + "succeeded in over %llus; suspending pool", + spa_name(spa), + NSEC2SEC(gethrtime() - mmp->mmp_last_write)); + zio_suspend(spa, NULL, ZIO_SUSPEND_MMP); + } + + if (multihost && !suspended) + mmp_write_uberblock(spa); + + CALLB_CPR_SAFE_BEGIN(&cpr); + (void) cv_timedwait_sig_hrtime(&mmp->mmp_thread_cv, + &mmp->mmp_thread_lock, next_time); + CALLB_CPR_SAFE_END(&cpr, &mmp->mmp_thread_lock); + } + + /* Outstanding writes are allowed to complete. */ + if (mmp->mmp_zio_root) + zio_wait(mmp->mmp_zio_root); + + mmp->mmp_zio_root = NULL; + mmp_thread_exit(mmp, &mmp->mmp_thread, &cpr); +} + +/* + * Signal the MMP thread to wake it, when it is sleeping on + * its cv. Used when some module parameter has changed and + * we want the thread to know about it. + * Only signal if the pool is active and mmp thread is + * running, otherwise there is no thread to wake. + */ +static void +mmp_signal_thread(spa_t *spa) +{ + mmp_thread_t *mmp = &spa->spa_mmp; + + mutex_enter(&mmp->mmp_thread_lock); + if (mmp->mmp_thread) + cv_broadcast(&mmp->mmp_thread_cv); + mutex_exit(&mmp->mmp_thread_lock); +} + +void +mmp_signal_all_threads(void) +{ + spa_t *spa = NULL; + + mutex_enter(&spa_namespace_lock); + while ((spa = spa_next(spa))) { + if (spa->spa_state == POOL_STATE_ACTIVE) + mmp_signal_thread(spa); + } + mutex_exit(&spa_namespace_lock); +} Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 08:46:24 2019 (r354378) @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -546,6 +547,16 @@ spa_prop_validate(spa_t *spa, nvlist_t *props) error = SET_ERROR(EINVAL); break; + case ZPOOL_PROP_MULTIHOST: + error = nvpair_value_uint64(elem, &intval); + if (!error && intval > 1) + error = SET_ERROR(EINVAL); + + if (!error && !spa_get_hostid()) + error = SET_ERROR(ENOTSUP); + + break; + case ZPOOL_PROP_BOOTFS: /* * If the pool version is less than SPA_VERSION_BOOTFS, @@ -1348,6 +1359,9 @@ spa_unload(spa_t *spa) spa_config_exit(spa, SCL_ALL, spa); } + if (spa->spa_mmp.mmp_thread) + mmp_thread_stop(spa); + /* * Wait for any outstanding async I/O to complete. */ @@ -2298,7 +2312,206 @@ vdev_count_verify_zaps(vdev_t *vd) return (total); } +/* + * Determine whether the activity check is required. + */ +static boolean_t +spa_activity_check_required(spa_t *spa, uberblock_t *ub, nvlist_t *label, + nvlist_t *config) +{ + uint64_t state = 0; + uint64_t hostid = 0; + uint64_t tryconfig_txg = 0; + uint64_t tryconfig_timestamp = 0; + nvlist_t *nvinfo; + + if (nvlist_exists(config, ZPOOL_CONFIG_LOAD_INFO)) { + nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO); + (void) nvlist_lookup_uint64(nvinfo, ZPOOL_CONFIG_MMP_TXG, + &tryconfig_txg); + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TIMESTAMP, + &tryconfig_timestamp); + } + + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &state); + + /* + * Disable the MMP activity check - This is used by zdb which + * is intended to be used on potentially active pools. + */ + if (spa->spa_import_flags & ZFS_IMPORT_SKIP_MMP) + return (B_FALSE); + + /* + * Skip the activity check when the MMP feature is disabled. + */ + if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay == 0) + return (B_FALSE); + /* + * If the tryconfig_* values are nonzero, they are the results of an + * earlier tryimport. If they match the uberblock we just found, then + * the pool has not changed and we return false so we do not test a + * second time. + */ + if (tryconfig_txg && tryconfig_txg == ub->ub_txg && + tryconfig_timestamp && tryconfig_timestamp == ub->ub_timestamp) + return (B_FALSE); + + /* + * Allow the activity check to be skipped when importing the pool + * on the same host which last imported it. Since the hostid from + * configuration may be stale use the one read from the label. + */ + if (nvlist_exists(label, ZPOOL_CONFIG_HOSTID)) + hostid = fnvlist_lookup_uint64(label, ZPOOL_CONFIG_HOSTID); + + if (hostid == spa_get_hostid()) + return (B_FALSE); + + /* + * Skip the activity test when the pool was cleanly exported. + */ + if (state != POOL_STATE_ACTIVE) + return (B_FALSE); + + return (B_TRUE); +} + +/* + * Perform the import activity check. If the user canceled the import or + * we detected activity then fail. + */ static int +spa_activity_check(spa_t *spa, uberblock_t *ub, nvlist_t *config) +{ + uint64_t import_intervals = MAX(zfs_multihost_import_intervals, 1); + uint64_t txg = ub->ub_txg; + uint64_t timestamp = ub->ub_timestamp; + uint64_t import_delay = NANOSEC; + hrtime_t import_expire; + nvlist_t *mmp_label = NULL; + vdev_t *rvd = spa->spa_root_vdev; + kcondvar_t cv; + kmutex_t mtx; + int error = 0; + + cv_init(&cv, NULL, CV_DEFAULT, NULL); + mutex_init(&mtx, NULL, MUTEX_DEFAULT, NULL); + mutex_enter(&mtx); + + /* + * If ZPOOL_CONFIG_MMP_TXG is present an activity check was performed + * during the earlier tryimport. If the txg recorded there is 0 then + * the pool is known to be active on another host. + * + * Otherwise, the pool might be in use on another node. Check for + * changes in the uberblocks on disk if necessary. + */ + if (nvlist_exists(config, ZPOOL_CONFIG_LOAD_INFO)) { + nvlist_t *nvinfo = fnvlist_lookup_nvlist(config, + ZPOOL_CONFIG_LOAD_INFO); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_TXG) && + fnvlist_lookup_uint64(nvinfo, ZPOOL_CONFIG_MMP_TXG) == 0) { + vdev_uberblock_load(rvd, ub, &mmp_label); + error = SET_ERROR(EREMOTEIO); + goto out; + } + } + + /* + * Preferentially use the zfs_multihost_interval from the node which + * last imported the pool. This value is stored in an MMP uberblock as. + * + * ub_mmp_delay * vdev_count_leaves() == zfs_multihost_interval + */ + if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay) + import_delay = MAX(import_delay, import_intervals * + ub->ub_mmp_delay * MAX(vdev_count_leaves(spa), 1)); + + /* Apply a floor using the local default values. */ + import_delay = MAX(import_delay, import_intervals * + MSEC2NSEC(MAX(zfs_multihost_interval, MMP_MIN_INTERVAL))); + + zfs_dbgmsg("import_delay=%llu ub_mmp_delay=%llu import_intervals=%u " + "leaves=%u", import_delay, ub->ub_mmp_delay, import_intervals, + vdev_count_leaves(spa)); + + /* Add a small random factor in case of simultaneous imports (0-25%) */ + import_expire = gethrtime() + import_delay + + (import_delay * spa_get_random(250) / 1000); + + while (gethrtime() < import_expire) { + vdev_uberblock_load(rvd, ub, &mmp_label); + + if (txg != ub->ub_txg || timestamp != ub->ub_timestamp) { + error = SET_ERROR(EREMOTEIO); + break; + } + + if (mmp_label) { + nvlist_free(mmp_label); + mmp_label = NULL; + } + + error = cv_timedwait_sig(&cv, &mtx, ddi_get_lbolt() + hz); + if (error != -1) { + error = SET_ERROR(EINTR); + break; + } + error = 0; + } + +out: + mutex_exit(&mtx); + mutex_destroy(&mtx); + cv_destroy(&cv); + + /* + * If the pool is determined to be active store the status in the + * spa->spa_load_info nvlist. If the remote hostname or hostid are + * available from configuration read from disk store them as well. + * This allows 'zpool import' to generate a more useful message. + * + * ZPOOL_CONFIG_MMP_STATE - observed pool status (mandatory) + * ZPOOL_CONFIG_MMP_HOSTNAME - hostname from the active pool + * ZPOOL_CONFIG_MMP_HOSTID - hostid from the active pool + */ + if (error == EREMOTEIO) { + char *hostname = ""; + uint64_t hostid = 0; + + if (mmp_label) { + if (nvlist_exists(mmp_label, ZPOOL_CONFIG_HOSTNAME)) { + hostname = fnvlist_lookup_string(mmp_label, + ZPOOL_CONFIG_HOSTNAME); + fnvlist_add_string(spa->spa_load_info, + ZPOOL_CONFIG_MMP_HOSTNAME, hostname); + } + + if (nvlist_exists(mmp_label, ZPOOL_CONFIG_HOSTID)) { + hostid = fnvlist_lookup_uint64(mmp_label, + ZPOOL_CONFIG_HOSTID); + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_HOSTID, hostid); + } + } + + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_STATE, MMP_STATE_ACTIVE); + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_TXG, 0); + + error = spa_vdev_err(rvd, VDEV_AUX_ACTIVE, EREMOTEIO); + } + + if (mmp_label) + nvlist_free(mmp_label); + + return (error); +} + +static int spa_verify_host(spa_t *spa, nvlist_t *mos_config) { uint64_t hostid; @@ -2548,6 +2761,7 @@ spa_ld_select_uberblock(spa_t *spa, spa_import_type_t vdev_t *rvd = spa->spa_root_vdev; nvlist_t *label; uberblock_t *ub = &spa->spa_uberblock; + boolean_t activity_check = B_FALSE; /* * If we are opening the checkpointed state of the pool by @@ -2590,6 +2804,34 @@ spa_ld_select_uberblock(spa_t *spa, spa_import_type_t (u_longlong_t)ub->ub_txg); /* + * For pools which have the multihost property on determine if the + * pool is truly inactive and can be safely imported. Prevent + * hosts which don't have a hostid set from importing the pool. + */ + activity_check = spa_activity_check_required(spa, ub, label, + spa->spa_config); + if (activity_check) { + if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay && + spa_get_hostid() == 0) { + nvlist_free(label); + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_STATE, MMP_STATE_NO_HOSTID); + return (spa_vdev_err(rvd, VDEV_AUX_ACTIVE, EREMOTEIO)); + } + + int error = spa_activity_check(spa, ub, spa->spa_config); + if (error) { + nvlist_free(label); + return (error); + } + + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_STATE, MMP_STATE_INACTIVE); + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_TXG, ub->ub_txg); + } + + /* * If the pool has an unsupported version we can't open it. */ if (!SPA_VERSION_IS_SUPPORTED(ub->ub_version)) { @@ -3144,6 +3386,7 @@ spa_ld_get_props(spa_t *spa) spa_prop_find(spa, ZPOOL_PROP_DELEGATION, &spa->spa_delegation); spa_prop_find(spa, ZPOOL_PROP_FAILUREMODE, &spa->spa_failmode); spa_prop_find(spa, ZPOOL_PROP_AUTOEXPAND, &spa->spa_autoexpand); + spa_prop_find(spa, ZPOOL_PROP_MULTIHOST, &spa->spa_multihost); spa_prop_find(spa, ZPOOL_PROP_DEDUPDITTO, &spa->spa_dedup_ditto); @@ -3232,6 +3475,18 @@ spa_ld_load_vdev_metadata(spa_t *spa) vdev_t *rvd = spa->spa_root_vdev; /* + * If the 'multihost' property is set, then never allow a pool to + * be imported when the system hostid is zero. The exception to + * this rule is zdb which is always allowed to access pools. + */ + if (spa_multihost(spa) && spa_get_hostid() == 0 && + (spa->spa_import_flags & ZFS_IMPORT_SKIP_MMP) == 0) { + fnvlist_add_uint64(spa->spa_load_info, + ZPOOL_CONFIG_MMP_STATE, MMP_STATE_NO_HOSTID); + return (spa_vdev_err(rvd, VDEV_AUX_ACTIVE, EREMOTEIO)); + } + + /* * If the 'autoreplace' property is set, then post a resource notifying * the ZFS DE that it should not issue any faults for unopenable * devices. We also iterate over the vdevs, and post a sysevent for any @@ -3831,6 +4086,7 @@ spa_load_impl(spa_t *spa, spa_import_type_t type, char */ spa->spa_sync_on = B_TRUE; txg_sync_start(spa->spa_dsl_pool); + mmp_thread_start(spa); /* * Wait for all claims to sync. We sync up to the highest @@ -4354,10 +4610,14 @@ spa_get_stats(const char *name, nvlist_t **config, ZPOOL_CONFIG_ERRCOUNT, spa_get_errlog_size(spa)) == 0); - if (spa_suspended(spa)) + if (spa_suspended(spa)) { VERIFY(nvlist_add_uint64(*config, ZPOOL_CONFIG_SUSPENDED, spa->spa_failmode) == 0); + VERIFY(nvlist_add_uint64(*config, + ZPOOL_CONFIG_SUSPENDED_REASON, + spa->spa_suspended) == 0); + } spa_add_spares(spa, *config); spa_add_l2cache(spa, *config); @@ -4444,18 +4704,6 @@ spa_validate_aux_devs(spa_t *spa, nvlist_t *nvroot, ui goto out; } - /* - * The L2ARC currently only supports disk devices in - * kernel context. For user-level testing, we allow it. - */ -#ifdef _KERNEL *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 08:46:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8194E1AE8EC; Wed, 6 Nov 2019 08:46:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Krg3GDsz3J5Q; Wed, 6 Nov 2019 08:46:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54100227FA; Wed, 6 Nov 2019 08:46:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68kRRX040885; Wed, 6 Nov 2019 08:46:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68kQ6O040878; Wed, 6 Nov 2019 08:46:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060846.xA68kQ6O040878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354378 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumo... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs ... X-SVN-Commit-Revision: 354378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:46:27 -0000 Author: avg Date: Wed Nov 6 08:46:24 2019 New Revision: 354378 URL: https://svnweb.freebsd.org/changeset/base/354378 Log: 10499 Multi-modifier protection (MMP) illumos/illumos-gate@e0f1c0afa46cc84d4b1e40124032a9a87310386e https://github.com/illumos/illumos-gate/commit/e0f1c0afa46cc84d4b1e40124032a9a87310386e https://www.illumos.org/issues/10499 Port the following ZFS commits from ZoL to illumos. 379ca9cf2 Multi-modifier protection (MMP) bbffb59ef Fix multihost stale cache file import 0d398b256 Do not initiate MMP writes while pool is suspended Portions contributed by: Jerry Jelinek Portions contributed by: Tim Chase Portions contributed by: sanjeevbagewadi Portions contributed by: John L. Hammond Portions contributed by: Giuseppe Di Natale Portions contributed by: Prakash Surya Author: Olaf Faaland Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zhack/zhack.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_impl.h vendor/illumos/dist/lib/libzfs/common/libzfs_import.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzfs/common/libzfs_status.c vendor/illumos/dist/lib/libzfs/common/libzfs_util.c vendor/illumos/dist/lib/libzpool/common/kernel.c vendor/illumos/dist/man/man1m/zpool.1m Changes in other areas also in this revision: Added: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c (contents, props changed) vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h (contents, props changed) Modified: vendor-sys/illumos/dist/common/zfs/zfs_comutil.h vendor-sys/illumos/dist/common/zfs/zpool_prop.c vendor-sys/illumos/dist/uts/common/Makefile.files vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_config.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 08:46:24 2019 (r354378) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2017 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. + * Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC. * Copyright 2017 RackTop Systems. */ @@ -2409,6 +2410,13 @@ dump_uberblock(uberblock_t *ub, const char *header, co (void) printf("\tguid_sum = %llu\n", (u_longlong_t)ub->ub_guid_sum); (void) printf("\ttimestamp = %llu UTC = %s", (u_longlong_t)ub->ub_timestamp, asctime(localtime(×tamp))); + + (void) printf("\tmmp_magic = %016llx\n", + (u_longlong_t)ub->ub_mmp_magic); + if (ub->ub_mmp_magic == MMP_MAGIC) + (void) printf("\tmmp_delay = %0llu\n", + (u_longlong_t)ub->ub_mmp_delay); + if (dump_opt['u'] >= 3) { char blkbuf[BP_SPRINTF_LEN]; snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); @@ -2507,6 +2515,12 @@ dump_label_uberblocks(vdev_label_t *lbl, uint64_t ashi if (uberblock_verify(ub)) continue; + + if ((dump_opt['u'] < 4) && + (ub->ub_mmp_magic == MMP_MAGIC) && ub->ub_mmp_delay && + (i >= VDEV_UBERBLOCK_COUNT(&vd) - MMP_BLOCKS_PER_LABEL)) + continue; + (void) snprintf(header, ZDB_MAX_UB_HEADER_SIZE, "Uberblock[%d]\n", i); dump_uberblock(ub, header, ""); @@ -4142,6 +4156,22 @@ verify_device_removal_feature_counts(spa_t *spa) return (ret); } +static void +zdb_set_skip_mmp(char *target) +{ + spa_t *spa; + + /* + * Disable the activity check to allow examination of + * active pools. + */ + mutex_enter(&spa_namespace_lock); + if ((spa = spa_lookup(target)) != NULL) { + spa->spa_import_flags |= ZFS_IMPORT_SKIP_MMP; + } + mutex_exit(&spa_namespace_lock); +} + #define BOGUS_SUFFIX "_CHECKPOINTED_UNIVERSE" /* * Import the checkpointed state of the pool specified by the target @@ -4176,6 +4206,7 @@ import_checkpointed_state(char *target, nvlist_t *cfg, } if (cfg == NULL) { + zdb_set_skip_mmp(poolname); error = spa_get_stats(poolname, &cfg, NULL, 0); if (error != 0) { fatal("Tried to read config of pool \"%s\" but " @@ -4188,7 +4219,8 @@ import_checkpointed_state(char *target, nvlist_t *cfg, fnvlist_add_string(cfg, ZPOOL_CONFIG_POOL_NAME, bogus_name); error = spa_import(bogus_name, cfg, NULL, - ZFS_IMPORT_MISSING_LOG | ZFS_IMPORT_CHECKPOINT); + ZFS_IMPORT_MISSING_LOG | ZFS_IMPORT_CHECKPOINT | + ZFS_IMPORT_SKIP_MMP); if (error != 0) { fatal("Tried to import pool \"%s\" but spa_import() failed " "with error %d\n", bogus_name, error); @@ -5187,90 +5219,6 @@ zdb_embedded_block(char *thing) free(buf); } -static boolean_t -pool_match(nvlist_t *cfg, char *tgt) -{ - uint64_t v, guid = strtoull(tgt, NULL, 0); - char *s; - - if (guid != 0) { - if (nvlist_lookup_uint64(cfg, ZPOOL_CONFIG_POOL_GUID, &v) == 0) - return (v == guid); - } else { - if (nvlist_lookup_string(cfg, ZPOOL_CONFIG_POOL_NAME, &s) == 0) - return (strcmp(s, tgt) == 0); - } - return (B_FALSE); -} - -static char * -find_zpool(char **target, nvlist_t **configp, int dirc, char **dirv) -{ - nvlist_t *pools; - nvlist_t *match = NULL; - char *name = NULL; - char *sepp = NULL; - char sep = '\0'; - int count = 0; - importargs_t args; - - bzero(&args, sizeof (args)); - args.paths = dirc; - args.path = dirv; - args.can_be_active = B_TRUE; - - if ((sepp = strpbrk(*target, "/@")) != NULL) { - sep = *sepp; - *sepp = '\0'; - } - - pools = zpool_search_import(g_zfs, &args); - - if (pools != NULL) { - nvpair_t *elem = NULL; - while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { - verify(nvpair_value_nvlist(elem, configp) == 0); - if (pool_match(*configp, *target)) { - count++; - if (match != NULL) { - /* print previously found config */ - if (name != NULL) { - (void) printf("%s\n", name); - dump_nvlist(match, 8); - name = NULL; - } - (void) printf("%s\n", - nvpair_name(elem)); - dump_nvlist(*configp, 8); - } else { - match = *configp; - name = nvpair_name(elem); - } - } - } - } - if (count > 1) - (void) fatal("\tMatched %d pools - use pool GUID " - "instead of pool name or \n" - "\tpool name part of a dataset name to select pool", count); - - if (sepp) - *sepp = sep; - /* - * If pool GUID was specified for pool id, replace it with pool name - */ - if (name && (strstr(*target, name) != *target)) { - int sz = 1 + strlen(name) + ((sepp) ? strlen(sepp) : 0); - - *target = umem_alloc(sz, UMEM_NOFAIL); - (void) snprintf(*target, sz, "%s%s", name, sepp ? sepp : ""); - } - - *configp = name ? match : NULL; - - return (name); -} - int main(int argc, char **argv) { @@ -5283,7 +5231,7 @@ main(int argc, char **argv) int error = 0; char **searchdirs = NULL; int nsearch = 0; - char *target; + char *target, *target_pool; nvlist_t *policy = NULL; uint64_t max_txg = UINT64_MAX; int flags = ZFS_IMPORT_MISSING_LOG; @@ -5490,22 +5438,48 @@ main(int argc, char **argv) error = 0; target = argv[0]; + if (strpbrk(target, "/@") != NULL) { + size_t targetlen; + + target_pool = strdup(target); + *strpbrk(target_pool, "/@") = '\0'; + + target_is_spa = B_FALSE; + targetlen = strlen(target); + if (targetlen && target[targetlen - 1] == '/') + target[targetlen - 1] = '\0'; + } else { + target_pool = target; + } + if (dump_opt['e']) { - char *name = find_zpool(&target, &cfg, nsearch, searchdirs); + importargs_t args = { 0 }; - error = ENOENT; - if (name) { - if (dump_opt['C'] > 1) { - (void) printf("\nConfiguration for import:\n"); - dump_nvlist(cfg, 8); - } + args.paths = nsearch; + args.path = searchdirs; + args.can_be_active = B_TRUE; + error = zpool_tryimport(g_zfs, target_pool, &cfg, &args); + + if (error == 0) { + if (nvlist_add_nvlist(cfg, ZPOOL_LOAD_POLICY, policy) != 0) { fatal("can't open '%s': %s", target, strerror(ENOMEM)); } - error = spa_import(name, cfg, NULL, flags); + + if (dump_opt['C'] > 1) { + (void) printf("\nConfiguration for import:\n"); + dump_nvlist(cfg, 8); + } + + /* + * Disable the activity check to allow examination of + * active pools. + */ + error = spa_import(target_pool, cfg, NULL, + flags | ZFS_IMPORT_SKIP_MMP); } } @@ -5520,21 +5494,6 @@ main(int argc, char **argv) } - if (strpbrk(target, "/@") != NULL) { - size_t targetlen; - - target_is_spa = B_FALSE; - /* - * Remove any trailing slash. Later code would get confused - * by it, but we want to allow it so that "pool/" can - * indicate that we want to dump the topmost filesystem, - * rather than the whole pool. - */ - targetlen = strlen(target); - if (targetlen != 0 && target[targetlen - 1] == '/') - target[targetlen - 1] = '\0'; - } - if (error == 0) { if (dump_opt['k'] && (target_is_spa || dump_opt['R'])) { ASSERT(checkpoint_pool != NULL); @@ -5548,6 +5507,7 @@ main(int argc, char **argv) } } else if (target_is_spa || dump_opt['R']) { + zdb_set_skip_mmp(target); error = spa_open_rewind(target, &spa, FTAG, policy, NULL); if (error) { @@ -5570,6 +5530,7 @@ main(int argc, char **argv) } } } else { + zdb_set_skip_mmp(target); error = open_objset(target, DMU_OST_ANY, FTAG, &os); } } Modified: vendor/illumos/dist/cmd/zhack/zhack.c ============================================================================== --- vendor/illumos/dist/cmd/zhack/zhack.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/cmd/zhack/zhack.c Wed Nov 6 08:46:24 2019 (r354378) @@ -121,16 +121,11 @@ space_delta_cb(dmu_object_type_t bonustype, void *data * Target is the dataset whose pool we want to open. */ static void -import_pool(const char *target, boolean_t readonly) +zhack_import(char *target, boolean_t readonly) { nvlist_t *config; - nvlist_t *pools; - int error; - char *sepp; - spa_t *spa; - nvpair_t *elem; nvlist_t *props; - const char *name; + int error; kernel_init(readonly ? FREAD : (FREAD | FWRITE)); g_zfs = libzfs_init(); @@ -139,68 +134,40 @@ import_pool(const char *target, boolean_t readonly) dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); g_readonly = readonly; - - /* - * If we only want readonly access, it's OK if we find - * a potentially-active (ie, imported into the kernel) pool from the - * default cachefile. - */ - if (readonly && spa_open(target, &spa, FTAG) == 0) { - spa_close(spa, FTAG); - return; - } - g_importargs.unique = B_TRUE; g_importargs.can_be_active = readonly; g_pool = strdup(target); - if ((sepp = strpbrk(g_pool, "/@")) != NULL) - *sepp = '\0'; - g_importargs.poolname = g_pool; - pools = zpool_search_import(g_zfs, &g_importargs); - if (nvlist_empty(pools)) { - if (!g_importargs.can_be_active) { - g_importargs.can_be_active = B_TRUE; - if (zpool_search_import(g_zfs, &g_importargs) != NULL || - spa_open(target, &spa, FTAG) == 0) { - fatal(spa, FTAG, "cannot import '%s': pool is " - "active; run " "\"zpool export %s\" " - "first\n", g_pool, g_pool); - } - } + error = zpool_tryimport(g_zfs, target, &config, &g_importargs); + if (error) + fatal(NULL, FTAG, "cannot import '%s': %s", target, + libzfs_error_description(g_zfs)); - fatal(NULL, FTAG, "cannot import '%s': no such pool " - "available\n", g_pool); - } - - elem = nvlist_next_nvpair(pools, NULL); - name = nvpair_name(elem); - verify(nvpair_value_nvlist(elem, &config) == 0); - props = NULL; if (readonly) { - verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); - verify(nvlist_add_uint64(props, + VERIFY(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); + VERIFY(nvlist_add_uint64(props, zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0); } zfeature_checks_disable = B_TRUE; - error = spa_import(name, config, props, ZFS_IMPORT_NORMAL); + error = spa_import(target, config, props, + (readonly ? ZFS_IMPORT_SKIP_MMP : ZFS_IMPORT_NORMAL)); zfeature_checks_disable = B_FALSE; if (error == EEXIST) error = 0; if (error) - fatal(NULL, FTAG, "can't import '%s': %s", name, + fatal(NULL, FTAG, "can't import '%s': %s", target, strerror(error)); } static void -zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa) +zhack_spa_open(char *target, boolean_t readonly, void *tag, spa_t **spa) { int err; - import_pool(target, readonly); + zhack_import(target, readonly); zfeature_checks_disable = B_TRUE; err = spa_open(target, spa, tag); Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:46:24 2019 (r354378) @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -1615,6 +1616,10 @@ print_status_config(zpool_handle_t *zhp, const char *n (void) printf(gettext("split into new pool")); break; + case VDEV_AUX_ACTIVE: + (void) printf(gettext("currently in use")); + break; + case VDEV_AUX_CHILDREN_OFFLINE: (void) printf(gettext("all children offline")); break; @@ -1743,6 +1748,10 @@ print_import_config(const char *name, nvlist_t *nv, in (void) printf(gettext("too many errors")); break; + case VDEV_AUX_ACTIVE: + (void) printf(gettext("currently in use")); + break; + case VDEV_AUX_CHILDREN_OFFLINE: (void) printf(gettext("all children offline")); break; @@ -1840,8 +1849,10 @@ show_import(nvlist_t *config) vdev_stat_t *vs; char *name; uint64_t guid; + uint64_t hostid = 0; char *msgid; - nvlist_t *nvroot; + char *hostname = "unknown"; + nvlist_t *nvroot, *nvinfo; int reason; const char *health; uint_t vsc; @@ -1928,6 +1939,17 @@ show_import(nvlist_t *config) zpool_print_unsup_feat(config); break; + case ZPOOL_STATUS_HOSTID_ACTIVE: + (void) printf(gettext(" status: The pool is currently " + "imported by another system.\n")); + break; + + case ZPOOL_STATUS_HOSTID_REQUIRED: + (void) printf(gettext(" status: The pool has the " + "multihost property on. It cannot\n\tbe safely imported " + "when the system hostid is not set.\n")); + break; + case ZPOOL_STATUS_HOSTID_MISMATCH: (void) printf(gettext(" status: The pool was last accessed by " "another system.\n")); @@ -2008,6 +2030,27 @@ show_import(nvlist_t *config) "imported. Attach the missing\n\tdevices and try " "again.\n")); break; + case ZPOOL_STATUS_HOSTID_ACTIVE: + VERIFY0(nvlist_lookup_nvlist(config, + ZPOOL_CONFIG_LOAD_INFO, &nvinfo)); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTNAME)) + hostname = fnvlist_lookup_string(nvinfo, + ZPOOL_CONFIG_MMP_HOSTNAME); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTID)) + hostid = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_HOSTID); + + (void) printf(gettext(" action: The pool must be " + "exported from %s (hostid=%lx)\n\tbefore it " + "can be safely imported.\n"), hostname, + (unsigned long) hostid); + break; + case ZPOOL_STATUS_HOSTID_REQUIRED: + (void) printf(gettext(" action: Check the SMF " + "svc:/system/hostid service.\n")); + break; default: (void) printf(gettext(" action: The pool cannot be " "imported due to damaged devices or data.\n")); @@ -2055,6 +2098,31 @@ show_import(nvlist_t *config) } } +static boolean_t +zfs_force_import_required(nvlist_t *config) +{ + uint64_t state; + uint64_t hostid = 0; + nvlist_t *nvinfo; + + state = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE); + (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid); + + if (state != POOL_STATE_EXPORTED && hostid != get_system_hostid()) + return (B_TRUE); + + nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO); + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_STATE)) { + mmp_state_t mmp_state = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_STATE); + + if (mmp_state != MMP_STATE_INACTIVE) + return (B_TRUE); + } + + return (B_FALSE); +} + /* * Perform the import for the given configuration. This passes the heavy * lifting off to zpool_import_props(), and then mounts the datasets contained @@ -2066,53 +2134,73 @@ do_import(nvlist_t *config, const char *newname, const { zpool_handle_t *zhp; char *name; - uint64_t state; uint64_t version; - verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, - &name) == 0); + name = fnvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME); + version = fnvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_POOL_STATE, &state) == 0); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_VERSION, &version) == 0); if (!SPA_VERSION_IS_SUPPORTED(version)) { (void) fprintf(stderr, gettext("cannot import '%s': pool " "is formatted using an unsupported ZFS version\n"), name); return (1); - } else if (state != POOL_STATE_EXPORTED && + } else if (zfs_force_import_required(config) && !(flags & ZFS_IMPORT_ANY_HOST)) { - uint64_t hostid; + mmp_state_t mmp_state = MMP_STATE_INACTIVE; + nvlist_t *nvinfo; - if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, - &hostid) == 0) { - if ((unsigned long)hostid != gethostid()) { - char *hostname; - uint64_t timestamp; - time_t t; + nvinfo = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO); + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_STATE)) + mmp_state = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_STATE); - verify(nvlist_lookup_string(config, - ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_TIMESTAMP, ×tamp) == 0); - t = timestamp; - (void) fprintf(stderr, gettext("cannot import " - "'%s': pool may be in use from other " - "system, it was last accessed by %s " - "(hostid: 0x%lx) on %s"), name, hostname, - (unsigned long)hostid, - asctime(localtime(&t))); - (void) fprintf(stderr, gettext("use '-f' to " - "import anyway\n")); - return (1); - } + if (mmp_state == MMP_STATE_ACTIVE) { + char *hostname = ""; + uint64_t hostid = 0; + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTNAME)) + hostname = fnvlist_lookup_string(nvinfo, + ZPOOL_CONFIG_MMP_HOSTNAME); + + if (nvlist_exists(nvinfo, ZPOOL_CONFIG_MMP_HOSTID)) + hostid = fnvlist_lookup_uint64(nvinfo, + ZPOOL_CONFIG_MMP_HOSTID); + + (void) fprintf(stderr, gettext("cannot import '%s': " + "pool is imported on %s (hostid: " + "0x%lx)\nExport the pool on the other system, " + "then run 'zpool import'.\n"), + name, hostname, (unsigned long) hostid); + } else if (mmp_state == MMP_STATE_NO_HOSTID) { + (void) fprintf(stderr, gettext("Cannot import '%s': " + "pool has the multihost property on and the\n" + "system's hostid is not set.\n"), name); } else { + char *hostname = ""; + uint64_t timestamp = 0; + uint64_t hostid = 0; + + if (nvlist_exists(config, ZPOOL_CONFIG_HOSTNAME)) + hostname = fnvlist_lookup_string(config, + ZPOOL_CONFIG_HOSTNAME); + + if (nvlist_exists(config, ZPOOL_CONFIG_TIMESTAMP)) + timestamp = fnvlist_lookup_uint64(config, + ZPOOL_CONFIG_TIMESTAMP); + + if (nvlist_exists(config, ZPOOL_CONFIG_HOSTID)) + hostid = fnvlist_lookup_uint64(config, + ZPOOL_CONFIG_HOSTID); + (void) fprintf(stderr, gettext("cannot import '%s': " - "pool may be in use from other system\n"), name); - (void) fprintf(stderr, gettext("use '-f' to import " - "anyway\n")); - return (1); + "pool was previously in use from another system.\n" + "Last accessed by %s (hostid=%lx) at %s" + "The pool can be imported, use 'zpool import -f' " + "to import the pool.\n"), name, hostname, + (unsigned long)hostid, ctime((time_t *)×tamp)); + } + + return (1); } if (zpool_import_props(g_zfs, config, newname, props, flags) != 0) @@ -5050,6 +5138,15 @@ status_callback(zpool_handle_t *zhp, void *data) "from a backup source. Manually marking the device\n" "\trepaired using 'zpool clear' may allow some data " "to be recovered.\n")); + break; + + case ZPOOL_STATUS_IO_FAILURE_MMP: + (void) printf(gettext("status: The pool is suspended because " + "multihost writes failed or were delayed;\n\tanother " + "system could import the pool undetected.\n")); + (void) printf(gettext("action: Make sure the pool's devices " + "are connected, then reboot your system and\n\timport the " + "pool.\n")); break; case ZPOOL_STATUS_IO_FAILURE_WAIT: Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/cmd/ztest/ztest.c Wed Nov 6 08:46:24 2019 (r354378) @@ -126,6 +126,7 @@ #include #include #include +#include #include static int ztest_fd_data = -1; @@ -164,6 +165,7 @@ typedef struct ztest_shared_opts { uint64_t zo_time; uint64_t zo_maxloops; uint64_t zo_metaslab_force_ganging; + int zo_mmp_test; } ztest_shared_opts_t; static const ztest_shared_opts_t ztest_opts_defaults = { @@ -182,6 +184,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = .zo_passtime = 60, /* 60 seconds */ .zo_killrate = 70, /* 70% kill rate */ .zo_verbose = 0, + .zo_mmp_test = 0, .zo_init = 1, .zo_time = 300, /* 5 minutes */ .zo_maxloops = 50, /* max loops during spa_freeze() */ @@ -341,6 +344,7 @@ ztest_func_t ztest_spa_create_destroy; ztest_func_t ztest_fault_inject; ztest_func_t ztest_ddt_repair; ztest_func_t ztest_dmu_snapshot_hold; +ztest_func_t ztest_mmp_enable_disable; ztest_func_t ztest_scrub; ztest_func_t ztest_dsl_dataset_promote_busy; ztest_func_t ztest_vdev_attach_detach; @@ -386,6 +390,7 @@ ztest_info_t ztest_info[] = { { ztest_fault_inject, 1, &zopt_sometimes }, { ztest_ddt_repair, 1, &zopt_sometimes }, { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, + { ztest_mmp_enable_disable, 1, &zopt_sometimes }, { ztest_reguid, 1, &zopt_rarely }, { ztest_scrub, 1, &zopt_rarely }, { ztest_spa_upgrade, 1, &zopt_rarely }, @@ -599,6 +604,7 @@ usage(boolean_t requested) "\t[-k kill_percentage (default: %llu%%)]\n" "\t[-p pool_name (default: %s)]\n" "\t[-f dir (default: %s)] file directory for vdev files\n" + "\t[-M] Multi-host simulate pool imported on remote host\n" "\t[-V] verbose (use multiple times for ever more blather)\n" "\t[-E] use existing pool instead of creating new one\n" "\t[-T time (default: %llu sec)] total run time\n" @@ -642,7 +648,7 @@ process_options(int argc, char **argv) bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:o:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:MVET:P:hF:B:o:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -711,6 +717,9 @@ process_options(int argc, char **argv) sizeof (zo->zo_dir)); } break; + case 'M': + zo->zo_mmp_test = 1; + break; case 'V': zo->zo_verbose++; break; @@ -2478,6 +2487,9 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) spa_t *spa; nvlist_t *nvroot; + if (zo->zo_mmp_test) + return; + /* * Attempt to create using a bad file. */ @@ -2509,8 +2521,58 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) rw_exit(&ztest_name_lock); } +/* + * Start and then stop the MMP threads to ensure the startup and shutdown code + * works properly. Actual protection and property-related code tested via ZTS. + */ /* ARGSUSED */ void +ztest_mmp_enable_disable(ztest_ds_t *zd, uint64_t id) +{ + ztest_shared_opts_t *zo = &ztest_opts; + spa_t *spa = ztest_spa; + + if (zo->zo_mmp_test) + return; + + /* + * Since enabling MMP involves setting a property, it could not be done + * while the pool is suspended. + */ + if (spa_suspended(spa)) + return; + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + mutex_enter(&spa->spa_props_lock); + + zfs_multihost_fail_intervals = 0; + + if (!spa_multihost(spa)) { + spa->spa_multihost = B_TRUE; + mmp_thread_start(spa); + } + + mutex_exit(&spa->spa_props_lock); + spa_config_exit(spa, SCL_CONFIG, FTAG); + + txg_wait_synced(spa_get_dsl(spa), 0); + mmp_signal_all_threads(); + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); + mutex_enter(&spa->spa_props_lock); + + if (spa_multihost(spa)) { + mmp_thread_stop(spa); + spa->spa_multihost = B_FALSE; + } + + mutex_exit(&spa->spa_props_lock); + spa_config_exit(spa, SCL_CONFIG, FTAG); +} + +/* ARGSUSED */ +void ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) { spa_t *spa; @@ -2519,6 +2581,9 @@ ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot, *props; char *name; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool); @@ -2687,6 +2752,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) nvlist_t *nvroot; int error; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; @@ -2769,6 +2837,9 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) uint64_t guid = 0; int error; + if (ztest_opts.zo_mmp_test) + return; + if (ztest_random(2) == 0) { sav = &spa->spa_spares; aux = ZPOOL_CONFIG_SPARES; @@ -2864,6 +2935,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id) uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); /* ensure we have a useable config; mirrors of raidz aren't supported */ @@ -2970,6 +3044,9 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) int oldvd_is_log; int error, expected_error; + if (ztest_opts.zo_mmp_test) + return; + mutex_enter(&ztest_vdev_lock); leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; @@ -5563,6 +5640,9 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id) uint64_t orig, load; int error; + if (ztest_opts.zo_mmp_test) + return; + orig = spa_guid(spa); load = spa_load_guid(spa); @@ -6247,7 +6327,7 @@ ztest_run(ztest_shared_t *zs) * Verify that we can export the pool and reimport it under a * different name. */ - if (ztest_random(2) == 0) { + if ((ztest_random(2) == 0) && !ztest_opts.zo_mmp_test) { char name[ZFS_MAX_DATASET_NAME_LEN]; (void) snprintf(name, sizeof (name), "%s_import", ztest_opts.zo_pool); @@ -6396,6 +6476,56 @@ make_random_props() } /* + * Import a storage pool with the given name. + */ +static void +ztest_import(ztest_shared_t *zs) +{ + libzfs_handle_t *hdl; + importargs_t args = { 0 }; + spa_t *spa; + nvlist_t *cfg = NULL; + int nsearch = 1; + char *searchdirs[nsearch]; + char *name = ztest_opts.zo_pool; + int flags = ZFS_IMPORT_MISSING_LOG; + int error; + + mutex_init(&ztest_vdev_lock, NULL, MUTEX_DEFAULT, NULL); + rw_init(&ztest_name_lock, NULL, USYNC_THREAD, NULL); + + kernel_init(FREAD | FWRITE); + hdl = libzfs_init(); + + searchdirs[0] = ztest_opts.zo_dir; + args.paths = nsearch; + args.path = searchdirs; + args.can_be_active = B_FALSE; + + error = zpool_tryimport(hdl, name, &cfg, &args); + if (error) + (void) fatal(0, "No pools found\n"); + + VERIFY0(spa_import(name, cfg, NULL, flags)); + VERIFY0(spa_open(name, &spa, FTAG)); + zs->zs_metaslab_sz = + 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift; + spa_close(spa, FTAG); + + libzfs_fini(hdl); + kernel_fini(); + + if (!ztest_opts.zo_mmp_test) { + ztest_run_zdb(ztest_opts.zo_pool); + ztest_freeze(); + ztest_run_zdb(ztest_opts.zo_pool); + } + + rw_destroy(&ztest_name_lock); + mutex_destroy(&ztest_vdev_lock); +} + +/* * Create a storage pool with the given name and initial vdev size. * Then test spa_freeze() functionality. */ @@ -6438,12 +6568,12 @@ ztest_init(ztest_shared_t *zs) kernel_fini(); - ztest_run_zdb(ztest_opts.zo_pool); + if (!ztest_opts.zo_mmp_test) { + ztest_run_zdb(ztest_opts.zo_pool); + ztest_freeze(); + ztest_run_zdb(ztest_opts.zo_pool); + } - ztest_freeze(); - - ztest_run_zdb(ztest_opts.zo_pool); - rw_destroy(&ztest_name_lock); mutex_destroy(&ztest_vdev_lock); mutex_destroy(&ztest_checkpoint_lock); @@ -6603,13 +6733,19 @@ ztest_run_init(void) { ztest_shared_t *zs = ztest_shared; - ASSERT(ztest_opts.zo_init != 0); - /* * Blow away any existing copy of zpool.cache */ (void) remove(spa_config_path); + if (ztest_opts.zo_init == 0) { + if (ztest_opts.zo_verbose >= 1) + (void) printf("Importing pool %s\n", + ztest_opts.zo_pool); + ztest_import(zs); + return; + } + /* * Create and initialize our storage pool. */ @@ -6816,7 +6952,8 @@ main(int argc, char **argv) (void) printf("\n"); } - ztest_run_zdb(ztest_opts.zo_pool); + if (!ztest_opts.zo_mmp_test) + ztest_run_zdb(ztest_opts.zo_pool); } if (ztest_opts.zo_verbose >= 1) { Modified: vendor/illumos/dist/lib/libzfs/common/libzfs.h ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/lib/libzfs/common/libzfs.h Wed Nov 6 08:46:24 2019 (r354378) @@ -23,7 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. @@ -130,6 +130,7 @@ typedef enum zfs_error { EZFS_DIFFDATA, /* bad zfs diff data */ EZFS_POOLREADONLY, /* pool is in read-only mode */ EZFS_SCRUB_PAUSED, /* scrub currently paused */ + EZFS_ACTIVE_POOL, /* pool is imported on a different system */ EZFS_NO_PENDING, /* cannot cancel, no operation is pending */ EZFS_CHECKPOINT_EXISTS, /* checkpoint exists */ EZFS_DISCARDING_CHECKPOINT, /* currently discarding a checkpoint */ @@ -313,6 +314,8 @@ typedef enum { /* * The following correspond to faults as defined in the (fault.fs.zfs.*) * event namespace. Each is associated with a corresponding message ID. + * This must be kept in sync with the zfs_msgid_table in + * lib/libzfs/libzfs_status.c. */ ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache */ ZPOOL_STATUS_MISSING_DEV_R, /* missing device with replicas */ @@ -325,8 +328,11 @@ typedef enum { ZPOOL_STATUS_FAILING_DEV, /* device experiencing errors */ ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */ ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */ + ZPOOL_STATUS_HOSTID_ACTIVE, /* currently active on another system */ + ZPOOL_STATUS_HOSTID_REQUIRED, /* multihost=on and hostid=0 */ ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */ ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */ + ZPOOL_STATUS_IO_FAILURE_MMP, /* failed MMP, failmode not 'panic' */ ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */ /* @@ -404,6 +410,8 @@ typedef struct importargs { } importargs_t; extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *); +extern int zpool_tryimport(libzfs_handle_t *hdl, char *target, + nvlist_t **configp, importargs_t *args); /* legacy pool search routines */ extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **); @@ -723,6 +731,7 @@ extern boolean_t zfs_dataset_exists(libzfs_handle_t *, zfs_type_t); extern int zfs_spa_version(zfs_handle_t *, int *); extern boolean_t zfs_bookmark_exists(const char *path); +extern ulong_t get_system_hostid(void); /* * Mount support functions. Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Nov 6 08:44:35 2019 (r354377) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Nov 6 08:46:24 2019 (r354378) @@ -440,6 +440,8 @@ make_dataset_handle_common(zfs_handle_t *zhp, zfs_cmd_ zhp->zfs_head_type = ZFS_TYPE_VOLUME; else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS) zhp->zfs_head_type = ZFS_TYPE_FILESYSTEM; + else if (zhp->zfs_dmustats.dds_type == DMU_OST_OTHER) + return (-1); else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 08:47:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 761771AE9F2; Wed, 6 Nov 2019 08:47:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477KsV2ZdCz3JL0; Wed, 6 Nov 2019 08:47:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C4EC227FC; Wed, 6 Nov 2019 08:47:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68lAkv040958; Wed, 6 Nov 2019 08:47:10 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68lA5v040957; Wed, 6 Nov 2019 08:47:10 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060847.xA68lA5v040957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354379 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:47:10 -0000 Author: avg Date: Wed Nov 6 08:47:09 2019 New Revision: 354379 URL: https://svnweb.freebsd.org/changeset/base/354379 Log: 10701 Correct lock ASSERTs in vdev_label_read/write illumos/illumos-gate@58447f688d5e308373ab16a3b129bc0ba0fbc154 https://github.com/illumos/illumos-gate/commit/58447f688d5e308373ab16a3b129bc0ba0fbc154 https://www.illumos.org/issues/10701 Port of ZoL commit: 0091d66f4e Correct lock ASSERTs in vdev_label_read/write At a minimum, this fixes a blown assert during an MMP test run when running on a DEBUG build. Portions contributed by: Jerry Jelinek Author: Olaf Faaland Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Nov 6 08:46:24 2019 (r354378) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Nov 6 08:47:09 2019 (r354379) @@ -184,8 +184,9 @@ static void vdev_label_read(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t offset, uint64_t size, zio_done_func_t *done, void *private, int flags) { - ASSERT(spa_config_held(zio->io_spa, SCL_STATE_ALL, RW_WRITER) == - SCL_STATE_ALL); + ASSERT( + spa_config_held(zio->io_spa, SCL_STATE, RW_READER) == SCL_STATE || + spa_config_held(zio->io_spa, SCL_STATE, RW_WRITER) == SCL_STATE); ASSERT(flags & ZIO_FLAG_CONFIG_WRITER); zio_nowait(zio_read_phys(zio, vd, @@ -198,17 +199,9 @@ void vdev_label_write(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t offset, uint64_t size, zio_done_func_t *done, void *private, int flags) { -#ifdef _KERNEL - /* - * This assert is invalid in the user-level ztest MMP code because - * the ztest thread is not in dsl_pool_sync_context. ZoL does not - * build the user-level code with DEBUG so this is not an issue there. - */ - ASSERT(spa_config_held(zio->io_spa, SCL_ALL, RW_WRITER) == SCL_ALL || - (spa_config_held(zio->io_spa, SCL_CONFIG | SCL_STATE, RW_READER) == - (SCL_CONFIG | SCL_STATE) && - dsl_pool_sync_context(spa_get_dsl(zio->io_spa)))); -#endif + ASSERT( + spa_config_held(zio->io_spa, SCL_STATE, RW_READER) == SCL_STATE || + spa_config_held(zio->io_spa, SCL_STATE, RW_WRITER) == SCL_STATE); ASSERT(flags & ZIO_FLAG_CONFIG_WRITER); zio_nowait(zio_write_phys(zio, vd, From owner-svn-src-all@freebsd.org Wed Nov 6 08:53:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1B7B1AEC63; Wed, 6 Nov 2019 08:53:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L1D59wHz3Jp6; Wed, 6 Nov 2019 08:53:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BC7F229CA; Wed, 6 Nov 2019 08:53:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68rqgC046841; Wed, 6 Nov 2019 08:53:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68rqfc046840; Wed, 6 Nov 2019 08:53:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060853.xA68rqfc046840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354380 - vendor/illumos/dist/man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 354380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:53:52 -0000 Author: avg Date: Wed Nov 6 08:53:52 2019 New Revision: 354380 URL: https://svnweb.freebsd.org/changeset/base/354380 Log: 8899 zpool list property documentation doesn't match actual behaviour illumos/illumos-gate@b0e142e57dfda6f02bf1fa66973c610f5fefe8cb https://github.com/illumos/illumos-gate/commit/b0e142e57dfda6f02bf1fa66973c610f5fefe8cb https://www.illumos.org/issues/8899 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221795: The `zpool list` section of the zpool(8) manpage says that the default list of displayed properties is as below: The default list is name, size, used, available, fragmentation, expandsize, capacity, health, altroot. This does not seem to be the case. In fact: # zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT tank 10.9T 6.05T 4.83T - 29% 55% 1.00x ONLINE - The Properties section of the same manpage includes the `used` property, but this seems not to be recognised: # zpool list -o used bad property list: invalid property 'used' usage: [...] # The usage message produced here indeed doesn't include `used`. Author: Yuri Pankov (yuripv) Modified: vendor/illumos/dist/man/man1m/zpool.1m Modified: vendor/illumos/dist/man/man1m/zpool.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:47:09 2019 (r354379) +++ vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:53:52 2019 (r354380) @@ -25,7 +25,7 @@ .\" Copyright (c) 2017 Datto Inc. .\" Copyright (c) 2017 George Melikov. All Rights Reserved. .\" -.Dd August 23, 2017 +.Dd December 6, 2017 .Dt ZPOOL 1M .Os .Sh NAME @@ -521,10 +521,8 @@ change the behavior of the pool. .Pp The following are read-only properties: .Bl -tag -width Ds -.It Sy available -Amount of storage available within the pool. -This property can also be referred to by its shortened column name, -.Sy avail . +.It Cm allocated +Amount of storage space used within the pool. .It Sy bootsize The size of the system boot partition. This property can only be set at pool creation time and is read-only once pool @@ -572,8 +570,6 @@ Information about unsupported features that are enable See .Xr zpool-features 5 for details. -.It Sy used -Amount of storage space used within the pool. .El .Pp The space usage properties report actual physical space available to the @@ -1532,8 +1528,8 @@ See the .Sx Properties section for a list of valid properties. The default list is -.Sy name , size , used , available , fragmentation , expandsize , capacity , -.Sy dedupratio , health , altroot . +.Cm name , size , allocated , free , expandsize , fragmentation , capacity , +.Cm dedupratio , health , altroot . .It Fl p Display numbers in parsable .Pq exact From owner-svn-src-all@freebsd.org Wed Nov 6 08:55:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AADA41AED36; Wed, 6 Nov 2019 08:55:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L302wdGz3JyY; Wed, 6 Nov 2019 08:55:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47C39229CF; Wed, 6 Nov 2019 08:55:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68tOsh046989; Wed, 6 Nov 2019 08:55:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68tO19046988; Wed, 6 Nov 2019 08:55:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060855.xA68tO19046988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354381 - vendor/illumos/dist/man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 354381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:55:24 -0000 Author: avg Date: Wed Nov 6 08:55:23 2019 New Revision: 354381 URL: https://svnweb.freebsd.org/changeset/base/354381 Log: 9521 Add checkpoint field in the default list of the zpool-list man page illumos/illumos-gate@f41179bd376293096297cdc1f32e610d44f65c8b https://github.com/illumos/illumos-gate/commit/f41179bd376293096297cdc1f32e610d44f65c8b https://www.illumos.org/issues/9521 The default list of fields in the zpool list man page is missing checkpoint. Author: Eitan Adler (eadler) Modified: vendor/illumos/dist/man/man1m/zpool.1m Modified: vendor/illumos/dist/man/man1m/zpool.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:53:52 2019 (r354380) +++ vendor/illumos/dist/man/man1m/zpool.1m Wed Nov 6 08:55:23 2019 (r354381) @@ -25,7 +25,7 @@ .\" Copyright (c) 2017 Datto Inc. .\" Copyright (c) 2017 George Melikov. All Rights Reserved. .\" -.Dd December 6, 2017 +.Dd April 27, 2018 .Dt ZPOOL 1M .Os .Sh NAME @@ -1528,7 +1528,7 @@ See the .Sx Properties section for a list of valid properties. The default list is -.Cm name , size , allocated , free , expandsize , fragmentation , capacity , +.Cm name , size , allocated , free , checkpoint, expandsize , fragmentation , capacity , .Cm dedupratio , health , altroot . .It Fl p Display numbers in parsable From owner-svn-src-all@freebsd.org Wed Nov 6 08:58:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DD0E1AEE9C; Wed, 6 Nov 2019 08:58:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L674PxGz3KF6; Wed, 6 Nov 2019 08:58:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A596229D1; Wed, 6 Nov 2019 08:58:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68w74a047161; Wed, 6 Nov 2019 08:58:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68w3xb047144; Wed, 6 Nov 2019 08:58:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060858.xA68w3xb047144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354382 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/... X-SVN-Commit-Revision: 354382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:58:07 -0000 Author: avg Date: Wed Nov 6 08:58:03 2019 New Revision: 354382 URL: https://svnweb.freebsd.org/changeset/base/354382 Log: 10601 10757 Pool allocation classes illumos/illumos-gate@663207adb1669640c01c5ec6949ce78fd806efae https://github.com/illumos/illumos-gate/commit/663207adb1669640c01c5ec6949ce78fd806efae 10601 Pool allocation classes https://www.illumos.org/issues/10601 illumos port of ZoL Pool allocation classes. Includes at least these two commits: 441709695 Pool allocation classes misplacing small file blocks cc99f275a Pool allocation classes 10757 Add -gLp to zpool subcommands for alt vdev names https://www.illumos.org/issues/10757 Port from ZoL of d2f3e292d Add -gLp to zpool subcommands for alt vdev names Note that a subsequent ZoL commit changed -p to -P a77f29f93 Change full path subcommand flag from -p to -P Portions contributed by: Jerry Jelinek Portions contributed by: Håkan Johansson Portions contributed by: Richard Yao Portions contributed by: Chunwei Chen Portions contributed by: loli10K Author: Don Brady Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/zpool/zpool_vdev.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzpool/common/util.c vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.c Wed Nov 6 08:58:03 2019 (r354382) @@ -20,11 +20,12 @@ */ /* - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2017, Intel Corporation. */ #ifdef _KERNEL @@ -298,4 +299,11 @@ zpool_feature_init(void) "Reduce memory used by removed devices when their blocks are " "freed or remapped.", ZFEATURE_FLAG_READONLY_COMPAT, obsolete_counts_deps); + + { + zfeature_register(SPA_FEATURE_ALLOCATION_CLASSES, + "org.zfsonlinux:allocation_classes", "allocation_classes", + "Support for separate allocation classes.", + ZFEATURE_FLAG_READONLY_COMPAT, NULL); + } } Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.h ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.h Wed Nov 6 08:58:03 2019 (r354382) @@ -24,6 +24,7 @@ * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2017, Intel Corporation. */ #ifndef _ZFEATURE_COMMON_H @@ -61,6 +62,7 @@ typedef enum spa_feature { SPA_FEATURE_OBSOLETE_COUNTS, SPA_FEATURE_POOL_CHECKPOINT, SPA_FEATURE_SPACEMAP_V2, + SPA_FEATURE_ALLOCATION_CLASSES, SPA_FEATURES } spa_feature_t; Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfs_prop.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/common/zfs/zfs_prop.c Wed Nov 6 08:58:03 2019 (r354382) @@ -435,6 +435,9 @@ zfs_prop_init(void) zprop_register_number(ZFS_PROP_RECORDSIZE, "recordsize", SPA_OLD_MAXBLOCKSIZE, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "512 to 1M, power of 2", "RECSIZE"); + zprop_register_number(ZFS_PROP_SPECIAL_SMALL_BLOCKS, + "special_small_blocks", 0, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, + "zero or 512 to 128K, power of 2", "SPECIAL_SMALL_BLOCKS"); /* hidden properties */ zprop_register_hidden(ZFS_PROP_REMAPTXG, "remaptxg", PROP_TYPE_NUMBER, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Wed Nov 6 08:58:03 2019 (r354382) @@ -2201,6 +2201,8 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, zp->zp_dedup = dedup; zp->zp_dedup_verify = dedup && dedup_verify; zp->zp_nopwrite = nopwrite; + zp->zp_zpl_smallblk = DMU_OT_IS_FILE(zp->zp_type) ? + os->os_zpl_special_smallblock : 0; } int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Wed Nov 6 08:58:03 2019 (r354382) @@ -304,6 +304,20 @@ dnodesize_changed_cb(void *arg, uint64_t newval) } static void +smallblk_changed_cb(void *arg, uint64_t newval) +{ + objset_t *os = arg; + + /* + * Inheritance and range checking should have been done by now. + */ + ASSERT(newval <= SPA_OLD_MAXBLOCKSIZE); + ASSERT(ISP2(newval)); + + os->os_zpl_special_smallblock = newval; +} + +static void logbias_changed_cb(void *arg, uint64_t newval) { objset_t *os = arg; @@ -515,6 +529,12 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, bl err = dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_DNODESIZE), dnodesize_changed_cb, os); + } + if (err == 0) { + err = dsl_prop_register(ds, + zfs_prop_to_name( + ZFS_PROP_SPECIAL_SMALL_BLOCKS), + smallblk_changed_cb, os); } } if (needlock) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Nov 6 08:58:03 2019 (r354382) @@ -23,6 +23,7 @@ * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2017, Intel Corporation. */ #include @@ -288,7 +289,7 @@ metaslab_class_validate(metaslab_class_t *mc) return (0); } -void +static void metaslab_class_space_update(metaslab_class_t *mc, int64_t alloc_delta, int64_t defer_delta, int64_t space_delta, int64_t dspace_delta) { @@ -325,7 +326,8 @@ metaslab_class_get_dspace(metaslab_class_t *mc) void metaslab_class_histogram_verify(metaslab_class_t *mc) { - vdev_t *rvd = mc->mc_spa->spa_root_vdev; + spa_t *spa = mc->mc_spa; + vdev_t *rvd = spa->spa_root_vdev; uint64_t *mc_hist; int i; @@ -831,7 +833,8 @@ metaslab_group_histogram_verify(metaslab_group_t *mg) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; - if (msp->ms_sm == NULL) + /* skip if not active or not a member */ + if (msp->ms_sm == NULL || msp->ms_group != mg) continue; for (i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) @@ -964,12 +967,14 @@ metaslab_group_fragmentation(metaslab_group_t *mg) if (msp->ms_fragmentation == ZFS_FRAG_INVALID) continue; + if (msp->ms_group != mg) + continue; valid_ms++; fragmentation += msp->ms_fragmentation; } - if (valid_ms <= vd->vdev_ms_count / 2) + if (valid_ms <= mg->mg_vd->vdev_ms_count / 2) return (ZFS_FRAG_INVALID); fragmentation /= valid_ms; @@ -1000,7 +1005,10 @@ metaslab_group_allocatable(metaslab_group_t *mg, metas * groups to select from. Otherwise, we always consider it eligible * for allocations. */ - if (mc != spa_normal_class(spa) || mc->mc_groups <= 1) + if ((mc != spa_normal_class(spa) && + mc != spa_special_class(spa) && + mc != spa_dedup_class(spa)) || + mc->mc_groups <= 1) return (B_TRUE); /* @@ -1534,12 +1542,26 @@ metaslab_unload(metaslab_t *msp) msp->ms_max_size = 0; } +static void +metaslab_space_update(vdev_t *vd, metaslab_class_t *mc, int64_t alloc_delta, + int64_t defer_delta, int64_t space_delta) +{ + vdev_space_update(vd, alloc_delta, defer_delta, space_delta); + + ASSERT3P(vd->vdev_spa->spa_root_vdev, ==, vd->vdev_parent); + ASSERT(vd->vdev_ms_count != 0); + + metaslab_class_space_update(mc, alloc_delta, defer_delta, space_delta, + vdev_deflated_space(vd, space_delta)); +} + int metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, uint64_t txg, metaslab_t **msp) { vdev_t *vd = mg->mg_vd; - objset_t *mos = vd->vdev_spa->spa_meta_objset; + spa_t *spa = vd->vdev_spa; + objset_t *mos = spa->spa_meta_objset; metaslab_t *ms; int error; @@ -1596,8 +1618,8 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 /* * If metaslab_debug_load is set and we're initializing a metaslab - * that has an allocated space map object then load the its space - * map so that can verify frees. + * that has an allocated space map object then load the space map + * so that we can verify frees. */ if (metaslab_debug_load && ms->ms_sm != NULL) { mutex_enter(&ms->ms_lock); @@ -1619,16 +1641,19 @@ void metaslab_fini(metaslab_t *msp) { metaslab_group_t *mg = msp->ms_group; + vdev_t *vd = mg->mg_vd; metaslab_group_remove(mg, msp); mutex_enter(&msp->ms_lock); VERIFY(msp->ms_group == NULL); - vdev_space_update(mg->mg_vd, -space_map_allocated(msp->ms_sm), - 0, -msp->ms_size); + metaslab_space_update(vd, mg->mg_class, + -space_map_allocated(msp->ms_sm), 0, -msp->ms_size); + space_map_close(msp->ms_sm); metaslab_unload(msp); + range_tree_destroy(msp->ms_allocatable); range_tree_destroy(msp->ms_freeing); range_tree_destroy(msp->ms_freed); @@ -2643,7 +2668,7 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) ASSERT3P(msp->ms_checkpointing, ==, NULL); msp->ms_checkpointing = range_tree_create(NULL, NULL); - vdev_space_update(vd, 0, 0, msp->ms_size); + metaslab_space_update(vd, mg->mg_class, 0, 0, msp->ms_size); } ASSERT0(range_tree_space(msp->ms_freeing)); ASSERT0(range_tree_space(msp->ms_checkpointing)); @@ -2665,7 +2690,8 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) defer_delta -= range_tree_space(*defer_tree); } - vdev_space_update(vd, alloc_delta + defer_delta, defer_delta, 0); + metaslab_space_update(vd, mg->mg_class, alloc_delta + defer_delta, + defer_delta, 0); /* * If there's a metaslab_load() in progress, wait for it to complete @@ -2764,21 +2790,25 @@ metaslab_sync_reassess(metaslab_group_t *mg) spa_config_exit(spa, SCL_ALLOC, FTAG); } -static uint64_t -metaslab_distance(metaslab_t *msp, dva_t *dva) +/* + * When writing a ditto block (i.e. more than one DVA for a given BP) on + * the same vdev as an existing DVA of this BP, then try to allocate it + * on a different metaslab than existing DVAs (i.e. a unique metaslab). + */ +static boolean_t +metaslab_is_unique(metaslab_t *msp, dva_t *dva) { - uint64_t ms_shift = msp->ms_group->mg_vd->vdev_ms_shift; - uint64_t offset = DVA_GET_OFFSET(dva) >> ms_shift; - uint64_t start = msp->ms_id; + uint64_t dva_ms_id; + if (DVA_GET_ASIZE(dva) == 0) + return (B_TRUE); + if (msp->ms_group->mg_vd->vdev_id != DVA_GET_VDEV(dva)) - return (1ULL << 63); + return (B_TRUE); - if (offset < start) - return ((start - offset) << ms_shift); - if (offset > start) - return ((offset - start) << ms_shift); - return (0); + dva_ms_id = DVA_GET_OFFSET(dva) >> msp->ms_group->mg_vd->vdev_ms_shift; + + return (msp->ms_id != dva_ms_id); } /* @@ -3012,7 +3042,7 @@ metaslab_block_alloc(metaslab_t *msp, uint64_t size, u */ static metaslab_t * find_valid_metaslab(metaslab_group_t *mg, uint64_t activation_weight, - dva_t *dva, int d, uint64_t min_distance, uint64_t asize, int allocator, + dva_t *dva, int d, boolean_t want_unique, uint64_t asize, int allocator, zio_alloc_list_t *zal, metaslab_t *search, boolean_t *was_active) { avl_index_t idx; @@ -3047,13 +3077,10 @@ find_valid_metaslab(metaslab_group_t *mg, uint64_t act if (activation_weight == METASLAB_WEIGHT_PRIMARY || *was_active) break; - uint64_t target_distance = min_distance - + (space_map_allocated(msp->ms_sm) != 0 ? 0 : - min_distance >> 1); - for (i = 0; i < d; i++) { - if (metaslab_distance(msp, &dva[i]) < target_distance) - break; + if (want_unique && + !metaslab_is_unique(msp, &dva[i])) + break; /* try another metaslab */ } if (i == d) break; @@ -3071,8 +3098,8 @@ find_valid_metaslab(metaslab_group_t *mg, uint64_t act /* ARGSUSED */ static uint64_t metaslab_group_alloc_normal(metaslab_group_t *mg, zio_alloc_list_t *zal, - uint64_t asize, uint64_t txg, uint64_t min_distance, dva_t *dva, int d, - int allocator) + uint64_t asize, uint64_t txg, boolean_t want_unique, dva_t *dva, + int d, int allocator) { metaslab_t *msp = NULL; uint64_t offset = -1ULL; @@ -3126,7 +3153,7 @@ metaslab_group_alloc_normal(metaslab_group_t *mg, zio_ was_active = B_TRUE; } else { msp = find_valid_metaslab(mg, activation_weight, dva, d, - min_distance, asize, allocator, zal, search, + want_unique, asize, allocator, zal, search, &was_active); } @@ -3264,6 +3291,7 @@ next: * metaslab. */ ASSERT(!metaslab_should_allocate(msp, asize)); + mutex_exit(&msp->ms_lock); } mutex_exit(&msp->ms_lock); @@ -3273,14 +3301,14 @@ next: static uint64_t metaslab_group_alloc(metaslab_group_t *mg, zio_alloc_list_t *zal, - uint64_t asize, uint64_t txg, uint64_t min_distance, dva_t *dva, int d, - int allocator) + uint64_t asize, uint64_t txg, boolean_t want_unique, dva_t *dva, + int d, int allocator) { uint64_t offset; ASSERT(mg->mg_initialized); - offset = metaslab_group_alloc_normal(mg, zal, asize, txg, - min_distance, dva, d, allocator); + offset = metaslab_group_alloc_normal(mg, zal, asize, txg, want_unique, + dva, d, allocator); mutex_enter(&mg->mg_lock); if (offset == -1ULL) { @@ -3308,14 +3336,6 @@ metaslab_group_alloc(metaslab_group_t *mg, zio_alloc_l } /* - * If we have to write a ditto block (i.e. more than one DVA for a given BP) - * on the same vdev as an existing DVA of this BP, then try to allocate it - * at least (vdev_asize / (2 ^ ditto_same_vdev_distance_shift)) away from the - * existing DVAs. - */ -int ditto_same_vdev_distance_shift = 3; - -/* * Allocate a block for the specified i/o. */ int @@ -3331,6 +3351,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, u /* * For testing, make some blocks above a certain size be gang blocks. + * This will also test spilling from special to normal. */ if (psize >= metaslab_force_ganging && (ddi_get_lbolt() & 3) == 0) { metaslab_trace_add(zal, NULL, NULL, psize, d, TRACE_FORCE_GANG, @@ -3382,6 +3403,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, u vd = vdev_lookup_top(spa, DVA_GET_VDEV(&dva[d - 1])); mg = vd->vdev_mg->mg_next; } else { + ASSERT(mc->mc_rotor != NULL); mg = mc->mc_rotor; } @@ -3446,25 +3468,17 @@ top: ASSERT(mg->mg_class == mc); - /* - * If we don't need to try hard, then require that the - * block be 1/8th of the device away from any other DVAs - * in this BP. If we are trying hard, allow any offset - * to be used (distance=0). - */ - uint64_t distance = 0; - if (!try_hard) { - distance = vd->vdev_asize >> - ditto_same_vdev_distance_shift; - if (distance <= (1ULL << vd->vdev_ms_shift)) - distance = 0; - } - uint64_t asize = vdev_psize_to_asize(vd, psize); ASSERT(P2PHASE(asize, 1ULL << vd->vdev_ashift) == 0); + /* + * If we don't need to try hard, then require that the + * block be on an different metaslab from any other DVAs + * in this BP (unique=true). If we are trying hard, then + * allow any metaslab to be used (unique=false). + */ uint64_t offset = metaslab_group_alloc(mg, zal, asize, txg, - distance, dva, d, allocator); + !try_hard, dva, d, allocator); if (offset != -1ULL) { /* @@ -3843,7 +3857,8 @@ metaslab_class_throttle_reserve(metaslab_class_t *mc, if (reserved_slots < max) available_slots = max - reserved_slots; - if (slots <= available_slots || GANG_ALLOCATION(flags)) { + if (slots <= available_slots || GANG_ALLOCATION(flags) || + flags & METASLAB_MUST_RESERVE) { /* * We reserve the slots individually so that we can unreserve * them individually when an I/O completes. @@ -4126,9 +4141,11 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_ spa_config_enter(spa, SCL_ALLOC, FTAG, RW_READER); - for (int d = 0; d < ndvas; d++) - if ((error = metaslab_claim_dva(spa, &dva[d], txg)) != 0) + for (int d = 0; d < ndvas; d++) { + error = metaslab_claim_dva(spa, &dva[d], txg); + if (error != 0) break; + } spa_config_exit(spa, SCL_ALLOC, FTAG); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 08:58:03 2019 (r354382) @@ -28,6 +28,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2018 Joyent, Inc. + * Copyright (c) 2017, Intel Corporation. * Copyright (c) 2017 Datto Inc. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. */ @@ -274,8 +275,14 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp) ASSERT(MUTEX_HELD(&spa->spa_props_lock)); if (rvd != NULL) { - alloc = metaslab_class_get_alloc(spa_normal_class(spa)); - size = metaslab_class_get_space(spa_normal_class(spa)); + alloc = metaslab_class_get_alloc(mc); + alloc += metaslab_class_get_alloc(spa_special_class(spa)); + alloc += metaslab_class_get_alloc(spa_dedup_class(spa)); + + size = metaslab_class_get_space(mc); + size += metaslab_class_get_space(spa_special_class(spa)); + size += metaslab_class_get_space(spa_dedup_class(spa)); + spa_prop_add_list(*nvp, ZPOOL_PROP_NAME, spa_name(spa), 0, src); spa_prop_add_list(*nvp, ZPOOL_PROP_SIZE, NULL, size, src); spa_prop_add_list(*nvp, ZPOOL_PROP_ALLOCATED, NULL, alloc, src); @@ -1137,6 +1144,8 @@ spa_activate(spa_t *spa, int mode) spa->spa_normal_class = metaslab_class_create(spa, zfs_metaslab_ops); spa->spa_log_class = metaslab_class_create(spa, zfs_metaslab_ops); + spa->spa_special_class = metaslab_class_create(spa, zfs_metaslab_ops); + spa->spa_dedup_class = metaslab_class_create(spa, zfs_metaslab_ops); /* Try to create a covering process */ mutex_enter(&spa->spa_proc_lock); @@ -1232,6 +1241,12 @@ spa_deactivate(spa_t *spa) metaslab_class_destroy(spa->spa_log_class); spa->spa_log_class = NULL; + metaslab_class_destroy(spa->spa_special_class); + spa->spa_special_class = NULL; + + metaslab_class_destroy(spa->spa_dedup_class); + spa->spa_dedup_class = NULL; + /* * If this was part of an import or the open otherwise failed, we may * still have errors left in the queues. Empty them just in case. @@ -4834,7 +4849,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ char *poolname; nvlist_t *nvl; - if (nvlist_lookup_string(props, + if (props == NULL || + nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_TNAME), &poolname) != 0) poolname = (char *)pool; @@ -4922,9 +4938,15 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ (error = vdev_create(rvd, txg, B_FALSE)) == 0 && (error = spa_validate_aux(spa, nvroot, txg, VDEV_ALLOC_ADD)) == 0) { - for (int c = 0; c < rvd->vdev_children; c++) { - vdev_metaslab_set_size(rvd->vdev_child[c]); - vdev_expand(rvd->vdev_child[c], txg); + /* + * instantiate the metaslab groups (this will dirty the vdevs) + * we can no longer error exit past this point + */ + for (int c = 0; error == 0 && c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; + + vdev_metaslab_set_size(vd); + vdev_expand(vd, txg); } } @@ -7082,8 +7104,14 @@ spa_async_thread(void *arg) mutex_enter(&spa_namespace_lock); old_space = metaslab_class_get_space(spa_normal_class(spa)); + old_space += metaslab_class_get_space(spa_special_class(spa)); + old_space += metaslab_class_get_space(spa_dedup_class(spa)); + spa_config_update(spa, SPA_CONFIG_UPDATE_POOL); + new_space = metaslab_class_get_space(spa_normal_class(spa)); + new_space += metaslab_class_get_space(spa_special_class(spa)); + new_space += metaslab_class_get_space(spa_dedup_class(spa)); mutex_exit(&spa_namespace_lock); /* @@ -7780,6 +7808,9 @@ spa_sync(spa_t *spa, uint64_t txg) dsl_pool_t *dp = spa->spa_dsl_pool; objset_t *mos = spa->spa_meta_objset; bplist_t *free_bpl = &spa->spa_free_bplist[txg & TXG_MASK]; + metaslab_class_t *normal = spa_normal_class(spa); + metaslab_class_t *special = spa_special_class(spa); + metaslab_class_t *dedup = spa_dedup_class(spa); vdev_t *rvd = spa->spa_root_vdev; vdev_t *vd; dmu_tx_t *tx; @@ -7872,11 +7903,15 @@ spa_sync(spa_t *spa, uint64_t txg) for (int c = 0; c < rvd->vdev_children; c++) { vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; + metaslab_class_t *mc; - if (mg == NULL || mg->mg_class != spa_normal_class(spa) || - !metaslab_group_initialized(mg)) + if (mg == NULL || !metaslab_group_initialized(mg)) continue; + mc = mg->mg_class; + if (mc != normal && mc != special && mc != dedup) + continue; + /* * It is safe to do a lock-free check here because only async * allocations look at mg_max_alloc_queue_depth, and async @@ -7893,12 +7928,18 @@ spa_sync(spa_t *spa, uint64_t txg) } slots_per_allocator += zfs_vdev_def_queue_depth; } - metaslab_class_t *mc = spa_normal_class(spa); + for (int i = 0; i < spa->spa_alloc_count; i++) { - ASSERT0(zfs_refcount_count(&mc->mc_alloc_slots[i])); - mc->mc_alloc_max_slots[i] = slots_per_allocator; + ASSERT0(zfs_refcount_count(&normal->mc_alloc_slots[i])); + ASSERT0(zfs_refcount_count(&special->mc_alloc_slots[i])); + ASSERT0(zfs_refcount_count(&dedup->mc_alloc_slots[i])); + normal->mc_alloc_max_slots[i] = slots_per_allocator; + special->mc_alloc_max_slots[i] = slots_per_allocator; + dedup->mc_alloc_max_slots[i] = slots_per_allocator; } - mc->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; + normal->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; + special->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; + dedup->mc_alloc_throttle_enabled = zio_dva_throttle_enabled; for (int c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Nov 6 08:58:03 2019 (r354382) @@ -26,6 +26,7 @@ * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017, Intel Corporation. */ #include @@ -388,6 +389,19 @@ spa_load_note(spa_t *spa, const char *fmt, ...) } /* + * By default dedup and user data indirects land in the special class + */ +int zfs_ddt_data_is_special = B_TRUE; +int zfs_user_indirect_is_special = B_TRUE; + +/* + * The percentage of special class final space reserved for metadata only. + * Once we allocate 100 - zfs_special_class_metadata_reserve_pct we only + * let metadata into the class. + */ +int zfs_special_class_metadata_reserve_pct = 25; + +/* * ========================================================================== * SPA config locking * ========================================================================== @@ -1173,6 +1187,8 @@ spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t */ ASSERT(metaslab_class_validate(spa_normal_class(spa)) == 0); ASSERT(metaslab_class_validate(spa_log_class(spa)) == 0); + ASSERT(metaslab_class_validate(spa_special_class(spa)) == 0); + ASSERT(metaslab_class_validate(spa_dedup_class(spa)) == 0); spa_config_exit(spa, SCL_ALL, spa); @@ -1516,6 +1532,16 @@ zfs_strtonum(const char *str, char **nptr) return (val); } +void +spa_activate_allocation_classes(spa_t *spa, dmu_tx_t *tx) +{ + /* + * We bump the feature refcount for each special vdev added to the pool + */ + ASSERT(spa_feature_is_enabled(spa, SPA_FEATURE_ALLOCATION_CLASSES)); + spa_feature_incr(spa, SPA_FEATURE_ALLOCATION_CLASSES, tx); +} + /* * ========================================================================== * Accessor functions @@ -1763,6 +1789,79 @@ metaslab_class_t * spa_log_class(spa_t *spa) { return (spa->spa_log_class); +} + +metaslab_class_t * +spa_special_class(spa_t *spa) +{ + return (spa->spa_special_class); +} + +metaslab_class_t * +spa_dedup_class(spa_t *spa) +{ + return (spa->spa_dedup_class); +} + +/* + * Locate an appropriate allocation class + */ +metaslab_class_t * +spa_preferred_class(spa_t *spa, uint64_t size, dmu_object_type_t objtype, + uint_t level, uint_t special_smallblk) +{ + if (DMU_OT_IS_ZIL(objtype)) { + if (spa->spa_log_class->mc_groups != 0) + return (spa_log_class(spa)); + else + return (spa_normal_class(spa)); + } + + boolean_t has_special_class = spa->spa_special_class->mc_groups != 0; + + if (DMU_OT_IS_DDT(objtype)) { + if (spa->spa_dedup_class->mc_groups != 0) + return (spa_dedup_class(spa)); + else if (has_special_class && zfs_ddt_data_is_special) + return (spa_special_class(spa)); + else + return (spa_normal_class(spa)); + } + + /* Indirect blocks for user data can land in special if allowed */ + if (level > 0 && (DMU_OT_IS_FILE(objtype) || objtype == DMU_OT_ZVOL)) { + if (has_special_class && zfs_user_indirect_is_special) + return (spa_special_class(spa)); + else + return (spa_normal_class(spa)); + } + + if (DMU_OT_IS_METADATA(objtype) || level > 0) { + if (has_special_class) + return (spa_special_class(spa)); + else + return (spa_normal_class(spa)); + } + + /* + * Allow small file blocks in special class in some cases (like + * for the dRAID vdev feature). But always leave a reserve of + * zfs_special_class_metadata_reserve_pct exclusively for metadata. + */ + if (DMU_OT_IS_FILE(objtype) && + has_special_class && size <= special_smallblk) { + metaslab_class_t *special = spa_special_class(spa); + uint64_t alloc = metaslab_class_get_alloc(special); + uint64_t space = metaslab_class_get_space(special); + uint64_t limit = + (space * (100 - zfs_special_class_metadata_reserve_pct)) + / 100; + + if (alloc < limit) + return (special); + } + + return (spa_normal_class(spa)); } void Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Wed Nov 6 08:58:03 2019 (r354382) @@ -21,13 +21,14 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. * Copyright 2014 HybridCluster. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. + * Copyright (c) 2017, Intel Corporation. * Copyright (c) 2014 Integros [integros.com] */ @@ -126,6 +127,16 @@ typedef enum dmu_object_byteswap { ((ot) & DMU_OT_METADATA) : \ dmu_ot[(ot)].ot_metadata) +#define DMU_OT_IS_DDT(ot) \ + ((ot) == DMU_OT_DDT_ZAP) + +#define DMU_OT_IS_ZIL(ot) \ + ((ot) == DMU_OT_INTENT_LOG) + +/* Note: ztest uses DMU_OT_UINT64_OTHER as a proxy for file blocks */ +#define DMU_OT_IS_FILE(ot) \ + ((ot) == DMU_OT_PLAIN_FILE_CONTENTS || (ot) == DMU_OT_UINT64_OTHER) + #define DMU_OT_IS_METADATA_CACHED(ot) (((ot) & DMU_OT_NEWTYPE) ? \ B_TRUE : dmu_ot[(ot)].ot_dbuf_metadata_cache) @@ -216,6 +227,7 @@ typedef enum dmu_object_type { * * The DMU_OTN_* types do not have entries in the dmu_ot table, * use the DMU_OT_IS_METDATA() and DMU_OT_BYTESWAP() macros instead + * use the DMU_OT_IS_METADATA() and DMU_OT_BYTESWAP() macros instead * of indexing into dmu_ot directly (this works for both DMU_OT_* types * and DMU_OTN_* types). */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Wed Nov 6 08:58:03 2019 (r354382) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2017 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -113,6 +113,11 @@ struct objset { uint64_t os_normalization; uint64_t os_utf8only; uint64_t os_casesensitivity; + /* + * The largest zpl file block allowed in special class. + * cached here instead of zfsvfs for easier access. + */ + int os_zpl_special_smallblock; /* * Pointer is constant; the blkptr it points to is protected by Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h Wed Nov 6 08:58:03 2019 (r354382) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2018 by Delphix. All rights reserved. + * Copyright (c) 2017, Intel Corporation. */ #ifndef _SYS_METASLAB_H @@ -56,12 +57,17 @@ void metaslab_sync_done(metaslab_t *, uint64_t); void metaslab_sync_reassess(metaslab_group_t *); uint64_t metaslab_block_maxsize(metaslab_t *); +/* + * metaslab alloc flags + */ #define METASLAB_HINTBP_FAVOR 0x0 #define METASLAB_HINTBP_AVOID 0x1 #define METASLAB_GANG_HEADER 0x2 #define METASLAB_GANG_CHILD 0x4 #define METASLAB_ASYNC_ALLOC 0x8 #define METASLAB_DONT_THROTTLE 0x10 +#define METASLAB_MUST_RESERVE 0x20 +#define METASLAB_FASTWRITE 0x40 int metaslab_alloc(spa_t *, metaslab_class_t *, uint64_t, blkptr_t *, int, uint64_t, blkptr_t *, int, zio_alloc_list_t *, zio_t *, @@ -92,8 +98,6 @@ boolean_t metaslab_class_throttle_reserve(metaslab_cla zio_t *, int); void metaslab_class_throttle_unreserve(metaslab_class_t *, int, int, zio_t *); -void metaslab_class_space_update(metaslab_class_t *, int64_t, int64_t, - int64_t, int64_t); uint64_t metaslab_class_get_alloc(metaslab_class_t *); uint64_t metaslab_class_get_space(metaslab_class_t *); uint64_t metaslab_class_get_dspace(metaslab_class_t *); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Nov 6 08:58:03 2019 (r354382) @@ -27,6 +27,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Joyent, Inc. * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017, Intel Corporation. */ #ifndef _SYS_SPA_H @@ -801,6 +802,11 @@ extern uint64_t spa_version(spa_t *spa); extern boolean_t spa_deflate(spa_t *spa); extern metaslab_class_t *spa_normal_class(spa_t *spa); extern metaslab_class_t *spa_log_class(spa_t *spa); +extern metaslab_class_t *spa_special_class(spa_t *spa); +extern metaslab_class_t *spa_dedup_class(spa_t *spa); +extern metaslab_class_t *spa_preferred_class(spa_t *spa, uint64_t size, + dmu_object_type_t objtype, uint_t level, uint_t special_smallblk); + extern void spa_evicting_os_register(spa_t *, objset_t *os); extern void spa_evicting_os_deregister(spa_t *, objset_t *os); extern void spa_evicting_os_wait(spa_t *spa); @@ -862,6 +868,7 @@ extern boolean_t spa_trust_config(spa_t *spa); extern uint64_t spa_missing_tvds_allowed(spa_t *spa); extern void spa_set_missing_tvds(spa_t *spa, uint64_t missing); extern boolean_t spa_top_vdevs_spacemap_addressable(spa_t *spa); +extern void spa_activate_allocation_classes(spa_t *, dmu_tx_t *); extern int spa_mode(spa_t *spa); extern uint64_t zfs_strtonum(const char *str, char **nptr); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h Wed Nov 6 08:58:03 2019 (r354382) @@ -25,6 +25,7 @@ * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017, Intel Corporation. */ #ifndef _SYS_SPA_IMPL_H @@ -218,6 +219,8 @@ struct spa { boolean_t spa_is_initializing; /* true while opening pool */ metaslab_class_t *spa_normal_class; /* normal data class */ metaslab_class_t *spa_log_class; /* intent log data class */ + metaslab_class_t *spa_special_class; /* special allocation class */ + metaslab_class_t *spa_dedup_class; /* dedup allocation class */ uint64_t spa_first_txg; /* first txg after spa_open() */ uint64_t spa_final_txg; /* txg of export/destroy */ uint64_t spa_freeze_txg; /* freeze pool at this txg */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h Wed Nov 6 08:58:03 2019 (r354382) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2017, Intel Corporation. */ #ifndef _SYS_VDEV_H @@ -106,6 +107,8 @@ extern boolean_t vdev_children_are_offline(vdev_t *vd) extern void vdev_space_update(vdev_t *vd, int64_t alloc_delta, int64_t defer_delta, int64_t space_delta); + +extern int64_t vdev_deflated_space(vdev_t *vd, int64_t space); extern uint64_t vdev_psize_to_asize(vdev_t *vd, uint64_t psize); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h Wed Nov 6 08:58:03 2019 (r354382) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2018 by Delphix. All rights reserved. + * Copyright (c) 2017, Intel Corporation. */ #ifndef _SYS_VDEV_IMPL_H @@ -146,6 +147,14 @@ struct vdev_queue { kmutex_t vq_lock; }; +typedef enum vdev_alloc_bias { + VDEV_BIAS_NONE, + VDEV_BIAS_LOG, /* dedicated to ZIL data (SLOG) */ + VDEV_BIAS_SPECIAL, /* dedicated to ddt, metadata, and small blks */ + VDEV_BIAS_DEDUP /* dedicated to dedup metadata */ +} vdev_alloc_bias_t; + + /* * On-disk indirect vdev state. * @@ -239,6 +248,7 @@ struct vdev { boolean_t vdev_ishole; /* is a hole in the namespace */ kmutex_t vdev_queue_lock; /* protects vdev_queue_depth */ uint64_t vdev_top_zap; + vdev_alloc_bias_t vdev_alloc_bias; /* metaslab allocation bias */ /* pool checkpoint related */ space_map_t *vdev_checkpoint_sm; /* contains reserved blocks */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Wed Nov 6 08:58:03 2019 (r354382) @@ -313,6 +313,7 @@ typedef struct zio_prop { boolean_t zp_dedup; boolean_t zp_dedup_verify; boolean_t zp_nopwrite; + uint32_t zp_zpl_smallblk; } zio_prop_t; typedef struct zio_cksum_report zio_cksum_report_t; @@ -433,6 +434,7 @@ struct zio { vdev_t *io_vd; void *io_vsd; const zio_vsd_ops_t *io_vsd_ops; + metaslab_class_t *io_metaslab_class; /* dva throttle class */ uint64_t io_offset; hrtime_t io_timestamp; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Nov 6 08:58:03 2019 (r354382) @@ -26,6 +26,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 Joyent, Inc. + * Copyright (c) 2017, Intel Corporation. */ #include @@ -192,6 +193,25 @@ vdev_getops(const char *type) return (ops); } +/* + * Derive the enumerated alloction bias from string input. + * String origin is either the per-vdev zap or zpool(1M). + */ +static vdev_alloc_bias_t +vdev_derive_alloc_bias(const char *bias) +{ + vdev_alloc_bias_t alloc_bias = VDEV_BIAS_NONE; + + if (strcmp(bias, VDEV_ALLOC_BIAS_LOG) == 0) + alloc_bias = VDEV_BIAS_LOG; + else if (strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0) + alloc_bias = VDEV_BIAS_SPECIAL; + else if (strcmp(bias, VDEV_ALLOC_BIAS_DEDUP) == 0) + alloc_bias = VDEV_BIAS_DEDUP; + + return (alloc_bias); +} + /* ARGSUSED */ void vdev_default_xlate(vdev_t *vd, const range_seg_t *in, range_seg_t *res) @@ -515,6 +535,8 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vde uint64_t guid = 0, islog, nparity; vdev_t *vd; vdev_indirect_config_t *vic; + vdev_alloc_bias_t alloc_bias = VDEV_BIAS_NONE; + boolean_t top_level = (parent && !parent->vdev_parent); ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); @@ -601,11 +623,32 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vde } ASSERT(nparity != -1ULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 08:58:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 196B91AEE9F; Wed, 6 Nov 2019 08:58:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L680cxNz3KF7; Wed, 6 Nov 2019 08:58:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDD08229D2; Wed, 6 Nov 2019 08:58:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA68w7cP047170; Wed, 6 Nov 2019 08:58:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA68w787047168; Wed, 6 Nov 2019 08:58:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060858.xA68w787047168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 08:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354382 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill... X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb vendor/... X-SVN-Commit-Revision: 354382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 08:58:08 -0000 Author: avg Date: Wed Nov 6 08:58:03 2019 New Revision: 354382 URL: https://svnweb.freebsd.org/changeset/base/354382 Log: 10601 10757 Pool allocation classes illumos/illumos-gate@663207adb1669640c01c5ec6949ce78fd806efae https://github.com/illumos/illumos-gate/commit/663207adb1669640c01c5ec6949ce78fd806efae 10601 Pool allocation classes https://www.illumos.org/issues/10601 illumos port of ZoL Pool allocation classes. Includes at least these two commits: 441709695 Pool allocation classes misplacing small file blocks cc99f275a Pool allocation classes 10757 Add -gLp to zpool subcommands for alt vdev names https://www.illumos.org/issues/10757 Port from ZoL of d2f3e292d Add -gLp to zpool subcommands for alt vdev names Note that a subsequent ZoL commit changed -p to -P a77f29f93 Change full path subcommand flag from -p to -P Portions contributed by: Jerry Jelinek Portions contributed by: Håkan Johansson Portions contributed by: Richard Yao Portions contributed by: Chunwei Chen Portions contributed by: loli10K Author: Don Brady Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/cmd/zpool/zpool_main.c vendor/illumos/dist/cmd/zpool/zpool_vdev.c vendor/illumos/dist/cmd/ztest/ztest.c vendor/illumos/dist/lib/libzfs/common/libzfs.h vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs/common/libzfs_pool.c vendor/illumos/dist/lib/libzpool/common/util.c vendor/illumos/dist/man/man1m/zfs.1m vendor/illumos/dist/man/man1m/zpool.1m vendor/illumos/dist/man/man5/zpool-features.5 Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/common/zfs/zfeature_common.h vendor-sys/illumos/dist/common/zfs/zfs_prop.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zio.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 08:58:03 2019 (r354382) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2017 by Delphix. All rights reserved. + * Copyright (c) 2011, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC. @@ -931,13 +931,23 @@ dump_metaslab(metaslab_t *msp) static void print_vdev_metaslab_header(vdev_t *vd) { - (void) printf("\tvdev %10llu\n\t%-10s%5llu %-19s %-15s %-10s\n", - (u_longlong_t)vd->vdev_id, + vdev_alloc_bias_t alloc_bias = vd->vdev_alloc_bias; + const char *bias_str; + + bias_str = (alloc_bias == VDEV_BIAS_LOG || vd->vdev_islog) ? + VDEV_ALLOC_BIAS_LOG : + (alloc_bias == VDEV_BIAS_SPECIAL) ? VDEV_ALLOC_BIAS_SPECIAL : + (alloc_bias == VDEV_BIAS_DEDUP) ? VDEV_ALLOC_BIAS_DEDUP : + vd->vdev_islog ? "log" : ""; + + (void) printf("\tvdev %10llu %s\n" + "\t%-10s%5llu %-19s %-15s %-12s\n", + (u_longlong_t)vd->vdev_id, bias_str, "metaslabs", (u_longlong_t)vd->vdev_ms_count, "offset", "spacemap", "free"); - (void) printf("\t%15s %19s %15s %10s\n", + (void) printf("\t%15s %19s %15s %12s\n", "---------------", "-------------------", - "---------------", "-------------"); + "---------------", "------------"); } static void @@ -953,7 +963,7 @@ dump_metaslab_groups(spa_t *spa) vdev_t *tvd = rvd->vdev_child[c]; metaslab_group_t *mg = tvd->vdev_mg; - if (mg->mg_class != mc) + if (mg == NULL || mg->mg_class != mc) continue; metaslab_group_histogram_verify(mg); @@ -2767,6 +2777,7 @@ typedef struct zdb_blkstats { uint64_t zb_count; uint64_t zb_gangs; uint64_t zb_ditto_samevdev; + uint64_t zb_ditto_same_ms; uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE]; } zdb_blkstats_t; @@ -2806,6 +2817,16 @@ typedef struct zdb_cb { uint32_t **zcb_vd_obsolete_counts; } zdb_cb_t; +/* test if two DVA offsets from same vdev are within the same metaslab */ +static boolean_t +same_metaslab(spa_t *spa, uint64_t vdev, uint64_t off1, uint64_t off2) +{ + vdev_t *vd = vdev_lookup_top(spa, vdev); + uint64_t ms_shift = vd->vdev_ms_shift; + + return ((off1 >> ms_shift) == (off2 >> ms_shift)); +} + static void zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp, dmu_object_type_t type) @@ -2817,6 +2838,8 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b if (zilog && zil_bp_tree_add(zilog, bp) != 0) return; + spa_config_enter(zcb->zcb_spa, SCL_CONFIG, FTAG, RW_READER); + for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : ZDB_OT_TOTAL; @@ -2842,8 +2865,15 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b switch (BP_GET_NDVAS(bp)) { case 2: if (DVA_GET_VDEV(&bp->blk_dva[0]) == - DVA_GET_VDEV(&bp->blk_dva[1])) + DVA_GET_VDEV(&bp->blk_dva[1])) { zb->zb_ditto_samevdev++; + + if (same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[1]))) + zb->zb_ditto_same_ms++; + } break; case 3: equal = (DVA_GET_VDEV(&bp->blk_dva[0]) == @@ -2852,13 +2882,37 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const b DVA_GET_VDEV(&bp->blk_dva[2])) + (DVA_GET_VDEV(&bp->blk_dva[1]) == DVA_GET_VDEV(&bp->blk_dva[2])); - if (equal != 0) + if (equal != 0) { zb->zb_ditto_samevdev++; + + if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[1]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[1]))) + zb->zb_ditto_same_ms++; + else if (DVA_GET_VDEV(&bp->blk_dva[0]) == + DVA_GET_VDEV(&bp->blk_dva[2]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[0]), + DVA_GET_OFFSET(&bp->blk_dva[2]))) + zb->zb_ditto_same_ms++; + else if (DVA_GET_VDEV(&bp->blk_dva[1]) == + DVA_GET_VDEV(&bp->blk_dva[2]) && + same_metaslab(zcb->zcb_spa, + DVA_GET_VDEV(&bp->blk_dva[1]), + DVA_GET_OFFSET(&bp->blk_dva[1]), + DVA_GET_OFFSET(&bp->blk_dva[2]))) + zb->zb_ditto_same_ms++; + } break; } - } + spa_config_exit(zcb->zcb_spa, SCL_CONFIG, FTAG); + if (BP_IS_EMBEDDED(bp)) { zcb->zcb_embedded_blocks[BPE_GET_ETYPE(bp)]++; zcb->zcb_embedded_histogram[BPE_GET_ETYPE(bp)] @@ -3665,6 +3719,7 @@ dump_block_stats(spa_t *spa) uint64_t norm_alloc, norm_space, total_alloc, total_found; int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD; boolean_t leaks = B_FALSE; + int err; bzero(&zcb, sizeof (zcb)); (void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n", @@ -3707,8 +3762,10 @@ dump_block_stats(spa_t *spa) flags |= TRAVERSE_PREFETCH_DATA; zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa)); + zcb.zcb_totalasize += metaslab_class_get_alloc(spa_special_class(spa)); + zcb.zcb_totalasize += metaslab_class_get_alloc(spa_dedup_class(spa)); zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); - zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); + err = traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); /* * If we've traversed the data blocks then we need to wait for those @@ -3724,6 +3781,12 @@ dump_block_stats(spa_t *spa) } } + /* + * Done after zio_wait() since zcb_haderrors is modified in + * zdb_blkptr_done() + */ + zcb.zcb_haderrors |= err; + if (zcb.zcb_haderrors) { (void) printf("\nError counts:\n\n"); (void) printf("\t%5s %s\n", "errno", "count"); @@ -3745,7 +3808,10 @@ dump_block_stats(spa_t *spa) norm_alloc = metaslab_class_get_alloc(spa_normal_class(spa)); norm_space = metaslab_class_get_space(spa_normal_class(spa)); - total_alloc = norm_alloc + metaslab_class_get_alloc(spa_log_class(spa)); + total_alloc = norm_alloc + + metaslab_class_get_alloc(spa_log_class(spa)) + + metaslab_class_get_alloc(spa_special_class(spa)) + + metaslab_class_get_alloc(spa_dedup_class(spa)); total_found = tzb->zb_asize - zcb.zcb_dedup_asize + zcb.zcb_removing_size + zcb.zcb_checkpoint_size; @@ -3767,31 +3833,50 @@ dump_block_stats(spa_t *spa) return (2); (void) printf("\n"); - (void) printf("\tbp count: %10llu\n", + (void) printf("\t%-16s %14llu\n", "bp count:", (u_longlong_t)tzb->zb_count); - (void) printf("\tganged count: %10llu\n", + (void) printf("\t%-16s %14llu\n", "ganged count:", (longlong_t)tzb->zb_gangs); - (void) printf("\tbp logical: %10llu avg: %6llu\n", + (void) printf("\t%-16s %14llu avg: %6llu\n", "bp logical:", (u_longlong_t)tzb->zb_lsize, (u_longlong_t)(tzb->zb_lsize / tzb->zb_count)); - (void) printf("\tbp physical: %10llu avg:" - " %6llu compression: %6.2f\n", - (u_longlong_t)tzb->zb_psize, + (void) printf("\t%-16s %14llu avg: %6llu compression: %6.2f\n", + "bp physical:", (u_longlong_t)tzb->zb_psize, (u_longlong_t)(tzb->zb_psize / tzb->zb_count), (double)tzb->zb_lsize / tzb->zb_psize); - (void) printf("\tbp allocated: %10llu avg:" - " %6llu compression: %6.2f\n", - (u_longlong_t)tzb->zb_asize, + (void) printf("\t%-16s %14llu avg: %6llu compression: %6.2f\n", + "bp allocated:", (u_longlong_t)tzb->zb_asize, (u_longlong_t)(tzb->zb_asize / tzb->zb_count), (double)tzb->zb_lsize / tzb->zb_asize); - (void) printf("\tbp deduped: %10llu ref>1:" - " %6llu deduplication: %6.2f\n", - (u_longlong_t)zcb.zcb_dedup_asize, + (void) printf("\t%-16s %14llu ref>1: %6llu deduplication: %6.2f\n", + "bp deduped:", (u_longlong_t)zcb.zcb_dedup_asize, (u_longlong_t)zcb.zcb_dedup_blocks, (double)zcb.zcb_dedup_asize / tzb->zb_asize + 1.0); - (void) printf("\tSPA allocated: %10llu used: %5.2f%%\n", + (void) printf("\t%-16s %14llu used: %5.2f%%\n", "Normal class:", (u_longlong_t)norm_alloc, 100.0 * norm_alloc / norm_space); + if (spa_special_class(spa)->mc_rotor != NULL) { + uint64_t alloc = metaslab_class_get_alloc( + spa_special_class(spa)); + uint64_t space = metaslab_class_get_space( + spa_special_class(spa)); + + (void) printf("\t%-16s %14llu used: %5.2f%%\n", + "Special class", (u_longlong_t)alloc, + 100.0 * alloc / space); + } + + if (spa_dedup_class(spa)->mc_rotor != NULL) { + uint64_t alloc = metaslab_class_get_alloc( + spa_dedup_class(spa)); + uint64_t space = metaslab_class_get_space( + spa_dedup_class(spa)); + + (void) printf("\t%-16s %14llu used: %5.2f%%\n", + "Dedup class", (u_longlong_t)alloc, + 100.0 * alloc / space); + } + for (bp_embedded_type_t i = 0; i < NUM_BP_EMBEDDED_TYPES; i++) { if (zcb.zcb_embedded_blocks[i] == 0) continue; @@ -3812,6 +3897,10 @@ dump_block_stats(spa_t *spa) if (tzb->zb_ditto_samevdev != 0) { (void) printf("\tDittoed blocks on same vdev: %llu\n", (longlong_t)tzb->zb_ditto_samevdev); + } + if (tzb->zb_ditto_same_ms != 0) { + (void) printf("\tDittoed blocks in same metaslab: %llu\n", + (longlong_t)tzb->zb_ditto_same_ms); } for (uint64_t v = 0; v < spa->spa_root_vdev->vdev_children; v++) { Modified: vendor/illumos/dist/cmd/zpool/zpool_main.c ============================================================================== --- vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:55:23 2019 (r354381) +++ vendor/illumos/dist/cmd/zpool/zpool_main.c Wed Nov 6 08:58:03 2019 (r354382) @@ -27,6 +27,7 @@ * Copyright 2016 Igor Kozhukhov . * Copyright 2016 Nexenta Systems, Inc. * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2017, Intel Corporation. */ #include @@ -206,6 +207,8 @@ static zpool_command_t command_table[] = { #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) +#define VDEV_ALLOC_CLASS_LOGS "logs" + static zpool_command_t *current_command; static char history_str[HIS_MAX_RECORD_LEN]; static boolean_t log_history = B_TRUE; @@ -216,7 +219,7 @@ get_usage(zpool_help_t idx) { switch (idx) { case HELP_ADD: - return (gettext("\tadd [-fn] ...\n")); + return (gettext("\tadd [-fgLnP] ...\n")); case HELP_ATTACH: return (gettext("\tattach [-f] " "\n")); @@ -248,12 +251,12 @@ get_usage(zpool_help_t idx) "[-R root] [-F [-n]] [-t]\n" "\t [--rewind-to-checkpoint] [newpool]\n")); case HELP_IOSTAT: - return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " - "[count]]\n")); + return (gettext("\tiostat [-gLPv] [-T d|u] [pool] ... " + "[interval [count]]\n")); case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-Hp] [-o property[,...]] " + return (gettext("\tlist [-gHLpPv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); @@ -271,8 +274,8 @@ get_usage(zpool_help_t idx) case HELP_SCRUB: return (gettext("\tscrub [-s | -p] ...\n")); case HELP_STATUS: - return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " - "[count]]\n")); + return (gettext("\tstatus [-DgLPvx] [-T d|u] [pool] ... " + "[interval [count]]\n")); case HELP_UPGRADE: return (gettext("\tupgrade\n" "\tupgrade -v\n" @@ -283,7 +286,7 @@ get_usage(zpool_help_t idx) case HELP_SET: return (gettext("\tset \n")); case HELP_SPLIT: - return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" + return (gettext("\tsplit [-gLnP] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); case HELP_REGUID: @@ -305,7 +308,7 @@ print_prop_cb(int prop, void *cb) { FILE *fp = cb; - (void) fprintf(fp, "\t%-15s ", zpool_prop_to_name(prop)); + (void) fprintf(fp, "\t%-19s ", zpool_prop_to_name(prop)); if (zpool_prop_readonly(prop)) (void) fprintf(fp, " NO "); @@ -357,14 +360,14 @@ usage(boolean_t requested) (void) fprintf(fp, gettext("\nthe following properties are supported:\n")); - (void) fprintf(fp, "\n\t%-15s %s %s\n\n", + (void) fprintf(fp, "\n\t%-19s %s %s\n\n", "PROPERTY", "EDIT", "VALUES"); /* Iterate over all properties */ (void) zprop_iter(print_prop_cb, fp, B_FALSE, B_TRUE, ZFS_TYPE_POOL); - (void) fprintf(fp, "\t%-15s ", "feature@..."); + (void) fprintf(fp, "\t%-19s ", "feature@..."); (void) fprintf(fp, "YES disabled | enabled | active\n"); (void) fprintf(fp, gettext("\nThe feature@ properties must be " @@ -382,32 +385,45 @@ usage(boolean_t requested) exit(requested ? 0 : 2); } -void +/* + * print a pool vdev config for dry runs + */ +static void print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent, - boolean_t print_logs) + const char *match, int name_flags) { nvlist_t **child; uint_t c, children; char *vname; + boolean_t printed = B_FALSE; - if (name != NULL) - (void) printf("\t%*s%s\n", indent, "", name); - if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - &child, &children) != 0) + &child, &children) != 0) { + if (name != NULL) + (void) printf("\t%*s%s\n", indent, "", name); return; + } for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; + char *class = ""; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); - if ((is_log && !print_logs) || (!is_log && print_logs)) + if (is_log) + class = VDEV_ALLOC_BIAS_LOG; + (void) nvlist_lookup_string(child[c], + ZPOOL_CONFIG_ALLOCATION_BIAS, &class); + if (strcmp(match, class) != 0) continue; - vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); - print_vdev_tree(zhp, vname, child[c], indent + 2, - B_FALSE); + if (!printed && name != NULL) { + (void) printf("\t%*s%s\n", indent, "", name); + printed = B_TRUE; + } + vname = zpool_vdev_name(g_zfs, zhp, child[c], name_flags); + print_vdev_tree(zhp, vname, child[c], indent + 2, "", + name_flags); free(vname); } } @@ -515,11 +531,14 @@ add_prop_list_default(const char *propname, char *prop } /* - * zpool add [-fn] ... + * zpool add [-fgLnP] [-o property=value] ... * * -f Force addition of devices, even if they appear in use + * -g Display guid for individual vdev name. + * -L Follow links when resolving vdev path name. * -n Do not add the devices, but display the resulting layout if * they were to be added. + * -P Display full path for vdev name. * * Adds the given vdevs to 'pool'. As with create, the bulk of this work is * handled by get_vdev_spec(), which constructs the nvlist needed to pass to @@ -530,6 +549,7 @@ zpool_do_add(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; + int name_flags = 0; int c; nvlist_t *nvroot; char *poolname; @@ -540,14 +560,23 @@ zpool_do_add(int argc, char **argv) nvlist_t *config; /* check options */ - while ((c = getopt(argc, argv, "fn")) != -1) { + while ((c = getopt(argc, argv, "fgLnP")) != -1) { switch (c) { case 'f': force = B_TRUE; break; + case 'g': + name_flags |= VDEV_NAME_GUID; + break; + case 'L': + name_flags |= VDEV_NAME_FOLLOW_LINKS; + break; case 'n': dryrun = B_TRUE; break; + case 'P': + name_flags |= VDEV_NAME_PATH; + break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -607,17 +636,26 @@ zpool_do_add(int argc, char **argv) "configuration:\n"), zpool_get_name(zhp)); /* print original main pool and new tree */ - print_vdev_tree(zhp, poolname, poolnvroot, 0, B_FALSE); - print_vdev_tree(zhp, NULL, nvroot, 0, B_FALSE); + print_vdev_tree(zhp, poolname, poolnvroot, 0, "", + name_flags | VDEV_NAME_TYPE_ID); + print_vdev_tree(zhp, NULL, nvroot, 0, "", name_flags); - /* Do the same for the logs */ - if (num_logs(poolnvroot) > 0) { - print_vdev_tree(zhp, "logs", poolnvroot, 0, B_TRUE); - print_vdev_tree(zhp, NULL, nvroot, 0, B_TRUE); - } else if (num_logs(nvroot) > 0) { - print_vdev_tree(zhp, "logs", nvroot, 0, B_TRUE); - } + /* print other classes: 'dedup', 'special', and 'log' */ + print_vdev_tree(zhp, "dedup", poolnvroot, 0, + VDEV_ALLOC_BIAS_DEDUP, name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_DEDUP, + name_flags); + print_vdev_tree(zhp, "special", poolnvroot, 0, + VDEV_ALLOC_BIAS_SPECIAL, name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_SPECIAL, + name_flags); + + print_vdev_tree(zhp, "logs", poolnvroot, 0, VDEV_ALLOC_BIAS_LOG, + name_flags); + print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_LOG, + name_flags); + ret = 0; } else { ret = (zpool_add(zhp, nvroot) != 0); @@ -1203,9 +1241,13 @@ zpool_do_create(int argc, char **argv) (void) printf(gettext("would create '%s' with the " "following layout:\n\n"), poolname); - print_vdev_tree(NULL, poolname, nvroot, 0, B_FALSE); - if (num_logs(nvroot) > 0) - print_vdev_tree(NULL, "logs", nvroot, 0, B_TRUE); + print_vdev_tree(NULL, poolname, nvroot, 0, "", 0); + print_vdev_tree(NULL, "dedup", nvroot, 0, + VDEV_ALLOC_BIAS_DEDUP, 0); + print_vdev_tree(NULL, "special", nvroot, 0, + VDEV_ALLOC_BIAS_SPECIAL, 0); + print_vdev_tree(NULL, "logs", nvroot, 0, + VDEV_ALLOC_BIAS_LOG, 0); ret = 0; } else { @@ -1412,13 +1454,15 @@ zpool_do_export(int argc, char **argv) * name column. */ static int -max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max) +max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max, + int name_flags) { - char *name = zpool_vdev_name(g_zfs, zhp, nv, B_TRUE); + char *name; nvlist_t **child; uint_t c, children; int ret; + name = zpool_vdev_name(g_zfs, zhp, nv, name_flags | VDEV_NAME_TYPE_ID); if (strlen(name) + depth > max) max = strlen(name) + depth; @@ -1428,7 +1472,7 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } @@ -1436,7 +1480,7 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } @@ -1444,11 +1488,10 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, - max)) > max) + max, name_flags)) > max) max = ret; } - return (max); } @@ -1497,12 +1540,24 @@ find_spare(zpool_handle_t *zhp, void *data) return (0); } +typedef struct status_cbdata { + int cb_count; + int cb_name_flags; + int cb_namewidth; + boolean_t cb_allpools; + boolean_t cb_verbose; + boolean_t cb_explain; + boolean_t cb_first; + boolean_t cb_dedup_stats; + boolean_t cb_print_status; +} status_cbdata_t; + /* * Print out configuration state as requested by status_callback. */ -void -print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv, - int namewidth, int depth, boolean_t isspare) +static void +print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name, + nvlist_t *nv, int depth, boolean_t isspare) { nvlist_t **child; uint_t c, children; @@ -1511,7 +1566,7 @@ print_status_config(zpool_handle_t *zhp, const char *n char rbuf[6], wbuf[6], cbuf[6]; char *vname; uint64_t notpresent; - spare_cbdata_t cb; + spare_cbdata_t spare_cb; const char *state; char *type; @@ -1539,7 +1594,7 @@ print_status_config(zpool_handle_t *zhp, const char *n state = "AVAIL"; } - (void) printf("\t%*s%-*s %-8s", depth, "", namewidth - depth, + (void) printf("\t%*s%-*s %-8s", depth, "", cb->cb_namewidth - depth, name, state); if (!isspare) { @@ -1580,17 +1635,17 @@ print_status_config(zpool_handle_t *zhp, const char *n case VDEV_AUX_SPARED: verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, - &cb.cb_guid) == 0); - if (zpool_iter(g_zfs, find_spare, &cb) == 1) { - if (strcmp(zpool_get_name(cb.cb_zhp), + &spare_cb.cb_guid) == 0); + if (zpool_iter(g_zfs, find_spare, &spare_cb) == 1) { + if (strcmp(zpool_get_name(spare_cb.cb_zhp), zpool_get_name(zhp)) == 0) (void) printf(gettext("currently in " "use")); else (void) printf(gettext("in use by " "pool '%s'"), - zpool_get_name(cb.cb_zhp)); - zpool_close(cb.cb_zhp); + zpool_get_name(spare_cb.cb_zhp)); + zpool_close(spare_cb.cb_zhp); } else { (void) printf(gettext("currently in use")); } @@ -1689,20 +1744,25 @@ print_status_config(zpool_handle_t *zhp, const char *n &ishole); if (islog || ishole) continue; - vname = zpool_vdev_name(g_zfs, zhp, child[c], B_TRUE); - print_status_config(zhp, vname, child[c], - namewidth, depth + 2, isspare); + /* Only print normal classes here */ + if (nvlist_exists(child[c], ZPOOL_CONFIG_ALLOCATION_BIAS)) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, child[c], + cb->cb_name_flags | VDEV_NAME_TYPE_ID); + print_status_config(zhp, cb, vname, child[c], depth + 2, + isspare); free(vname); } } - /* * Print the configuration of an exported pool. Iterate over all vdevs in the * pool, printing out the name and status for each one. */ -void -print_import_config(const char *name, nvlist_t *nv, int namewidth, int depth) +static void +print_import_config(status_cbdata_t *cb, const char *name, nvlist_t *nv, + int depth) { nvlist_t **child; uint_t c, children; @@ -1717,7 +1777,7 @@ print_import_config(const char *name, nvlist_t *nv, in verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) == 0); - (void) printf("\t%*s%-*s", depth, "", namewidth - depth, name); + (void) printf("\t%*s%-*s", depth, "", cb->cb_namewidth - depth, name); (void) printf(" %s", zpool_state_to_name(vs->vs_state, vs->vs_aux)); if (vs->vs_aux != 0) { @@ -1774,9 +1834,12 @@ print_import_config(const char *name, nvlist_t *nv, in &is_log); if (is_log) continue; + if (nvlist_exists(child[c], ZPOOL_CONFIG_ALLOCATION_BIAS)) + continue; - vname = zpool_vdev_name(g_zfs, NULL, child[c], B_TRUE); - print_import_config(vname, child[c], namewidth, depth + 2); + vname = zpool_vdev_name(g_zfs, NULL, child[c], + cb->cb_name_flags | VDEV_NAME_TYPE_ID); + print_import_config(cb, vname, child[c], depth + 2); free(vname); } @@ -1784,7 +1847,8 @@ print_import_config(const char *name, nvlist_t *nv, in &child, &children) == 0) { (void) printf(gettext("\tcache\n")); for (c = 0; c < children; c++) { - vname = zpool_vdev_name(g_zfs, NULL, child[c], B_FALSE); + vname = zpool_vdev_name(g_zfs, NULL, child[c], + cb->cb_name_flags); (void) printf("\t %s\n", vname); free(vname); } @@ -1794,7 +1858,8 @@ print_import_config(const char *name, nvlist_t *nv, in &child, &children) == 0) { (void) printf(gettext("\tspares\n")); for (c = 0; c < children; c++) { - vname = zpool_vdev_name(g_zfs, NULL, child[c], B_FALSE); + vname = zpool_vdev_name(g_zfs, NULL, child[c], + cb->cb_name_flags); (void) printf("\t %s\n", vname); free(vname); } @@ -1802,39 +1867,62 @@ print_import_config(const char *name, nvlist_t *nv, in } /* - * Print log vdevs. - * Logs are recorded as top level vdevs in the main pool child array - * but with "is_log" set to 1. We use either print_status_config() or - * print_import_config() to print the top level logs then any log - * children (eg mirrored slogs) are printed recursively - which - * works because only the top level vdev is marked "is_log" + * Print specialized class vdevs. + * + * These are recorded as top level vdevs in the main pool child array + * but with "is_log" set to 1 or an "alloc_bias" string. We use either + * print_status_config() or print_import_config() to print the top level + * class vdevs then any of their children (eg mirrored slogs) are printed + * recursively - which works because only the top level vdev is marked. */ static void -print_logs(zpool_handle_t *zhp, nvlist_t *nv, int namewidth, boolean_t verbose) +print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv, + const char *class) { uint_t c, children; nvlist_t **child; + boolean_t printed = B_FALSE; + assert(zhp != NULL || !cb->cb_verbose); + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) return; - (void) printf(gettext("\tlogs\n")); - for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; - char *name; + char *bias = NULL; + char *type = NULL; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); - if (!is_log) + + if (is_log) { + bias = VDEV_ALLOC_CLASS_LOGS; + } else { + (void) nvlist_lookup_string(child[c], + ZPOOL_CONFIG_ALLOCATION_BIAS, &bias); + (void) nvlist_lookup_string(child[c], + ZPOOL_CONFIG_TYPE, &type); + } + + if (bias == NULL || strcmp(bias, class) != 0) continue; - name = zpool_vdev_name(g_zfs, zhp, child[c], B_TRUE); - if (verbose) - print_status_config(zhp, name, child[c], namewidth, - 2, B_FALSE); + if (!is_log && strcmp(type, VDEV_TYPE_INDIRECT) == 0) + continue; + + if (!printed) { + (void) printf("\t%s\t\n", gettext(class)); + printed = B_TRUE; + } + + char *name = zpool_vdev_name(g_zfs, zhp, child[c], + cb->cb_name_flags | VDEV_NAME_TYPE_ID); + if (cb->cb_print_status) + print_status_config(zhp, cb, name, child[c], 2, + B_FALSE); else - print_import_config(name, child[c], namewidth, 2); + print_import_config(cb, name, child[c], 2); free(name); } } @@ -1856,8 +1944,8 @@ show_import(nvlist_t *config) int reason; const char *health; uint_t vsc; - int namewidth; char *comment; + status_cbdata_t cb = { 0 }; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); @@ -2083,14 +2171,16 @@ show_import(nvlist_t *config) (void) printf(gettext(" config:\n\n")); - namewidth = max_width(NULL, nvroot, 0, 0); - if (namewidth < 10) - namewidth = 10; + cb.cb_namewidth = max_width(NULL, nvroot, 0, 0, 0); + if (cb.cb_namewidth < 10) + cb.cb_namewidth = 10; - print_import_config(name, nvroot, namewidth, 0); - if (num_logs(nvroot) > 0) - print_logs(NULL, nvroot, namewidth, B_FALSE); + print_import_config(&cb, name, nvroot, 0); + print_class_vdevs(NULL, &cb, nvroot, VDEV_ALLOC_BIAS_DEDUP); + print_class_vdevs(NULL, &cb, nvroot, VDEV_ALLOC_BIAS_SPECIAL); + print_class_vdevs(NULL, &cb, nvroot, VDEV_ALLOC_CLASS_LOGS); + if (reason == ZPOOL_STATUS_BAD_GUID_SUM) { (void) printf(gettext("\n\tAdditional devices are known to " "be part of this pool, though their\n\texact " @@ -2751,8 +2841,10 @@ zpool_do_sync(int argc, char **argv) typedef struct iostat_cbdata { boolean_t cb_verbose; + int cb_name_flags; int cb_namewidth; int cb_iteration; + boolean_t cb_scripted; zpool_list_t *cb_list; } iostat_cbdata_t; @@ -2788,12 +2880,20 @@ print_one_stat(uint64_t value) (void) printf(" %5s", buf); } +static const char *class_name[] = { + VDEV_ALLOC_BIAS_DEDUP, + VDEV_ALLOC_BIAS_SPECIAL, + VDEV_ALLOC_CLASS_LOGS +}; + /* * Print out all the statistics for the given vdev. This can either be the * toplevel configuration, or called recursively. If 'name' is NULL, then this * is a verbose output, and we don't want to display the toplevel pool stats. + * + * Returns the number of stat lines printed. */ -void +static unsigned int print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, nvlist_t *newnv, iostat_cbdata_t *cb, int depth) { @@ -2801,12 +2901,13 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name uint_t c, children; vdev_stat_t *oldvs, *newvs; vdev_stat_t zerovs = { 0 }; + char *vname; + int ret = 0; uint64_t tdelta; double scale; - char *vname; if (strcmp(name, VDEV_TYPE_INDIRECT) == 0) - return; + return (ret); if (oldnv != NULL) { verify(nvlist_lookup_uint64_array(oldnv, @@ -2854,16 +2955,19 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name (void) printf("\n"); if (!cb->cb_verbose) - return; + return (ret); if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_CHILDREN, &newchild, &children) != 0) - return; + return (ret); if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_CHILDREN, &oldchild, &c) != 0) - return; + return (ret); + /* + * print normal top-level devices + */ for (c = 0; c < children; c++) { uint64_t ishole = B_FALSE, islog = B_FALSE; @@ -2876,33 +2980,45 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name if (ishole || islog) continue; - vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); + if (nvlist_exists(newchild[c], ZPOOL_CONFIG_ALLOCATION_BIAS)) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + cb->cb_name_flags); print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } /* - * Log device section + * print all other top-level devices */ - - if (num_logs(newnv) > 0) { - (void) printf("%-*s - - - - - " - "-\n", cb->cb_namewidth, "logs"); - + for (uint_t n = 0; n < 3; n++) { for (c = 0; c < children; c++) { uint64_t islog = B_FALSE; + char *bias = NULL; + char *type = NULL; + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, &islog); - if (islog) { - vname = zpool_vdev_name(g_zfs, zhp, newchild[c], - B_FALSE); - print_vdev_stats(zhp, vname, oldnv ? - oldchild[c] : NULL, newchild[c], - cb, depth + 2); - free(vname); + bias = VDEV_ALLOC_CLASS_LOGS; + } else { + (void) nvlist_lookup_string(newchild[c], + ZPOOL_CONFIG_ALLOCATION_BIAS, &bias); + (void) nvlist_lookup_string(newchild[c], + ZPOOL_CONFIG_TYPE, &type); } + if (bias == NULL || strcmp(bias, class_name[n]) != 0) + continue; + if (!islog && strcmp(type, VDEV_TYPE_INDIRECT) == 0) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + cb->cb_name_flags); + ret += print_vdev_stats(zhp, vname, oldnv ? + oldchild[c] : NULL, newchild[c], cb, depth + 2); + free(vname); } } @@ -2912,23 +3028,25 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, &newchild, &children) != 0) - return; + return (ret); if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_L2CACHE, &oldchild, &c) != 0) - return; + return (ret); if (children > 0) { (void) printf("%-*s - - - - - " "-\n", cb->cb_namewidth, "cache"); for (c = 0; c < children; c++) { vname = zpool_vdev_name(g_zfs, zhp, newchild[c], - B_FALSE); + cb->cb_name_flags); print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } } + + return (ret); } static int @@ -2997,7 +3115,7 @@ get_namewidth(zpool_handle_t *zhp, void *data) cb->cb_namewidth = strlen(zpool_get_name(zhp)); else cb->cb_namewidth = max_width(zhp, nvroot, 0, - cb->cb_namewidth); + cb->cb_namewidth, cb->cb_name_flags); } /* @@ -3095,8 +3213,11 @@ get_timestamp_arg(char c) } /* - * zpool iostat [-v] [-T d|u] [pool] ... [interval [count]] + * zpool iostat [-gLPv] [-T d|u] [pool] ... [interval [count]] * + * -g Display guid for individual vdev name. + * -L Follow links when resolving vdev path name. + * -P Display full path for vdev name. * -v Display statistics for individual vdevs * -T Display a timestamp in date(1) or Unix format * @@ -3115,11 +3236,23 @@ zpool_do_iostat(int argc, char **argv) unsigned long interval = 0, count = 0; zpool_list_t *list; boolean_t verbose = B_FALSE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 09:00:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EA0A1AF13B; Wed, 6 Nov 2019 09:00:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L8S0lPQz3KWg; Wed, 6 Nov 2019 09:00:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1DA3229DE; Wed, 6 Nov 2019 09:00:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6907wT047388; Wed, 6 Nov 2019 09:00:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6907VL047386; Wed, 6 Nov 2019 09:00:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060900.xA6907VL047386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354383 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/man/man1m X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 354383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:00:08 -0000 Author: avg Date: Wed Nov 6 09:00:06 2019 New Revision: 354383 URL: https://svnweb.freebsd.org/changeset/base/354383 Log: 10592 misc. metaslab and vdev related ZoL bug fixes illumos/illumos-gate@555d674d5d4b8191dc83723188349d28278b2431 https://github.com/illumos/illumos-gate/commit/555d674d5d4b8191dc83723188349d28278b2431 https://www.illumos.org/issues/10592 This is a collection of recent fixes from ZoL: 8eef997679b Error path in metaslab_load_impl() forgets to drop ms_sync_lock 928e8ad47d3 Introduce auxiliary metaslab histograms 425d3237ee8 Get rid of space_map_update() for ms_synced_length 6c926f426a2 Simplify log vdev removal code 21e7cf5da89 zdb -L should skip leak detection altogether df72b8bebe0 Rename range_tree_verify to range_tree_verify_not_present 75058f33034 Remove unused vdev_t fields Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/man/man1m/zdb.1m Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 08:58:03 2019 (r354382) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 09:00:06 2019 (r354383) @@ -785,18 +785,21 @@ dump_spacemap(objset_t *os, space_map_t *sm) return; (void) printf("space map object %llu:\n", - (longlong_t)sm->sm_phys->smp_object); - (void) printf(" smp_objsize = 0x%llx\n", - (longlong_t)sm->sm_phys->smp_objsize); + (longlong_t)sm->sm_object); + (void) printf(" smp_length = 0x%llx\n", + (longlong_t)sm->sm_phys->smp_length); (void) printf(" smp_alloc = 0x%llx\n", (longlong_t)sm->sm_phys->smp_alloc); + if (dump_opt['d'] < 6 && dump_opt['m'] < 4) + return; + /* * Print out the freelist entries in both encoded and decoded form. */ uint8_t mapshift = sm->sm_shift; int64_t alloc = 0; - uint64_t word; + uint64_t word, entry_id = 0; for (uint64_t offset = 0; offset < space_map_length(sm); offset += sizeof (word)) { @@ -804,11 +807,12 @@ dump_spacemap(objset_t *os, space_map_t *sm) sizeof (word), &word, DMU_READ_PREFETCH)); if (sm_entry_is_debug(word)) { - (void) printf("\t [%6llu] %s: txg %llu, pass %llu\n", - (u_longlong_t)(offset / sizeof (word)), + (void) printf("\t [%6llu] %s: txg %llu pass %llu\n", + (u_longlong_t)entry_id, ddata[SM_DEBUG_ACTION_DECODE(word)], (u_longlong_t)SM_DEBUG_TXG_DECODE(word), (u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(word)); + entry_id++; continue; } @@ -846,7 +850,7 @@ dump_spacemap(objset_t *os, space_map_t *sm) (void) printf("\t [%6llu] %c range:" " %010llx-%010llx size: %06llx vdev: %06llu words: %u\n", - (u_longlong_t)(offset / sizeof (word)), + (u_longlong_t)entry_id, entry_type, (u_longlong_t)entry_off, (u_longlong_t)(entry_off + entry_run), (u_longlong_t)entry_run, @@ -856,8 +860,9 @@ dump_spacemap(objset_t *os, space_map_t *sm) alloc += entry_run; else alloc -= entry_run; + entry_id++; } - if ((uint64_t)alloc != space_map_allocated(sm)) { + if (alloc != space_map_allocated(sm)) { (void) printf("space_map_object alloc (%lld) INCONSISTENT " "with space map summary (%lld)\n", (longlong_t)space_map_allocated(sm), (longlong_t)alloc); @@ -921,11 +926,8 @@ dump_metaslab(metaslab_t *msp) SPACE_MAP_HISTOGRAM_SIZE, sm->sm_shift); } - if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { - ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); - - dump_spacemap(spa->spa_meta_objset, msp->ms_sm); - } + ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift)); + dump_spacemap(spa->spa_meta_objset, msp->ms_sm); } static void @@ -3096,6 +3098,8 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) ddt_entry_t dde; int error; + ASSERT(!dump_opt['L']); + bzero(&ddb, sizeof (ddb)); while ((error = ddt_walk(spa, &ddb, &dde)) == 0) { blkptr_t blk; @@ -3119,12 +3123,10 @@ zdb_ddt_leak_init(spa_t *spa, zdb_cb_t *zcb) zcb->zcb_dedup_blocks++; } } - if (!dump_opt['L']) { - ddt_t *ddt = spa->spa_ddt[ddb.ddb_checksum]; - ddt_enter(ddt); - VERIFY(ddt_lookup(ddt, &blk, B_TRUE) != NULL); - ddt_exit(ddt); - } + ddt_t *ddt = spa->spa_ddt[ddb.ddb_checksum]; + ddt_enter(ddt); + VERIFY(ddt_lookup(ddt, &blk, B_TRUE) != NULL); + ddt_exit(ddt); } ASSERT(error == ENOENT); @@ -3166,6 +3168,9 @@ claim_segment_cb(void *arg, uint64_t offset, uint64_t static void zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb) { + if (dump_opt['L']) + return; + if (spa->spa_vdev_removal == NULL) return; @@ -3257,7 +3262,6 @@ zdb_load_obsolete_counts(vdev_t *vd) space_map_t *prev_obsolete_sm = NULL; VERIFY0(space_map_open(&prev_obsolete_sm, spa->spa_meta_objset, scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); - space_map_update(prev_obsolete_sm); vdev_indirect_mapping_load_obsolete_spacemap(vim, counts, prev_obsolete_sm); space_map_close(prev_obsolete_sm); @@ -3351,9 +3355,9 @@ zdb_leak_init_vdev_exclude_checkpoint(vdev_t *vd, zdb_ VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(spa), checkpoint_sm_obj, 0, vd->vdev_asize, vd->vdev_ashift)); - space_map_update(checkpoint_sm); VERIFY0(space_map_iterate(checkpoint_sm, + space_map_length(checkpoint_sm), checkpoint_sm_exclude_entry_cb, &cseea)); space_map_close(checkpoint_sm); @@ -3363,6 +3367,8 @@ zdb_leak_init_vdev_exclude_checkpoint(vdev_t *vd, zdb_ static void zdb_leak_init_exclude_checkpoint(spa_t *spa, zdb_cb_t *zcb) { + ASSERT(!dump_opt['L']); + vdev_t *rvd = spa->spa_root_vdev; for (uint64_t c = 0; c < rvd->vdev_children; c++) { ASSERT3U(c, ==, rvd->vdev_child[c]->vdev_id); @@ -3459,6 +3465,8 @@ load_indirect_ms_allocatable_tree(vdev_t *vd, metaslab static void zdb_leak_init_prepare_indirect_vdevs(spa_t *spa, zdb_cb_t *zcb) { + ASSERT(!dump_opt['L']); + vdev_t *rvd = spa->spa_root_vdev; for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; @@ -3505,67 +3513,63 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) { zcb->zcb_spa = spa; - if (!dump_opt['L']) { - dsl_pool_t *dp = spa->spa_dsl_pool; - vdev_t *rvd = spa->spa_root_vdev; + if (dump_opt['L']) + return; - /* - * We are going to be changing the meaning of the metaslab's - * ms_allocatable. Ensure that the allocator doesn't try to - * use the tree. - */ - spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; - spa->spa_log_class->mc_ops = &zdb_metaslab_ops; + dsl_pool_t *dp = spa->spa_dsl_pool; + vdev_t *rvd = spa->spa_root_vdev; - zcb->zcb_vd_obsolete_counts = - umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), - UMEM_NOFAIL); + /* + * We are going to be changing the meaning of the metaslab's + * ms_allocatable. Ensure that the allocator doesn't try to + * use the tree. + */ + spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; + spa->spa_log_class->mc_ops = &zdb_metaslab_ops; - /* - * For leak detection, we overload the ms_allocatable trees - * to contain allocated segments instead of free segments. - * As a result, we can't use the normal metaslab_load/unload - * interfaces. - */ - zdb_leak_init_prepare_indirect_vdevs(spa, zcb); - load_concrete_ms_allocatable_trees(spa, SM_ALLOC); + zcb->zcb_vd_obsolete_counts = + umem_zalloc(rvd->vdev_children * sizeof (uint32_t *), + UMEM_NOFAIL); - /* - * On load_concrete_ms_allocatable_trees() we loaded all the - * allocated entries from the ms_sm to the ms_allocatable for - * each metaslab. If the pool has a checkpoint or is in the - * middle of discarding a checkpoint, some of these blocks - * may have been freed but their ms_sm may not have been - * updated because they are referenced by the checkpoint. In - * order to avoid false-positives during leak-detection, we - * go through the vdev's checkpoint space map and exclude all - * its entries from their relevant ms_allocatable. - * - * We also aggregate the space held by the checkpoint and add - * it to zcb_checkpoint_size. - * - * Note that at this point we are also verifying that all the - * entries on the checkpoint_sm are marked as allocated in - * the ms_sm of their relevant metaslab. - * [see comment in checkpoint_sm_exclude_entry_cb()] - */ - zdb_leak_init_exclude_checkpoint(spa, zcb); + /* + * For leak detection, we overload the ms_allocatable trees + * to contain allocated segments instead of free segments. + * As a result, we can't use the normal metaslab_load/unload + * interfaces. + */ + zdb_leak_init_prepare_indirect_vdevs(spa, zcb); + load_concrete_ms_allocatable_trees(spa, SM_ALLOC); - /* for cleaner progress output */ - (void) fprintf(stderr, "\n"); + /* + * On load_concrete_ms_allocatable_trees() we loaded all the + * allocated entries from the ms_sm to the ms_allocatable for + * each metaslab. If the pool has a checkpoint or is in the + * middle of discarding a checkpoint, some of these blocks + * may have been freed but their ms_sm may not have been + * updated because they are referenced by the checkpoint. In + * order to avoid false-positives during leak-detection, we + * go through the vdev's checkpoint space map and exclude all + * its entries from their relevant ms_allocatable. + * + * We also aggregate the space held by the checkpoint and add + * it to zcb_checkpoint_size. + * + * Note that at this point we are also verifying that all the + * entries on the checkpoint_sm are marked as allocated in + * the ms_sm of their relevant metaslab. + * [see comment in checkpoint_sm_exclude_entry_cb()] + */ + zdb_leak_init_exclude_checkpoint(spa, zcb); + ASSERT3U(zcb->zcb_checkpoint_size, ==, spa_get_checkpoint_space(spa)); - if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { - ASSERT(spa_feature_is_enabled(spa, - SPA_FEATURE_DEVICE_REMOVAL)); - (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, - increment_indirect_mapping_cb, zcb, NULL); - } - } else { - /* - * If leak tracing is disabled, we still need to consider - * any checkpointed space in our space verification. - */ - zcb->zcb_checkpoint_size += spa_get_checkpoint_space(spa); + /* for cleaner progress output */ + (void) fprintf(stderr, "\n"); + + if (bpobj_is_open(&dp->dp_obsolete_bpobj)) { + ASSERT(spa_feature_is_enabled(spa, + SPA_FEATURE_DEVICE_REMOVAL)); + (void) bpobj_iterate_nofree(&dp->dp_obsolete_bpobj, + increment_indirect_mapping_cb, zcb, NULL); } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -3646,52 +3650,58 @@ zdb_check_for_obsolete_leaks(vdev_t *vd, zdb_cb_t *zcb static boolean_t zdb_leak_fini(spa_t *spa, zdb_cb_t *zcb) { + if (dump_opt['L']) + return (B_FALSE); + boolean_t leaks = B_FALSE; - if (!dump_opt['L']) { - vdev_t *rvd = spa->spa_root_vdev; - for (unsigned c = 0; c < rvd->vdev_children; c++) { - vdev_t *vd = rvd->vdev_child[c]; - metaslab_group_t *mg = vd->vdev_mg; - if (zcb->zcb_vd_obsolete_counts[c] != NULL) { - leaks |= zdb_check_for_obsolete_leaks(vd, zcb); - } + vdev_t *rvd = spa->spa_root_vdev; + for (unsigned c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; +#if DEBUG + metaslab_group_t *mg = vd->vdev_mg; +#endif - for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - ASSERT3P(mg, ==, msp->ms_group); + if (zcb->zcb_vd_obsolete_counts[c] != NULL) { + leaks |= zdb_check_for_obsolete_leaks(vd, zcb); + } - /* - * ms_allocatable has been overloaded - * to contain allocated segments. Now that - * we finished traversing all blocks, any - * block that remains in the ms_allocatable - * represents an allocated block that we - * did not claim during the traversal. - * Claimed blocks would have been removed - * from the ms_allocatable. For indirect - * vdevs, space remaining in the tree - * represents parts of the mapping that are - * not referenced, which is not a bug. - */ - if (vd->vdev_ops == &vdev_indirect_ops) { - range_tree_vacate(msp->ms_allocatable, - NULL, NULL); - } else { - range_tree_vacate(msp->ms_allocatable, - zdb_leak, vd); - } + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + ASSERT3P(mg, ==, msp->ms_group); - if (msp->ms_loaded) { - msp->ms_loaded = B_FALSE; - } + /* + * ms_allocatable has been overloaded + * to contain allocated segments. Now that + * we finished traversing all blocks, any + * block that remains in the ms_allocatable + * represents an allocated block that we + * did not claim during the traversal. + * Claimed blocks would have been removed + * from the ms_allocatable. For indirect + * vdevs, space remaining in the tree + * represents parts of the mapping that are + * not referenced, which is not a bug. + */ + if (vd->vdev_ops == &vdev_indirect_ops) { + range_tree_vacate(msp->ms_allocatable, + NULL, NULL); + } else { + range_tree_vacate(msp->ms_allocatable, + zdb_leak, vd); } + + if (msp->ms_loaded) { + msp->ms_loaded = B_FALSE; + } } - umem_free(zcb->zcb_vd_obsolete_counts, - rvd->vdev_children * sizeof (uint32_t *)); - zcb->zcb_vd_obsolete_counts = NULL; } + + umem_free(zcb->zcb_vd_obsolete_counts, + rvd->vdev_children * sizeof (uint32_t *)); + zcb->zcb_vd_obsolete_counts = NULL; + return (leaks); } @@ -3730,13 +3740,18 @@ dump_block_stats(spa_t *spa) !dump_opt['L'] ? "nothing leaked " : ""); /* - * Load all space maps as SM_ALLOC maps, then traverse the pool - * claiming each block we discover. If the pool is perfectly - * consistent, the space maps will be empty when we're done. - * Anything left over is a leak; any block we can't claim (because - * it's not part of any space map) is a double allocation, - * reference to a freed block, or an unclaimed log block. + * When leak detection is enabled we load all space maps as SM_ALLOC + * maps, then traverse the pool claiming each block we discover. If + * the pool is perfectly consistent, the segment trees will be empty + * when we're done. Anything left over is a leak; any block we can't + * claim (because it's not part of any space map) is a double + * allocation, reference to a freed block, or an unclaimed log block. + * + * When leak detection is disabled (-L option) we still traverse the + * pool claiming each block we discover, but we skip opening any space + * maps. */ + bzero(&zcb, sizeof (zdb_cb_t)); zdb_leak_init(spa, &zcb); /* @@ -3815,11 +3830,10 @@ dump_block_stats(spa_t *spa) total_found = tzb->zb_asize - zcb.zcb_dedup_asize + zcb.zcb_removing_size + zcb.zcb_checkpoint_size; - if (total_found == total_alloc) { - if (!dump_opt['L']) - (void) printf("\n\tNo leaks (block sum matches space" - " maps exactly)\n"); - } else { + if (total_found == total_alloc && !dump_opt['L']) { + (void) printf("\n\tNo leaks (block sum matches space" + " maps exactly)\n"); + } else if (!dump_opt['L']) { (void) printf("block traversal size %llu != alloc %llu " "(%s %lld)\n", (u_longlong_t)total_found, @@ -4159,7 +4173,6 @@ verify_device_removal_feature_counts(spa_t *spa) spa->spa_meta_objset, scip->scip_prev_obsolete_sm_object, 0, vd->vdev_asize, 0)); - space_map_update(prev_obsolete_sm); dump_spacemap(spa->spa_meta_objset, prev_obsolete_sm); (void) printf("\n"); space_map_close(prev_obsolete_sm); @@ -4365,7 +4378,8 @@ verify_checkpoint_sm_entry_cb(space_map_entry_t *sme, * their respective ms_allocateable trees should not contain them. */ mutex_enter(&ms->ms_lock); - range_tree_verify(ms->ms_allocatable, sme->sme_offset, sme->sme_run); + range_tree_verify_not_present(ms->ms_allocatable, + sme->sme_offset, sme->sme_run); mutex_exit(&ms->ms_lock); return (0); @@ -4428,7 +4442,6 @@ verify_checkpoint_vdev_spacemaps(spa_t *checkpoint, sp VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(current), checkpoint_sm_obj, 0, current_vd->vdev_asize, current_vd->vdev_ashift)); - space_map_update(checkpoint_sm); verify_checkpoint_sm_entry_cb_arg_t vcsec; vcsec.vcsec_vd = ckpoint_vd; @@ -4436,6 +4449,7 @@ verify_checkpoint_vdev_spacemaps(spa_t *checkpoint, sp vcsec.vcsec_num_entries = space_map_length(checkpoint_sm) / sizeof (uint64_t); VERIFY0(space_map_iterate(checkpoint_sm, + space_map_length(checkpoint_sm), verify_checkpoint_sm_entry_cb, &vcsec)); dump_spacemap(current->spa_meta_objset, checkpoint_sm); space_map_close(checkpoint_sm); @@ -4515,7 +4529,7 @@ verify_checkpoint_ms_spacemaps(spa_t *checkpoint, spa_ * are part of the checkpoint were freed by mistake. */ range_tree_walk(ckpoint_msp->ms_allocatable, - (range_tree_func_t *)range_tree_verify, + (range_tree_func_t *)range_tree_verify_not_present, current_msp->ms_allocatable); } } @@ -4527,6 +4541,8 @@ verify_checkpoint_ms_spacemaps(spa_t *checkpoint, spa_ static void verify_checkpoint_blocks(spa_t *spa) { + ASSERT(!dump_opt['L']); + spa_t *checkpoint_spa; char *checkpoint_pool; nvlist_t *config = NULL; @@ -4592,7 +4608,6 @@ dump_leftover_checkpoint_blocks(spa_t *spa) VERIFY0(space_map_open(&checkpoint_sm, spa_meta_objset(spa), checkpoint_sm_obj, 0, vd->vdev_asize, vd->vdev_ashift)); - space_map_update(checkpoint_sm); dump_spacemap(spa->spa_meta_objset, checkpoint_sm); space_map_close(checkpoint_sm); } Modified: vendor/illumos/dist/man/man1m/zdb.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zdb.1m Wed Nov 6 08:58:03 2019 (r354382) +++ vendor/illumos/dist/man/man1m/zdb.1m Wed Nov 6 09:00:06 2019 (r354383) @@ -10,7 +10,7 @@ .\" .\" .\" Copyright 2012, Richard Lowe. -.\" Copyright (c) 2012, 2017 by Delphix. All rights reserved. +.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" .Dd April 14, 2017 @@ -187,7 +187,7 @@ If the .Fl u option is also specified, also display the uberblocks on this device. .It Fl L -Disable leak tracing and the loading of space maps. +Disable leak detection and the loading of space maps. By default, .Nm verifies that all non-free blocks are referenced, which can be very expensive. From owner-svn-src-all@freebsd.org Wed Nov 6 09:00:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C7311AF138; Wed, 6 Nov 2019 09:00:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477L8R3x5Yz3KWf; Wed, 6 Nov 2019 09:00:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A078229DD; Wed, 6 Nov 2019 09:00:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6907An047381; Wed, 6 Nov 2019 09:00:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA69067g047376; Wed, 6 Nov 2019 09:00:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060900.xA69067g047376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354383 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/man/man1m X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb vendor/illumos/dist/man/man1m X-SVN-Commit-Revision: 354383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:00:07 -0000 Author: avg Date: Wed Nov 6 09:00:06 2019 New Revision: 354383 URL: https://svnweb.freebsd.org/changeset/base/354383 Log: 10592 misc. metaslab and vdev related ZoL bug fixes illumos/illumos-gate@555d674d5d4b8191dc83723188349d28278b2431 https://github.com/illumos/illumos-gate/commit/555d674d5d4b8191dc83723188349d28278b2431 https://www.illumos.org/issues/10592 This is a collection of recent fixes from ZoL: 8eef997679b Error path in metaslab_load_impl() forgets to drop ms_sync_lock 928e8ad47d3 Introduce auxiliary metaslab histograms 425d3237ee8 Get rid of space_map_update() for ms_synced_length 6c926f426a2 Simplify log vdev removal code 21e7cf5da89 zdb -L should skip leak detection altogether df72b8bebe0 Rename range_tree_verify to range_tree_verify_not_present 75058f33034 Remove unused vdev_t fields Portions contributed by: Jerry Jelinek Author: Serapheim Dimitropoulos Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/range_tree.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_indirect_mapping.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_initialize.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_removal.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c vendor/illumos/dist/man/man1m/zdb.1m Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Nov 6 08:58:03 2019 (r354382) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/metaslab.c Wed Nov 6 09:00:06 2019 (r354383) @@ -489,45 +489,62 @@ metaslab_compare(const void *x1, const void *x2) return (AVL_CMP(m1->ms_start, m2->ms_start)); } +uint64_t +metaslab_allocated_space(metaslab_t *msp) +{ + return (msp->ms_allocated_space); +} + /* * Verify that the space accounting on disk matches the in-core range_trees. */ -void +static void metaslab_verify_space(metaslab_t *msp, uint64_t txg) { spa_t *spa = msp->ms_group->mg_vd->vdev_spa; - uint64_t allocated = 0; + uint64_t allocating = 0; uint64_t sm_free_space, msp_free_space; ASSERT(MUTEX_HELD(&msp->ms_lock)); + ASSERT(!msp->ms_condensing); if ((zfs_flags & ZFS_DEBUG_METASLAB_VERIFY) == 0) return; /* * We can only verify the metaslab space when we're called - * from syncing context with a loaded metaslab that has an allocated - * space map. Calling this in non-syncing context does not - * provide a consistent view of the metaslab since we're performing - * allocations in the future. + * from syncing context with a loaded metaslab that has an + * allocated space map. Calling this in non-syncing context + * does not provide a consistent view of the metaslab since + * we're performing allocations in the future. */ if (txg != spa_syncing_txg(spa) || msp->ms_sm == NULL || !msp->ms_loaded) return; - sm_free_space = msp->ms_size - space_map_allocated(msp->ms_sm) - - space_map_alloc_delta(msp->ms_sm); + /* + * Even though the smp_alloc field can get negative (e.g. + * see vdev_checkpoint_sm), that should never be the case + * when it come's to a metaslab's space map. + */ + ASSERT3S(space_map_allocated(msp->ms_sm), >=, 0); + sm_free_space = msp->ms_size - metaslab_allocated_space(msp); + /* - * Account for future allocations since we would have already - * deducted that space from the ms_freetree. + * Account for future allocations since we would have + * already deducted that space from the ms_allocatable. */ for (int t = 0; t < TXG_CONCURRENT_STATES; t++) { - allocated += + allocating += range_tree_space(msp->ms_allocating[(txg + t) & TXG_MASK]); } - msp_free_space = range_tree_space(msp->ms_allocatable) + allocated + + ASSERT3U(msp->ms_deferspace, ==, + range_tree_space(msp->ms_defer[0]) + + range_tree_space(msp->ms_defer[1])); + + msp_free_space = range_tree_space(msp->ms_allocatable) + allocating + msp->ms_deferspace + range_tree_space(msp->ms_freed); VERIFY3U(sm_free_space, ==, msp_free_space); @@ -832,6 +849,7 @@ metaslab_group_histogram_verify(metaslab_group_t *mg) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; + ASSERT(msp != NULL); /* skip if not active or not a member */ if (msp->ms_sm == NULL || msp->ms_group != mg) @@ -1445,7 +1463,204 @@ metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; * ========================================================================== */ +static void +metaslab_aux_histograms_clear(metaslab_t *msp) +{ + /* + * Auxiliary histograms are only cleared when resetting them, + * which can only happen while the metaslab is loaded. + */ + ASSERT(msp->ms_loaded); + + bzero(msp->ms_synchist, sizeof (msp->ms_synchist)); + for (int t = 0; t < TXG_DEFER_SIZE; t++) + bzero(msp->ms_deferhist[t], sizeof (msp->ms_deferhist[t])); +} + +static void +metaslab_aux_histogram_add(uint64_t *histogram, uint64_t shift, + range_tree_t *rt) +{ + /* + * This is modeled after space_map_histogram_add(), so refer to that + * function for implementation details. We want this to work like + * the space map histogram, and not the range tree histogram, as we + * are essentially constructing a delta that will be later subtracted + * from the space map histogram. + */ + int idx = 0; + for (int i = shift; i < RANGE_TREE_HISTOGRAM_SIZE; i++) { + ASSERT3U(i, >=, idx + shift); + histogram[idx] += rt->rt_histogram[i] << (i - idx - shift); + + if (idx < SPACE_MAP_HISTOGRAM_SIZE - 1) { + ASSERT3U(idx + shift, ==, i); + idx++; + ASSERT3U(idx, <, SPACE_MAP_HISTOGRAM_SIZE); + } + } +} + /* + * Called at every sync pass that the metaslab gets synced. + * + * The reason is that we want our auxiliary histograms to be updated + * wherever the metaslab's space map histogram is updated. This way + * we stay consistent on which parts of the metaslab space map's + * histogram are currently not available for allocations (e.g because + * they are in the defer, freed, and freeing trees). + */ +static void +metaslab_aux_histograms_update(metaslab_t *msp) +{ + space_map_t *sm = msp->ms_sm; + ASSERT(sm != NULL); + + /* + * This is similar to the metaslab's space map histogram updates + * that take place in metaslab_sync(). The only difference is that + * we only care about segments that haven't made it into the + * ms_allocatable tree yet. + */ + if (msp->ms_loaded) { + metaslab_aux_histograms_clear(msp); + + metaslab_aux_histogram_add(msp->ms_synchist, + sm->sm_shift, msp->ms_freed); + + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + metaslab_aux_histogram_add(msp->ms_deferhist[t], + sm->sm_shift, msp->ms_defer[t]); + } + } + + metaslab_aux_histogram_add(msp->ms_synchist, + sm->sm_shift, msp->ms_freeing); +} + +/* + * Called every time we are done syncing (writing to) the metaslab, + * i.e. at the end of each sync pass. + * [see the comment in metaslab_impl.h for ms_synchist, ms_deferhist] + */ +static void +metaslab_aux_histograms_update_done(metaslab_t *msp, boolean_t defer_allowed) +{ + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + space_map_t *sm = msp->ms_sm; + + if (sm == NULL) { + /* + * We came here from metaslab_init() when creating/opening a + * pool, looking at a metaslab that hasn't had any allocations + * yet. + */ + return; + } + + /* + * This is similar to the actions that we take for the ms_freed + * and ms_defer trees in metaslab_sync_done(). + */ + uint64_t hist_index = spa_syncing_txg(spa) % TXG_DEFER_SIZE; + if (defer_allowed) { + bcopy(msp->ms_synchist, msp->ms_deferhist[hist_index], + sizeof (msp->ms_synchist)); + } else { + bzero(msp->ms_deferhist[hist_index], + sizeof (msp->ms_deferhist[hist_index])); + } + bzero(msp->ms_synchist, sizeof (msp->ms_synchist)); +} + +/* + * Ensure that the metaslab's weight and fragmentation are consistent + * with the contents of the histogram (either the range tree's histogram + * or the space map's depending whether the metaslab is loaded). + */ +static void +metaslab_verify_weight_and_frag(metaslab_t *msp) +{ + ASSERT(MUTEX_HELD(&msp->ms_lock)); + + if ((zfs_flags & ZFS_DEBUG_METASLAB_VERIFY) == 0) + return; + + /* see comment in metaslab_verify_unflushed_changes() */ + if (msp->ms_group == NULL) + return; + + /* + * Devices being removed always return a weight of 0 and leave + * fragmentation and ms_max_size as is - there is nothing for + * us to verify here. + */ + vdev_t *vd = msp->ms_group->mg_vd; + if (vd->vdev_removing) + return; + + /* + * If the metaslab is dirty it probably means that we've done + * some allocations or frees that have changed our histograms + * and thus the weight. + */ + for (int t = 0; t < TXG_SIZE; t++) { + if (txg_list_member(&vd->vdev_ms_list, msp, t)) + return; + } + + /* + * This verification checks that our in-memory state is consistent + * with what's on disk. If the pool is read-only then there aren't + * any changes and we just have the initially-loaded state. + */ + if (!spa_writeable(msp->ms_group->mg_vd->vdev_spa)) + return; + + /* some extra verification for in-core tree if you can */ + if (msp->ms_loaded) { + range_tree_stat_verify(msp->ms_allocatable); + VERIFY(space_map_histogram_verify(msp->ms_sm, + msp->ms_allocatable)); + } + + uint64_t weight = msp->ms_weight; + uint64_t was_active = msp->ms_weight & METASLAB_ACTIVE_MASK; + boolean_t space_based = WEIGHT_IS_SPACEBASED(msp->ms_weight); + uint64_t frag = msp->ms_fragmentation; + uint64_t max_segsize = msp->ms_max_size; + + msp->ms_weight = 0; + msp->ms_fragmentation = 0; + msp->ms_max_size = 0; + + /* + * This function is used for verification purposes. Regardless of + * whether metaslab_weight() thinks this metaslab should be active or + * not, we want to ensure that the actual weight (and therefore the + * value of ms_weight) would be the same if it was to be recalculated + * at this point. + */ + msp->ms_weight = metaslab_weight(msp) | was_active; + + VERIFY3U(max_segsize, ==, msp->ms_max_size); + + /* + * If the weight type changed then there is no point in doing + * verification. Revert fields to their original values. + */ + if ((space_based && !WEIGHT_IS_SPACEBASED(msp->ms_weight)) || + (!space_based && WEIGHT_IS_SPACEBASED(msp->ms_weight))) { + msp->ms_fragmentation = frag; + msp->ms_weight = weight; + return; + } + + VERIFY3U(msp->ms_fragmentation, ==, frag); + VERIFY3U(msp->ms_weight, ==, weight); +} + +/* * Wait for any in-progress metaslab loads to complete. */ static void @@ -1466,47 +1681,94 @@ metaslab_load_impl(metaslab_t *msp) ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(msp->ms_loading); + ASSERT(!msp->ms_condensing); /* - * Nobody else can manipulate a loading metaslab, so it's now safe - * to drop the lock. This way we don't have to hold the lock while - * reading the spacemap from disk. + * We temporarily drop the lock to unblock other operations while we + * are reading the space map. Therefore, metaslab_sync() and + * metaslab_sync_done() can run at the same time as we do. + * + * metaslab_sync() can append to the space map while we are loading. + * Therefore we load only entries that existed when we started the + * load. Additionally, metaslab_sync_done() has to wait for the load + * to complete because there are potential races like metaslab_load() + * loading parts of the space map that are currently being appended + * by metaslab_sync(). If we didn't, the ms_allocatable would have + * entries that metaslab_sync_done() would try to re-add later. + * + * That's why before dropping the lock we remember the synced length + * of the metaslab and read up to that point of the space map, + * ignoring entries appended by metaslab_sync() that happen after we + * drop the lock. */ + uint64_t length = msp->ms_synced_length; mutex_exit(&msp->ms_lock); - /* - * If the space map has not been allocated yet, then treat - * all the space in the metaslab as free and add it to ms_allocatable. - */ if (msp->ms_sm != NULL) { - error = space_map_load(msp->ms_sm, msp->ms_allocatable, - SM_FREE); + error = space_map_load_length(msp->ms_sm, msp->ms_allocatable, + SM_FREE, length); } else { + /* + * The space map has not been allocated yet, so treat + * all the space in the metaslab as free and add it to the + * ms_allocatable tree. + */ range_tree_add(msp->ms_allocatable, msp->ms_start, msp->ms_size); } + /* + * We need to grab the ms_sync_lock to prevent metaslab_sync() from + * changing the ms_sm and the metaslab's range trees while we are + * about to use them and populate the ms_allocatable. The ms_lock + * is insufficient for this because metaslab_sync() doesn't hold + * the ms_lock while writing the ms_checkpointing tree to disk. + */ + mutex_enter(&msp->ms_sync_lock); mutex_enter(&msp->ms_lock); + ASSERT(!msp->ms_condensing); - if (error != 0) + if (error != 0) { + mutex_exit(&msp->ms_sync_lock); return (error); + } ASSERT3P(msp->ms_group, !=, NULL); msp->ms_loaded = B_TRUE; /* - * If the metaslab already has a spacemap, then we need to - * remove all segments from the defer tree; otherwise, the - * metaslab is completely empty and we can skip this. + * The ms_allocatable contains the segments that exist in the + * ms_defer trees [see ms_synced_length]. Thus we need to remove + * them from ms_allocatable as they will be added again in + * metaslab_sync_done(). */ - if (msp->ms_sm != NULL) { - for (int t = 0; t < TXG_DEFER_SIZE; t++) { - range_tree_walk(msp->ms_defer[t], - range_tree_remove, msp->ms_allocatable); - } + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + range_tree_walk(msp->ms_defer[t], + range_tree_remove, msp->ms_allocatable); } + + /* + * Call metaslab_recalculate_weight_and_sort() now that the + * metaslab is loaded so we get the metaslab's real weight. + * + * Unless this metaslab was created with older software and + * has not yet been converted to use segment-based weight, we + * expect the new weight to be better or equal to the weight + * that the metaslab had while it was not loaded. This is + * because the old weight does not take into account the + * consolidation of adjacent segments between TXGs. [see + * comment for ms_synchist and ms_deferhist[] for more info] + */ + uint64_t weight = msp->ms_weight; + metaslab_recalculate_weight_and_sort(msp); + if (!WEIGHT_IS_SPACEBASED(weight)) + ASSERT3U(weight, <=, msp->ms_weight); msp->ms_max_size = metaslab_block_maxsize(msp); + spa_t *spa = msp->ms_group->mg_vd->vdev_spa; + metaslab_verify_space(msp, spa_syncing_txg(spa)); + mutex_exit(&msp->ms_sync_lock); + return (0); } @@ -1523,6 +1785,7 @@ metaslab_load(metaslab_t *msp) if (msp->ms_loaded) return (0); VERIFY(!msp->ms_loading); + ASSERT(!msp->ms_condensing); msp->ms_loading = B_TRUE; int error = metaslab_load_impl(msp); @@ -1536,10 +1799,29 @@ void metaslab_unload(metaslab_t *msp) { ASSERT(MUTEX_HELD(&msp->ms_lock)); + + metaslab_verify_weight_and_frag(msp); + range_tree_vacate(msp->ms_allocatable, NULL, NULL); msp->ms_loaded = B_FALSE; + msp->ms_weight &= ~METASLAB_ACTIVE_MASK; msp->ms_max_size = 0; + + /* + * We explicitly recalculate the metaslab's weight based on its space + * map (as it is now not loaded). We want unload metaslabs to always + * have their weights calculated from the space map histograms, while + * loaded ones have it calculated from their in-core range tree + * [see metaslab_load()]. This way, the weight reflects the information + * available in-core, whether it is loaded or not + * + * If ms_group == NULL means that we came here from metaslab_fini(), + * at which point it doesn't make sense for us to do the recalculation + * and the sorting. + */ + if (msp->ms_group != NULL) + metaslab_recalculate_weight_and_sort(msp); } static void @@ -1579,6 +1861,13 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 /* * We only open space map objects that already exist. All others * will be opened when we finally allocate an object for it. + * + * Note: + * When called from vdev_expand(), we can't call into the DMU as + * we are holding the spa_config_lock as a writer and we would + * deadlock [see relevant comment in vdev_metaslab_init()]. in + * that case, the object parameter is zero though, so we won't + * call into the DMU. */ if (object != 0) { error = space_map_open(&ms->ms_sm, mos, object, ms->ms_start, @@ -1590,14 +1879,17 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 } ASSERT(ms->ms_sm != NULL); + ASSERT3S(space_map_allocated(ms->ms_sm), >=, 0); + ms->ms_allocated_space = space_map_allocated(ms->ms_sm); } /* - * We create the main range tree here, but we don't create the + * We create the ms_allocatable here, but we don't create the * other range trees until metaslab_sync_done(). This serves * two purposes: it allows metaslab_sync_done() to detect the - * addition of new space; and for debugging, it ensures that we'd - * data fault on any attempt to use this metaslab before it's ready. + * addition of new space; and for debugging, it ensures that + * we'd data fault on any attempt to use this metaslab before + * it's ready. */ ms->ms_allocatable = range_tree_create(&metaslab_rt_ops, ms); metaslab_group_add(mg, ms); @@ -1613,8 +1905,11 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint6 * out this txg. This ensures that we don't attempt to allocate * from it before we have initialized it completely. */ - if (txg <= TXG_INITIAL) + if (txg <= TXG_INITIAL) { metaslab_sync_done(ms, 0); + metaslab_space_update(vd, mg->mg_class, + metaslab_allocated_space(ms), 0, 0); + } /* * If metaslab_debug_load is set and we're initializing a metaslab @@ -1648,7 +1943,7 @@ metaslab_fini(metaslab_t *msp) mutex_enter(&msp->ms_lock); VERIFY(msp->ms_group == NULL); metaslab_space_update(vd, mg->mg_class, - -space_map_allocated(msp->ms_sm), 0, -msp->ms_size); + -metaslab_allocated_space(msp), 0, -msp->ms_size); space_map_close(msp->ms_sm); @@ -1669,6 +1964,9 @@ metaslab_fini(metaslab_t *msp) range_tree_destroy(msp->ms_checkpointing); + for (int t = 0; t < TXG_SIZE; t++) + ASSERT(!txg_list_member(&vd->vdev_ms_list, msp, t)); + mutex_exit(&msp->ms_lock); cv_destroy(&msp->ms_load_cv); mutex_destroy(&msp->ms_lock); @@ -1684,7 +1982,7 @@ metaslab_fini(metaslab_t *msp) * This table defines a segment size based fragmentation metric that will * allow each metaslab to derive its own fragmentation value. This is done * by calculating the space in each bucket of the spacemap histogram and - * multiplying that by the fragmetation metric in this table. Doing + * multiplying that by the fragmentation metric in this table. Doing * this for all buckets and dividing it by the total amount of free * space in this metaslab (i.e. the total free space in all buckets) gives * us the fragmentation metric. This means that a high fragmentation metric @@ -1719,10 +2017,10 @@ int zfs_frag_table[FRAGMENTATION_TABLE_SIZE] = { }; /* - * Calclate the metaslab's fragmentation metric. A return value - * of ZFS_FRAG_INVALID means that the metaslab has not been upgraded and does - * not support this metric. Otherwise, the return value should be in the - * range [0, 100]. + * Calculate the metaslab's fragmentation metric and set ms_fragmentation. + * Setting this value to ZFS_FRAG_INVALID means that the metaslab has not + * been upgraded and does not support this metric. Otherwise, the return + * value should be in the range [0, 100]. */ static void metaslab_set_fragmentation(metaslab_t *msp) @@ -1815,7 +2113,7 @@ metaslab_space_weight(metaslab_t *msp) /* * The baseline weight is the metaslab's free space. */ - space = msp->ms_size - space_map_allocated(msp->ms_sm); + space = msp->ms_size - metaslab_allocated_space(msp); if (metaslab_fragmentation_factor_enabled && msp->ms_fragmentation != ZFS_FRAG_INVALID) { @@ -1919,14 +2217,38 @@ metaslab_weight_from_range_tree(metaslab_t *msp) static uint64_t metaslab_weight_from_spacemap(metaslab_t *msp) { - uint64_t weight = 0; + space_map_t *sm = msp->ms_sm; + ASSERT(!msp->ms_loaded); + ASSERT(sm != NULL); + ASSERT3U(space_map_object(sm), !=, 0); + ASSERT3U(sm->sm_dbuf->db_size, ==, sizeof (space_map_phys_t)); + /* + * Create a joint histogram from all the segments that have made + * it to the metaslab's space map histogram, that are not yet + * available for allocation because they are still in the freeing + * pipeline (e.g. freeing, freed, and defer trees). Then subtract + * these segments from the space map's histogram to get a more + * accurate weight. + */ + uint64_t deferspace_histogram[SPACE_MAP_HISTOGRAM_SIZE] = {0}; + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) + deferspace_histogram[i] += msp->ms_synchist[i]; + for (int t = 0; t < TXG_DEFER_SIZE; t++) { + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + deferspace_histogram[i] += msp->ms_deferhist[t][i]; + } + } + + uint64_t weight = 0; for (int i = SPACE_MAP_HISTOGRAM_SIZE - 1; i >= 0; i--) { - if (msp->ms_sm->sm_phys->smp_histogram[i] != 0) { - WEIGHT_SET_COUNT(weight, - msp->ms_sm->sm_phys->smp_histogram[i]); - WEIGHT_SET_INDEX(weight, i + - msp->ms_sm->sm_shift); + ASSERT3U(sm->sm_phys->smp_histogram[i], >=, + deferspace_histogram[i]); + uint64_t count = + sm->sm_phys->smp_histogram[i] - deferspace_histogram[i]; + if (count != 0) { + WEIGHT_SET_COUNT(weight, count); + WEIGHT_SET_INDEX(weight, i + sm->sm_shift); WEIGHT_SET_ACTIVE(weight, 0); break; } @@ -1951,7 +2273,7 @@ metaslab_segment_weight(metaslab_t *msp) /* * The metaslab is completely free. */ - if (space_map_allocated(msp->ms_sm) == 0) { + if (metaslab_allocated_space(msp) == 0) { int idx = highbit64(msp->ms_size) - 1; int max_idx = SPACE_MAP_HISTOGRAM_SIZE + shift - 1; @@ -1973,7 +2295,7 @@ metaslab_segment_weight(metaslab_t *msp) /* * If the metaslab is fully allocated then just make the weight 0. */ - if (space_map_allocated(msp->ms_sm) == msp->ms_size) + if (metaslab_allocated_space(msp) == msp->ms_size) return (0); /* * If the metaslab is already loaded, then use the range tree to @@ -2054,6 +2376,8 @@ metaslab_weight(metaslab_t *msp) */ if (msp->ms_loaded) msp->ms_max_size = metaslab_block_maxsize(msp); + else + ASSERT0(msp->ms_max_size); /* * Segment-based weighting requires space map histogram support. @@ -2069,6 +2393,15 @@ metaslab_weight(metaslab_t *msp) return (weight); } +void +metaslab_recalculate_weight_and_sort(metaslab_t *msp) +{ + /* note: we preserve the mask (e.g. indication of primary, etc..) */ + uint64_t was_active = msp->ms_weight & METASLAB_ACTIVE_MASK; + metaslab_group_sort(msp->ms_group, msp, + metaslab_weight(msp) | was_active); +} + static int metaslab_activate_allocator(metaslab_group_t *mg, metaslab_t *msp, int allocator, uint64_t activation_weight) @@ -2453,17 +2786,17 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) VERIFY(txg <= spa_final_dirty_txg(spa)); /* - * The only state that can actually be changing concurrently with - * metaslab_sync() is the metaslab's ms_allocatable. No other - * thread can be modifying this txg's alloc, freeing, + * The only state that can actually be changing concurrently + * with metaslab_sync() is the metaslab's ms_allocatable. No + * other thread can be modifying this txg's alloc, freeing, * freed, or space_map_phys_t. We drop ms_lock whenever we - * could call into the DMU, because the DMU can call down to us - * (e.g. via zio_free()) at any time. + * could call into the DMU, because the DMU can call down to + * us (e.g. via zio_free()) at any time. * * The spa_vdev_remove_thread() can be reading metaslab state - * concurrently, and it is locked out by the ms_sync_lock. Note - * that the ms_lock is insufficient for this, because it is dropped - * by space_map_write(). + * concurrently, and it is locked out by the ms_sync_lock. + * Note that the ms_lock is insufficient for this, because it + * is dropped by space_map_write(). */ tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); @@ -2475,7 +2808,9 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) VERIFY0(space_map_open(&msp->ms_sm, mos, new_object, msp->ms_start, msp->ms_size, vd->vdev_ashift)); + ASSERT(msp->ms_sm != NULL); + ASSERT0(metaslab_allocated_space(msp)); } if (!range_tree_is_empty(msp->ms_checkpointing) && @@ -2523,6 +2858,11 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) mutex_enter(&msp->ms_lock); } + msp->ms_allocated_space += range_tree_space(alloctree); + ASSERT3U(msp->ms_allocated_space, >=, + range_tree_space(msp->ms_freeing)); + msp->ms_allocated_space -= range_tree_space(msp->ms_freeing); + if (!range_tree_is_empty(msp->ms_checkpointing)) { ASSERT(spa_has_checkpoint(spa)); ASSERT3P(vd->vdev_checkpoint_sm, !=, NULL); @@ -2536,14 +2876,13 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) space_map_write(vd->vdev_checkpoint_sm, msp->ms_checkpointing, SM_FREE, SM_NO_VDEVID, tx); mutex_enter(&msp->ms_lock); - space_map_update(vd->vdev_checkpoint_sm); spa->spa_checkpoint_info.sci_dspace += range_tree_space(msp->ms_checkpointing); vd->vdev_stat.vs_checkpoint_space += range_tree_space(msp->ms_checkpointing); ASSERT3U(vd->vdev_stat.vs_checkpoint_space, ==, - -vd->vdev_checkpoint_sm->sm_alloc); + -space_map_allocated(vd->vdev_checkpoint_sm)); range_tree_vacate(msp->ms_checkpointing, NULL, NULL); } @@ -2588,6 +2927,7 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) * time we load the space map. */ space_map_histogram_add(msp->ms_sm, msp->ms_freeing, tx); + metaslab_aux_histograms_update(msp); metaslab_group_histogram_add(mg, msp); metaslab_group_histogram_verify(mg); @@ -2595,16 +2935,18 @@ metaslab_sync(metaslab_t *msp, uint64_t txg) /* * For sync pass 1, we avoid traversing this txg's free range tree - * and instead will just swap the pointers for freeing and - * freed. We can safely do this since the freed_tree is - * guaranteed to be empty on the initial pass. + * and instead will just swap the pointers for freeing and freed. + * We can safely do this since the freed_tree is guaranteed to be + * empty on the initial pass. */ if (spa_sync_pass(spa) == 1) { range_tree_swap(&msp->ms_freeing, &msp->ms_freed); + ASSERT0(msp->ms_allocated_this_txg); } else { range_tree_vacate(msp->ms_freeing, range_tree_add, msp->ms_freed); } + msp->ms_allocated_this_txg += range_tree_space(alloctree); range_tree_vacate(alloctree, NULL, NULL); ASSERT0(range_tree_space(msp->ms_allocating[txg & TXG_MASK])); @@ -2682,7 +3024,8 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) } defer_delta = 0; - alloc_delta = space_map_alloc_delta(msp->ms_sm); + alloc_delta = msp->ms_allocated_this_txg - + range_tree_space(msp->ms_freed); if (defer_allowed) { defer_delta = range_tree_space(msp->ms_freed) - range_tree_space(*defer_tree); @@ -2714,8 +3057,9 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) msp->ms_loaded ? range_tree_add : NULL, msp->ms_allocatable); } - space_map_update(msp->ms_sm); + msp->ms_synced_length = space_map_length(msp->ms_sm); + msp->ms_deferspace += defer_delta; ASSERT3S(msp->ms_deferspace, >=, 0); ASSERT3S(msp->ms_deferspace, <=, msp->ms_size); @@ -2726,6 +3070,7 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) */ vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); } + metaslab_aux_histograms_update_done(msp, defer_allowed); if (msp->ms_new) { msp->ms_new = B_FALSE; @@ -2733,12 +3078,12 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) mg->mg_ms_ready++; mutex_exit(&mg->mg_lock); } + /* - * Calculate the new weights before unloading any metaslabs. - * This will give us the most accurate weighting. + * Re-sort metaslab within its group now that we've adjusted + * its allocatable space. */ - metaslab_group_sort(mg, msp, metaslab_weight(msp) | - (msp->ms_weight & METASLAB_ACTIVE_MASK)); + metaslab_recalculate_weight_and_sort(msp); /* * If the metaslab is loaded and we've not tried to load or allocate @@ -2765,6 +3110,7 @@ metaslab_sync_done(metaslab_t *msp, uint64_t txg) ASSERT0(range_tree_space(msp->ms_freed)); ASSERT0(range_tree_space(msp->ms_checkpointing)); + msp->ms_allocated_this_txg = 0; mutex_exit(&msp->ms_lock); } @@ -4020,7 +4366,7 @@ metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint6 zio_alloc_list_t *zal, zio_t *zio, int allocator) { dva_t *dva = bp->blk_dva; - dva_t *hintdva = hintbp->blk_dva; + dva_t *hintdva = (hintbp != NULL) ? hintbp->blk_dva : NULL; int error = 0; ASSERT(bp->blk_birth == 0); @@ -4187,14 +4533,16 @@ metaslab_check_free_impl(vdev_t *vd, uint64_t offset, msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; mutex_enter(&msp->ms_lock); - if (msp->ms_loaded) - range_tree_verify(msp->ms_allocatable, offset, size); + if (msp->ms_loaded) { + range_tree_verify_not_present(msp->ms_allocatable, + offset, size); + } - range_tree_verify(msp->ms_freeing, offset, size); - range_tree_verify(msp->ms_checkpointing, offset, size); - range_tree_verify(msp->ms_freed, offset, size); + range_tree_verify_not_present(msp->ms_freeing, offset, size); + range_tree_verify_not_present(msp->ms_checkpointing, offset, size); + range_tree_verify_not_present(msp->ms_freed, offset, size); for (int j = 0; j < TXG_DEFER_SIZE; j++) - range_tree_verify(msp->ms_defer[j], offset, size); + range_tree_verify_not_present(msp->ms_defer[j], offset, size); mutex_exit(&msp->ms_lock); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c Wed Nov 6 08:58:03 2019 (r354382) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/range_tree.c Wed Nov 6 09:00:06 2019 (r354383) @@ -311,13 +311,11 @@ range_tree_find(range_tree_t *rt, uint64_t start, uint } void -range_tree_verify(range_tree_t *rt, uint64_t off, uint64_t size) +range_tree_verify_not_present(range_tree_t *rt, uint64_t off, uint64_t size) { - range_seg_t *rs; - - rs = range_tree_find(rt, off, size); + range_seg_t *rs = range_tree_find(rt, off, size); if (rs != NULL) - panic("freeing free block; rs=%p", (void *)rs); + panic("segment already in tree; rs=%p", (void *)rs); } boolean_t Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c Wed Nov 6 08:58:03 2019 (r354382) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_checkpoint.c Wed Nov 6 09:00:06 2019 (r354383) @@ -129,7 +129,7 @@ * uberblock would reference data in the removed device. For this reason * and others of similar nature, we disallow the following operations that * can change the config: - * vdev removal and attach/detach, mirror splitting, and pool reguid. + * vdev removal and attach/detach, mirror splitting, and pool reguid. * * - As most of the checkpoint logic is implemented in the SPA and doesn't * distinguish datasets when it comes to space accounting, having a @@ -262,7 +262,7 @@ spa_checkpoint_accounting_verify(spa_t *spa) if (vd->vdev_checkpoint_sm != NULL) { ckpoint_sm_space_sum += - -vd->vdev_checkpoint_sm->sm_alloc; + -space_map_allocated(vd->vdev_checkpoint_sm); vs_ckpoint_space_sum += vd->vdev_stat.vs_checkpoint_space; ASSERT3U(ckpoint_sm_space_sum, ==, @@ -347,7 +347,7 @@ spa_checkpoint_discard_thread_sync(void *arg, dmu_tx_t error, vd->vdev_id); } ASSERT0(words_after); - ASSERT0(vd->vdev_checkpoint_sm->sm_alloc); + ASSERT0(space_map_allocated(vd->vdev_checkpoint_sm)); ASSERT0(space_map_length(vd->vdev_checkpoint_sm)); space_map_free(vd->vdev_checkpoint_sm, tx); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c Wed Nov 6 08:58:03 2019 (r354382) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/space_map.c Wed Nov 6 09:00:06 2019 (r354383) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2012, 2017 by Delphix. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. */ #include @@ -81,20 +81,22 @@ sm_entry_is_double_word(uint64_t e) /* * Iterate through the space map, invoking the callback on each (non-debug) - * space map entry. + * space map entry. Stop after reading 'end' bytes of the space map. */ int -space_map_iterate(space_map_t *sm, sm_cb_t callback, void *arg) +space_map_iterate(space_map_t *sm, uint64_t end, sm_cb_t callback, void *arg) { - uint64_t sm_len = space_map_length(sm); - ASSERT3U(sm->sm_blksz, !=, 0); + uint64_t blksz = sm->sm_blksz; - dmu_prefetch(sm->sm_os, space_map_object(sm), 0, 0, sm_len, + ASSERT3U(blksz, !=, 0); + ASSERT3U(end, <=, space_map_length(sm)); + ASSERT0(P2PHASE(end, sizeof (uint64_t))); + + dmu_prefetch(sm->sm_os, space_map_object(sm), 0, 0, end, ZIO_PRIORITY_SYNC_READ); - uint64_t blksz = sm->sm_blksz; int error = 0; - for (uint64_t block_base = 0; block_base < sm_len && error == 0; + for (uint64_t block_base = 0; block_base < end && error == 0; block_base += blksz) { dmu_buf_t *db; error = dmu_buf_hold(sm->sm_os, space_map_object(sm), @@ -103,7 +105,7 @@ space_map_iterate(space_map_t *sm, sm_cb_t callback, v return (error); uint64_t *block_start = db->db_data; - uint64_t block_length = MIN(sm_len - block_base, blksz); + uint64_t block_length = MIN(end - block_base, blksz); uint64_t *block_end = block_start + (block_length / sizeof (uint64_t)); @@ -186,7 +188,7 @@ space_map_reversed_last_block_entries(space_map_t *sm, * dmu_buf_hold(). */ uint64_t last_word_offset = - sm->sm_phys->smp_objsize - sizeof (uint64_t); + sm->sm_phys->smp_length - sizeof (uint64_t); error = dmu_buf_hold(sm->sm_os, space_map_object(sm), last_word_offset, FTAG, &db, DMU_READ_NO_PREFETCH); if (error != 0) @@ -199,7 +201,7 @@ space_map_reversed_last_block_entries(space_map_t *sm, uint64_t *words = db->db_data; *nwords = - (sm->sm_phys->smp_objsize - db->db_offset) / sizeof (uint64_t); + (sm->sm_phys->smp_length - db->db_offset) / sizeof (uint64_t); ASSERT3U(*nwords, <=, bufsz / sizeof (uint64_t)); @@ -298,8 +300,7 @@ space_map_incremental_destroy(space_map_t *sm, sm_cb_t uint64_t e = buf[i]; if (sm_entry_is_debug(e)) { - sm->sm_phys->smp_objsize -= sizeof (uint64_t); - space_map_update(sm); + sm->sm_phys->smp_length -= sizeof (uint64_t); continue; } @@ -354,15 +355,13 @@ space_map_incremental_destroy(space_map_t *sm, sm_cb_t sm->sm_phys->smp_alloc -= entry_run; else sm->sm_phys->smp_alloc += entry_run; - sm->sm_phys->smp_objsize -= words * sizeof (uint64_t); - space_map_update(sm); + sm->sm_phys->smp_length -= words * sizeof (uint64_t); } } if (space_map_length(sm) == 0) { ASSERT0(error); - ASSERT0(sm->sm_phys->smp_objsize); - ASSERT0(sm->sm_alloc); + ASSERT0(space_map_allocated(sm)); } zio_buf_free(buf, bufsz); @@ -391,38 +390,42 @@ space_map_load_callback(space_map_entry_t *sme, void * } /* - * Load the space map disk into the specified range tree. Segments of maptype - * are added to the range tree, other segment types are removed. + * Load the spacemap into the rangetree, like space_map_load. But only + * read the first 'length' bytes of the spacemap. */ int -space_map_load(space_map_t *sm, range_tree_t *rt, maptype_t maptype) +space_map_load_length(space_map_t *sm, range_tree_t *rt, maptype_t maptype, + uint64_t length) { - uint64_t space; - int err; space_map_load_arg_t smla; VERIFY0(range_tree_space(rt)); - space = space_map_allocated(sm); - if (maptype == SM_FREE) { + if (maptype == SM_FREE) range_tree_add(rt, sm->sm_start, sm->sm_size); - space = sm->sm_size - space; - } smla.smla_rt = rt; smla.smla_sm = sm; smla.smla_type = maptype; - err = space_map_iterate(sm, space_map_load_callback, &smla); + int err = space_map_iterate(sm, length, + space_map_load_callback, &smla); - if (err == 0) { - VERIFY3U(range_tree_space(rt), ==, space); - } else { + if (err != 0) range_tree_vacate(rt, NULL, NULL); - } return (err); } +/* + * Load the space map disk into the specified range tree. Segments of maptype + * are added to the range tree, other segment types are removed. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 09:04:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F14E21AF3CA; Wed, 6 Nov 2019 09:04:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477LFH61VZz3L29; Wed, 6 Nov 2019 09:04:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADF4522B91; Wed, 6 Nov 2019 09:04:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA694JCY052946; Wed, 6 Nov 2019 09:04:19 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA694JB5052945; Wed, 6 Nov 2019 09:04:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060904.xA694JB5052945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354384 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:04:20 -0000 Author: avg Date: Wed Nov 6 09:04:19 2019 New Revision: 354384 URL: https://svnweb.freebsd.org/changeset/base/354384 Log: 10570 Need workaround to EFI boot on AMI BIOS illumos/illumos-gate@fd7977362aae2eaa5dcb89671159f4fd82f22ca1 https://github.com/illumos/illumos-gate/commit/fd7977362aae2eaa5dcb89671159f4fd82f22ca1 https://www.illumos.org/issues/10570 Some BIOS types are very pick about the GPT header size. Author: John Levon Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c Wed Nov 6 09:00:06 2019 (r354383) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c Wed Nov 6 09:04:19 2019 (r354384) @@ -27,6 +27,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -1509,7 +1510,7 @@ zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t gpt.efi_gpt_Signature = LE_64(EFI_SIGNATURE); gpt.efi_gpt_Revision = LE_32(EFI_VERSION_CURRENT); - gpt.efi_gpt_HeaderSize = LE_32(sizeof (gpt)); + gpt.efi_gpt_HeaderSize = LE_32(EFI_HEADER_SIZE); gpt.efi_gpt_MyLBA = LE_64(1ULL); gpt.efi_gpt_FirstUsableLBA = LE_64(34ULL); gpt.efi_gpt_LastUsableLBA = LE_64((vs >> bs) - 1); @@ -1519,7 +1520,7 @@ zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t LE_32(sizeof (efi_gpe_t)); CRC32(crc, &gpe, sizeof (gpe), -1U, crc32_table); gpt.efi_gpt_PartitionEntryArrayCRC32 = LE_32(~crc); - CRC32(crc, &gpt, sizeof (gpt), -1U, crc32_table); + CRC32(crc, &gpt, EFI_HEADER_SIZE, -1U, crc32_table); gpt.efi_gpt_HeaderCRC32 = LE_32(~crc); if (ddi_copyout(&gpt, ptr, MIN(sizeof (gpt), length), flag)) From owner-svn-src-all@freebsd.org Wed Nov 6 09:05:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50CF41AF463; Wed, 6 Nov 2019 09:05:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477LGr1Bp1z3L8Q; Wed, 6 Nov 2019 09:05:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C74A22B94; Wed, 6 Nov 2019 09:05:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA695dpI053057; Wed, 6 Nov 2019 09:05:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA695dwH053056; Wed, 6 Nov 2019 09:05:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060905.xA695dwH053056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354385 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Commit-Revision: 354385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:05:40 -0000 Author: avg Date: Wed Nov 6 09:05:39 2019 New Revision: 354385 URL: https://svnweb.freebsd.org/changeset/base/354385 Log: 11541 allocation_classes feature must be enabled to add log device illumos/illumos-gate@c1064fd7ce62fe763a4475e9988ffea3b22137de https://github.com/illumos/illumos-gate/commit/c1064fd7ce62fe763a4475e9988ffea3b22137de https://www.illumos.org/issues/11541 After the allocation_classes feature was integrated, one can no longer add a log device to a pool unless that feature is enabled. There is an explicit check for this, but it is unnecessary in the case of log devices, so we should handle this better instead of forcing the feature to be enabled. Author: Jerry Jelinek Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Nov 6 09:04:19 2019 (r354384) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c Wed Nov 6 09:05:39 2019 (r354385) @@ -25,7 +25,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome - * Copyright 2017 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2017, Intel Corporation. */ @@ -633,7 +633,8 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vde alloc_bias = vdev_derive_alloc_bias(bias); /* spa_vdev_add() expects feature to be enabled */ - if (spa->spa_load_state != SPA_LOAD_CREATE && + if (alloc_bias != VDEV_BIAS_LOG && + spa->spa_load_state != SPA_LOAD_CREATE && !spa_feature_is_enabled(spa, SPA_FEATURE_ALLOCATION_CLASSES)) { return (SET_ERROR(ENOTSUP)); From owner-svn-src-all@freebsd.org Wed Nov 6 09:09:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAB2B1AF639; Wed, 6 Nov 2019 09:09:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477LLm5Fhzz3LMC; Wed, 6 Nov 2019 09:09:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9328722B9B; Wed, 6 Nov 2019 09:09:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6994Pq053253; Wed, 6 Nov 2019 09:09:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6993qx053247; Wed, 6 Nov 2019 09:09:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060909.xA6993qx053247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354386 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor-sys X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 354386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:09:04 -0000 Author: avg Date: Wed Nov 6 09:09:03 2019 New Revision: 354386 URL: https://svnweb.freebsd.org/changeset/base/354386 Log: 11770 additional mmp fixes illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e https://www.illumos.org/issues/11770 Port a few additional MMP fixes from ZoL that came in after our initial MMP port. 4ca457b065 ZTS: Fix mmp_interval failure ca95f70dff zpool import progress kstat (only minimal changes from above can be pulled in right now) 060f0226e6 MMP interval and fail_intervals in uberblock Portions contributed by: Jerry Jelinek Portions contributed by: Brian Behlendorf Author: Olaf Faaland Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zdb/zdb.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c Wed Nov 6 09:09:03 2019 (r354386) @@ -50,40 +50,101 @@ * Uberblocks written by the txg_sync thread always go into the first * (N-MMP_BLOCKS_PER_LABEL) slots, the remaining slots are reserved for MMP. * They are used to hold uberblocks which are exactly the same as the last - * synced uberblock except that the ub_timestamp is frequently updated. - * Like all other uberblocks, the slot is written with an embedded checksum, - * and slots with invalid checksums are ignored. This provides the + * synced uberblock except that the ub_timestamp and mmp_config are frequently + * updated. Like all other uberblocks, the slot is written with an embedded + * checksum, and slots with invalid checksums are ignored. This provides the * "heartbeat", with no risk of overwriting good uberblocks that must be * preserved, e.g. previous txgs and associated block pointers. * - * Two optional fields are added to uberblock structure: ub_mmp_magic and - * ub_mmp_delay. The magic field allows zfs to tell whether ub_mmp_delay is - * valid. The delay field is a decaying average of the amount of time between - * completion of successive MMP writes, in nanoseconds. It is used to predict - * how long the import must wait to detect activity in the pool, before - * concluding it is not in use. + * Three optional fields are added to uberblock structure; ub_mmp_magic, + * ub_mmp_config, and ub_mmp_delay. The ub_mmp_magic value allows zfs to tell + * whether the other ub_mmp_* fields are valid. The ub_mmp_config field tells + * the importing host the settings of zfs_multihost_interval and + * zfs_multihost_fail_intervals on the host which last had (or currently has) + * the pool imported. These determine how long a host must wait to detect + * activity in the pool, before concluding the pool is not in use. The + * mmp_delay field is a decaying average of the amount of time between + * completion of successive MMP writes, in nanoseconds. It indicates whether + * MMP is enabled. * * During import an activity test may now be performed to determine if * the pool is in use. The activity test is typically required if the * ZPOOL_CONFIG_HOSTID does not match the system hostid, the pool state is * POOL_STATE_ACTIVE, and the pool is not a root pool. * - * The activity test finds the "best" uberblock (highest txg & timestamp), - * waits some time, and then finds the "best" uberblock again. If the txg - * and timestamp in both "best" uberblocks do not match, the pool is in use - * by another host and the import fails. Since the granularity of the - * timestamp is in seconds this activity test must take a bare minimum of one - * second. In order to assure the accuracy of the activity test, the default - * values result in an activity test duration of 10x the mmp write interval. + * The activity test finds the "best" uberblock (highest txg, timestamp, and, if + * ub_mmp_magic is valid, sequence number from ub_mmp_config). It then waits + * some time, and finds the "best" uberblock again. If any of the mentioned + * fields have different values in the newly read uberblock, the pool is in use + * by another host and the import fails. In order to assure the accuracy of the + * activity test, the default values result in an activity test duration of 20x + * the mmp write interval. * - * The "zpool import" activity test can be expected to take a minimum time of - * zfs_multihost_import_intervals * zfs_multihost_interval milliseconds. If the - * "best" uberblock has a valid ub_mmp_delay field, then the duration of the - * test may take longer if MMP writes were occurring less frequently than - * expected. Additionally, the duration is then extended by a random 25% to - * attempt to to detect simultaneous imports. For example, if both partner - * hosts are rebooted at the same time and automatically attempt to import the - * pool. + * The duration of the "zpool import" activity test depends on the information + * available in the "best" uberblock: + * + * 1) If uberblock was written by zfs-0.8 or newer and fail_intervals > 0: + * ub_mmp_config.fail_intervals * ub_mmp_config.multihost_interval * 2 + * + * In this case, a weak guarantee is provided. Since the host which last had + * the pool imported will suspend the pool if no mmp writes land within + * fail_intervals * multihost_interval ms, the absence of writes during that + * time means either the pool is not imported, or it is imported but the pool + * is suspended and no further writes will occur. + * + * Note that resuming the suspended pool on the remote host would invalidate + * this guarantee, and so it is not allowed. + * + * The factor of 2 provides a conservative safety factor and derives from + * MMP_IMPORT_SAFETY_FACTOR; + * + * 2) If uberblock was written by zfs-0.8 or newer and fail_intervals == 0: + * (ub_mmp_config.multihost_interval + ub_mmp_delay) * + * zfs_multihost_import_intervals + * + * In this case no guarantee can provided. However, as long as some devices + * are healthy and connected, it is likely that at least one write will land + * within (multihost_interval + mmp_delay) because multihost_interval is + * enough time for a write to be attempted to each leaf vdev, and mmp_delay + * is enough for one to land, based on past delays. Multiplying by + * zfs_multihost_import_intervals provides a conservative safety factor. + * + * 3) If uberblock was written by zfs-0.7: + * (zfs_multihost_interval + ub_mmp_delay) * zfs_multihost_import_intervals + * + * The same logic as case #2 applies, but we do not know remote tunables. + * + * We use the local value for zfs_multihost_interval because the original MMP + * did not record this value in the uberblock. + * + * ub_mmp_delay >= (zfs_multihost_interval / leaves), so if the other host + * has a much larger zfs_multihost_interval set, ub_mmp_delay will reflect + * that. We will have waited enough time for zfs_multihost_import_intervals + * writes to be issued and all but one to land. + * + * single device pool example delays + * + * import_delay = (1 + 1) * 20 = 40s #defaults, no I/O delay + * import_delay = (1 + 10) * 20 = 220s #defaults, 10s I/O delay + * import_delay = (10 + 10) * 20 = 400s #10s multihost_interval, + * no I/O delay + * 100 device pool example delays + * + * import_delay = (1 + .01) * 20 = 20s #defaults, no I/O delay + * import_delay = (1 + 10) * 20 = 220s #defaults, 10s I/O delay + * import_delay = (10 + .1) * 20 = 202s #10s multihost_interval, + * no I/O delay + * + * 4) Otherwise, this uberblock was written by a pre-MMP zfs: + * zfs_multihost_import_intervals * zfs_multihost_interval + * + * In this case local tunables are used. By default this product = 10s, long + * enough for a pool with any activity at all to write at least one + * uberblock. No guarantee can be provided. + * + * Additionally, the duration is then extended by a random 25% to attempt to to + * detect simultaneous imports. For example, if both partner hosts are rebooted + * at the same time and automatically attempt to import the pool. */ /* @@ -91,10 +152,9 @@ * 'multihost' pool property is on. This is one factor used to determine the * length of the activity check during import. * - * The mmp write period is zfs_multihost_interval / leaf-vdevs milliseconds. - * This means that on average an mmp write will be issued for each leaf vdev - * every zfs_multihost_interval milliseconds. In practice, the observed period - * can vary with the I/O load and this observed value is the delay which is + * On average an mmp write will be issued for each leaf vdev every + * zfs_multihost_interval milliseconds. In practice, the observed period can + * vary with the I/O load and this observed value is the ub_mmp_delay which is * stored in the uberblock. The minimum allowed value is 100 ms. */ ulong_t zfs_multihost_interval = MMP_DEFAULT_INTERVAL; @@ -109,19 +169,21 @@ ulong_t zfs_multihost_interval = MMP_DEFAULT_INTERVAL; uint_t zfs_multihost_import_intervals = MMP_DEFAULT_IMPORT_INTERVALS; /* - * Controls the behavior of the pool when mmp write failures are detected. + * Controls the behavior of the pool when mmp write failures or delays are + * detected. * - * When zfs_multihost_fail_intervals = 0 then mmp write failures are ignored. - * The failures will still be reported to the ZED which depending on its - * configuration may take action such as suspending the pool or taking a + * When zfs_multihost_fail_intervals = 0, mmp write failures or delays are + * ignored. The failures will still be reported to the ZED which depending on + * its configuration may take action such as suspending the pool or taking a * device offline. * - * When zfs_multihost_fail_intervals > 0 then sequential mmp write failures will - * cause the pool to be suspended. This occurs when - * zfs_multihost_fail_intervals * zfs_multihost_interval milliseconds have - * passed since the last successful mmp write. This guarantees the activity - * test will see mmp writes if the - * pool is imported. + * When zfs_multihost_fail_intervals > 0, the pool will be suspended if + * zfs_multihost_fail_intervals * zfs_multihost_interval milliseconds pass + * without a successful mmp write. This guarantees the activity test will see + * mmp writes if the pool is imported. A value of 1 is ignored and treated as + * if it was set to 2, because a single leaf vdev pool will issue a write once + * per multihost_interval and thus any variation in latency would cause the + * pool to be suspended. */ uint_t zfs_multihost_fail_intervals = MMP_DEFAULT_FAIL_INTERVALS; @@ -137,6 +199,14 @@ mmp_init(spa_t *spa) cv_init(&mmp->mmp_thread_cv, NULL, CV_DEFAULT, NULL); mutex_init(&mmp->mmp_io_lock, NULL, MUTEX_DEFAULT, NULL); mmp->mmp_kstat_id = 1; + + /* + * mmp_write_done() calculates mmp_delay based on prior mmp_delay and + * the elapsed time since the last write. For the first mmp write, + * there is no "last write", so we start with fake non-zero values. + */ + mmp->mmp_last_write = gethrtime(); + mmp->mmp_delay = MSEC2NSEC(MMP_INTERVAL_OK(zfs_multihost_interval)); } void @@ -174,10 +244,10 @@ mmp_thread_start(spa_t *spa) if (spa_writeable(spa)) { mutex_enter(&mmp->mmp_thread_lock); if (!mmp->mmp_thread) { - dprintf("mmp_thread_start pool %s\n", - spa->spa_name); mmp->mmp_thread = thread_create(NULL, 0, mmp_thread, spa, 0, &p0, TS_RUN, minclsyspri); + zfs_dbgmsg("MMP thread started pool '%s' " + "gethrtime %llu", spa_name(spa), gethrtime()); } mutex_exit(&mmp->mmp_thread_lock); } @@ -196,6 +266,8 @@ mmp_thread_stop(spa_t *spa) cv_wait(&mmp->mmp_thread_cv, &mmp->mmp_thread_lock); } mutex_exit(&mmp->mmp_thread_lock); + zfs_dbgmsg("MMP thread stopped pool '%s' gethrtime %llu", + spa_name(spa), gethrtime()); ASSERT(mmp->mmp_thread == NULL); mmp->mmp_thread_exiting = 0; @@ -305,7 +377,8 @@ mmp_delay_update(spa_t *spa, boolean_t write_completed * strictly less than, in case delay was changed above. */ if (delay < mts->mmp_delay) { - hrtime_t min_delay = MSEC2NSEC(zfs_multihost_interval) / + hrtime_t min_delay = + MSEC2NSEC(MMP_INTERVAL_OK(zfs_multihost_interval)) / MAX(1, vdev_count_leaves(spa)); mts->mmp_delay = MAX(((delay + mts->mmp_delay * 127) / 128), min_delay); @@ -346,6 +419,7 @@ mmp_update_uberblock(spa_t *spa, uberblock_t *ub) mutex_enter(&mmp->mmp_io_lock); mmp->mmp_ub = *ub; + mmp->mmp_seq = 1; mmp->mmp_ub.ub_timestamp = gethrestime_sec(); mmp_delay_update(spa, B_TRUE); mutex_exit(&mmp->mmp_io_lock); @@ -370,8 +444,9 @@ mmp_write_uberblock(spa_t *spa) spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER); lock_acquire_time = gethrtime() - lock_acquire_time; if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10)) - zfs_dbgmsg("SCL_STATE acquisition took %llu ns\n", - (u_longlong_t)lock_acquire_time); + zfs_dbgmsg("MMP SCL_STATE acquisition pool '%s' took %llu ns " + "gethrtime %llu", spa_name(spa), lock_acquire_time, + gethrtime()); mutex_enter(&mmp->mmp_io_lock); @@ -400,6 +475,9 @@ mmp_write_uberblock(spa_t *spa) * gethrestime_sec(), mmp->mmp_delay, NULL, 0, * mmp->mmp_kstat_id++, error); */ + zfs_dbgmsg("MMP error choosing leaf pool '%s' " + "gethrtime %llu fail_mask %#x", spa_name(spa), + gethrtime(), error); } mutex_exit(&mmp->mmp_io_lock); spa_config_exit(spa, SCL_STATE, mmp_tag); @@ -407,16 +485,34 @@ mmp_write_uberblock(spa_t *spa) } vd = spa->spa_mmp.mmp_last_leaf; - mmp->mmp_skip_error = 0; + if (mmp->mmp_skip_error != 0) { + mmp->mmp_skip_error = 0; + zfs_dbgmsg("MMP write after skipping due to unavailable " + "leaves, pool '%s' gethrtime %llu leaf %#llu", + spa_name(spa), gethrtime(), vd->vdev_guid); + } if (mmp->mmp_zio_root == NULL) mmp->mmp_zio_root = zio_root(spa, NULL, NULL, flags | ZIO_FLAG_GODFATHER); + if (mmp->mmp_ub.ub_timestamp != gethrestime_sec()) { + /* + * Want to reset mmp_seq when timestamp advances because after + * an mmp_seq wrap new values will not be chosen by + * uberblock_compare() as the "best". + */ + mmp->mmp_ub.ub_timestamp = gethrestime_sec(); + mmp->mmp_seq = 1; + } + ub = &mmp->mmp_ub; - ub->ub_timestamp = gethrestime_sec(); ub->ub_mmp_magic = MMP_MAGIC; ub->ub_mmp_delay = mmp->mmp_delay; + ub->ub_mmp_config = MMP_SEQ_SET(mmp->mmp_seq) | + MMP_INTERVAL_SET(MMP_INTERVAL_OK(zfs_multihost_interval)) | + MMP_FAIL_INT_SET(MMP_FAIL_INTVS_OK( + zfs_multihost_fail_intervals)); vd->vdev_mmp_pending = gethrtime(); vd->vdev_mmp_kstat_id = mmp->mmp_kstat_id; @@ -425,6 +521,7 @@ mmp_write_uberblock(spa_t *spa) abd_zero(ub_abd, VDEV_UBERBLOCK_SIZE(vd)); abd_copy_from_buf(ub_abd, ub, sizeof (uberblock_t)); + mmp->mmp_seq++; mmp->mmp_kstat_id++; mutex_exit(&mmp->mmp_io_lock); @@ -450,39 +547,76 @@ mmp_thread(void *arg) { spa_t *spa = (spa_t *)arg; mmp_thread_t *mmp = &spa->spa_mmp; - boolean_t last_spa_suspended = spa_suspended(spa); - boolean_t last_spa_multihost = spa_multihost(spa); + boolean_t suspended = spa_suspended(spa); + boolean_t multihost = spa_multihost(spa); + uint64_t mmp_interval = MSEC2NSEC(MMP_INTERVAL_OK( + zfs_multihost_interval)); + uint32_t mmp_fail_intervals = MMP_FAIL_INTVS_OK( + zfs_multihost_fail_intervals); + hrtime_t mmp_fail_ns = mmp_fail_intervals * mmp_interval; + boolean_t last_spa_suspended = suspended; + boolean_t last_spa_multihost = multihost; + uint64_t last_mmp_interval = mmp_interval; + uint32_t last_mmp_fail_intervals = mmp_fail_intervals; + hrtime_t last_mmp_fail_ns = mmp_fail_ns; callb_cpr_t cpr; - hrtime_t max_fail_ns = zfs_multihost_fail_intervals * - MSEC2NSEC(MAX(zfs_multihost_interval, MMP_MIN_INTERVAL)); + int skip_wait = 0; mmp_thread_enter(mmp, &cpr); - /* - * The mmp_write_done() function calculates mmp_delay based on the - * prior value of mmp_delay and the elapsed time since the last write. - * For the first mmp write, there is no "last write", so we start - * with fake, but reasonable, default non-zero values. - */ - mmp->mmp_delay = MSEC2NSEC(MAX(zfs_multihost_interval, - MMP_MIN_INTERVAL)) / MAX(vdev_count_leaves(spa), 1); - mmp->mmp_last_write = gethrtime() - mmp->mmp_delay; - while (!mmp->mmp_thread_exiting) { - uint64_t mmp_fail_intervals = zfs_multihost_fail_intervals; - uint64_t mmp_interval = MSEC2NSEC( - MAX(zfs_multihost_interval, MMP_MIN_INTERVAL)); - boolean_t suspended = spa_suspended(spa); - boolean_t multihost = spa_multihost(spa); - hrtime_t next_time; + hrtime_t next_time = gethrtime() + + MSEC2NSEC(MMP_DEFAULT_INTERVAL); + int leaves = MAX(vdev_count_leaves(spa), 1); + /* Detect changes in tunables or state */ + + last_spa_suspended = suspended; + last_spa_multihost = multihost; + suspended = spa_suspended(spa); + multihost = spa_multihost(spa); + + last_mmp_interval = mmp_interval; + last_mmp_fail_intervals = mmp_fail_intervals; + last_mmp_fail_ns = mmp_fail_ns; + mmp_interval = MSEC2NSEC(MMP_INTERVAL_OK( + zfs_multihost_interval)); + mmp_fail_intervals = MMP_FAIL_INTVS_OK( + zfs_multihost_fail_intervals); + + /* Smooth so pool is not suspended when reducing tunables */ + if (mmp_fail_intervals * mmp_interval < mmp_fail_ns) { + mmp_fail_ns = (mmp_fail_ns * 31 + + mmp_fail_intervals * mmp_interval) / 32; + } else { + mmp_fail_ns = mmp_fail_intervals * + mmp_interval; + } + + if (mmp_interval != last_mmp_interval || + mmp_fail_intervals != last_mmp_fail_intervals) { + /* + * We want other hosts to see new tunables as quickly as + * possible. Write out at higher frequency than usual. + */ + skip_wait += leaves; + } + if (multihost) - next_time = gethrtime() + mmp_interval / - MAX(vdev_count_leaves(spa), 1); - else - next_time = gethrtime() + - MSEC2NSEC(MMP_DEFAULT_INTERVAL); + next_time = gethrtime() + mmp_interval / leaves; + if (mmp_fail_ns != last_mmp_fail_ns) { + zfs_dbgmsg("MMP interval change pool '%s' " + "gethrtime %llu last_mmp_interval %llu " + "mmp_interval %llu last_mmp_fail_intervals %u " + "mmp_fail_intervals %u mmp_fail_ns %llu " + "skip_wait %d leaves %d next_time %llu", + spa_name(spa), gethrtime(), last_mmp_interval, + mmp_interval, last_mmp_fail_intervals, + mmp_fail_intervals, mmp_fail_ns, skip_wait, leaves, + next_time); + } + /* * MMP off => on, or suspended => !suspended: * No writes occurred recently. Update mmp_last_write to give @@ -490,8 +624,14 @@ mmp_thread(void *arg) */ if ((!last_spa_multihost && multihost) || (last_spa_suspended && !suspended)) { + zfs_dbgmsg("MMP state change pool '%s': gethrtime %llu " + "last_spa_multihost %u multihost %u " + "last_spa_suspended %u suspended %u", + spa_name(spa), last_spa_multihost, multihost, + last_spa_suspended, suspended); mutex_enter(&mmp->mmp_io_lock); mmp->mmp_last_write = gethrtime(); + mmp->mmp_delay = mmp_interval; mutex_exit(&mmp->mmp_io_lock); } @@ -504,37 +644,38 @@ mmp_thread(void *arg) mmp->mmp_delay = 0; mutex_exit(&mmp->mmp_io_lock); } - last_spa_multihost = multihost; - last_spa_suspended = suspended; /* - * Smooth max_fail_ns when its factors are decreased, because - * making (max_fail_ns < mmp_interval) results in the pool being - * immediately suspended before writes can occur at the new - * higher frequency. - */ - if ((mmp_interval * mmp_fail_intervals) < max_fail_ns) { - max_fail_ns = ((31 * max_fail_ns) + (mmp_interval * - mmp_fail_intervals)) / 32; - } else { - max_fail_ns = mmp_interval * mmp_fail_intervals; - } - - /* * Suspend the pool if no MMP write has succeeded in over * mmp_interval * mmp_fail_intervals nanoseconds. */ - if (!suspended && mmp_fail_intervals && multihost && - (gethrtime() - mmp->mmp_last_write) > max_fail_ns) { + if (multihost && !suspended && mmp_fail_intervals && + (gethrtime() - mmp->mmp_last_write) > mmp_fail_ns) { + zfs_dbgmsg("MMP suspending pool '%s': gethrtime %llu " + "mmp_last_write %llu mmp_interval %llu " + "mmp_fail_intervals %llu mmp_fail_ns %llu", + spa_name(spa), (u_longlong_t)gethrtime(), + (u_longlong_t)mmp->mmp_last_write, + (u_longlong_t)mmp_interval, + (u_longlong_t)mmp_fail_intervals, + (u_longlong_t)mmp_fail_ns); cmn_err(CE_WARN, "MMP writes to pool '%s' have not " - "succeeded in over %llus; suspending pool", + "succeeded in over %llu ms; suspending pool. " + "Hrtime %llu", spa_name(spa), - NSEC2SEC(gethrtime() - mmp->mmp_last_write)); + NSEC2MSEC(gethrtime() - mmp->mmp_last_write), + gethrtime()); zio_suspend(spa, NULL, ZIO_SUSPEND_MMP); } if (multihost && !suspended) mmp_write_uberblock(spa); + + if (skip_wait > 0) { + next_time = gethrtime() + MSEC2NSEC(MMP_MIN_INTERVAL) / + leaves; + skip_wait--; + } CALLB_CPR_SAFE_BEGIN(&cpr); (void) cv_timedwait_sig_hrtime(&mmp->mmp_thread_cv, Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Wed Nov 6 09:09:03 2019 (r354386) @@ -2338,6 +2338,7 @@ spa_activity_check_required(spa_t *spa, uberblock_t *u uint64_t hostid = 0; uint64_t tryconfig_txg = 0; uint64_t tryconfig_timestamp = 0; + uint16_t tryconfig_mmp_seq = 0; nvlist_t *nvinfo; if (nvlist_exists(config, ZPOOL_CONFIG_LOAD_INFO)) { @@ -2346,6 +2347,8 @@ spa_activity_check_required(spa_t *spa, uberblock_t *u &tryconfig_txg); (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_TIMESTAMP, &tryconfig_timestamp); + (void) nvlist_lookup_uint16(nvinfo, ZPOOL_CONFIG_MMP_SEQ, + &tryconfig_mmp_seq); } (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &state); @@ -2362,14 +2365,17 @@ spa_activity_check_required(spa_t *spa, uberblock_t *u */ if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay == 0) return (B_FALSE); + /* - * If the tryconfig_* values are nonzero, they are the results of an - * earlier tryimport. If they match the uberblock we just found, then - * the pool has not changed and we return false so we do not test a - * second time. + * If the tryconfig_ values are nonzero, they are the results of an + * earlier tryimport. If they all match the uberblock we just found, + * then the pool has not changed and we return false so we do not test + * a second time. */ if (tryconfig_txg && tryconfig_txg == ub->ub_txg && - tryconfig_timestamp && tryconfig_timestamp == ub->ub_timestamp) + tryconfig_timestamp && tryconfig_timestamp == ub->ub_timestamp && + tryconfig_mmp_seq && tryconfig_mmp_seq == + (MMP_SEQ_VALID(ub) ? MMP_SEQ(ub) : 0)) return (B_FALSE); /* @@ -2393,16 +2399,87 @@ spa_activity_check_required(spa_t *spa, uberblock_t *u } /* + * Nanoseconds the activity check must watch for changes on-disk. + */ +static uint64_t +spa_activity_check_duration(spa_t *spa, uberblock_t *ub) +{ + uint64_t import_intervals = MAX(zfs_multihost_import_intervals, 1); + uint64_t multihost_interval = MSEC2NSEC( + MMP_INTERVAL_OK(zfs_multihost_interval)); + uint64_t import_delay = MAX(NANOSEC, import_intervals * + multihost_interval); + + /* + * Local tunables determine a minimum duration except for the case + * where we know when the remote host will suspend the pool if MMP + * writes do not land. + * + * See Big Theory comment at the top of mmp.c for the reasoning behind + * these cases and times. + */ + + ASSERT(MMP_IMPORT_SAFETY_FACTOR >= 100); + + if (MMP_INTERVAL_VALID(ub) && MMP_FAIL_INT_VALID(ub) && + MMP_FAIL_INT(ub) > 0) { + + /* MMP on remote host will suspend pool after failed writes */ + import_delay = MMP_FAIL_INT(ub) * MSEC2NSEC(MMP_INTERVAL(ub)) * + MMP_IMPORT_SAFETY_FACTOR / 100; + + zfs_dbgmsg("fail_intvals>0 import_delay=%llu ub_mmp " + "mmp_fails=%llu ub_mmp mmp_interval=%llu " + "import_intervals=%u", import_delay, MMP_FAIL_INT(ub), + MMP_INTERVAL(ub), import_intervals); + + } else if (MMP_INTERVAL_VALID(ub) && MMP_FAIL_INT_VALID(ub) && + MMP_FAIL_INT(ub) == 0) { + + /* MMP on remote host will never suspend pool */ + import_delay = MAX(import_delay, (MSEC2NSEC(MMP_INTERVAL(ub)) + + ub->ub_mmp_delay) * import_intervals); + + zfs_dbgmsg("fail_intvals=0 import_delay=%llu ub_mmp " + "mmp_interval=%llu ub_mmp_delay=%llu " + "import_intervals=%u", import_delay, MMP_INTERVAL(ub), + ub->ub_mmp_delay, import_intervals); + + } else if (MMP_VALID(ub)) { + /* + * zfs-0.7 compatability case + */ + + import_delay = MAX(import_delay, (multihost_interval + + ub->ub_mmp_delay) * import_intervals); + + zfs_dbgmsg("import_delay=%llu ub_mmp_delay=%llu " + "import_intervals=%u leaves=%u", import_delay, + ub->ub_mmp_delay, import_intervals, + vdev_count_leaves(spa)); + } else { + /* Using local tunings is the only reasonable option */ + zfs_dbgmsg("pool last imported on non-MMP aware " + "host using import_delay=%llu multihost_interval=%llu " + "import_intervals=%u", import_delay, multihost_interval, + import_intervals); + } + + return (import_delay); +} + +/* * Perform the import activity check. If the user canceled the import or * we detected activity then fail. */ static int spa_activity_check(spa_t *spa, uberblock_t *ub, nvlist_t *config) { - uint64_t import_intervals = MAX(zfs_multihost_import_intervals, 1); uint64_t txg = ub->ub_txg; uint64_t timestamp = ub->ub_timestamp; - uint64_t import_delay = NANOSEC; + uint64_t mmp_config = ub->ub_mmp_config; + uint16_t mmp_seq = MMP_SEQ_VALID(ub) ? MMP_SEQ(ub) : 0; + uint64_t import_delay; hrtime_t import_expire; nvlist_t *mmp_label = NULL; vdev_t *rvd = spa->spa_root_vdev; @@ -2419,7 +2496,7 @@ spa_activity_check(spa_t *spa, uberblock_t *ub, nvlist * during the earlier tryimport. If the txg recorded there is 0 then * the pool is known to be active on another host. * - * Otherwise, the pool might be in use on another node. Check for + * Otherwise, the pool might be in use on another host. Check for * changes in the uberblocks on disk if necessary. */ if (nvlist_exists(config, ZPOOL_CONFIG_LOAD_INFO)) { @@ -2434,32 +2511,25 @@ spa_activity_check(spa_t *spa, uberblock_t *ub, nvlist } } - /* - * Preferentially use the zfs_multihost_interval from the node which - * last imported the pool. This value is stored in an MMP uberblock as. - * - * ub_mmp_delay * vdev_count_leaves() == zfs_multihost_interval - */ - if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay) - import_delay = MAX(import_delay, import_intervals * - ub->ub_mmp_delay * MAX(vdev_count_leaves(spa), 1)); + import_delay = spa_activity_check_duration(spa, ub); - /* Apply a floor using the local default values. */ - import_delay = MAX(import_delay, import_intervals * - MSEC2NSEC(MAX(zfs_multihost_interval, MMP_MIN_INTERVAL))); - - zfs_dbgmsg("import_delay=%llu ub_mmp_delay=%llu import_intervals=%u " - "leaves=%u", import_delay, ub->ub_mmp_delay, import_intervals, - vdev_count_leaves(spa)); - /* Add a small random factor in case of simultaneous imports (0-25%) */ - import_expire = gethrtime() + import_delay + - (import_delay * spa_get_random(250) / 1000); + import_delay += import_delay * spa_get_random(250) / 1000; + import_expire = gethrtime() + import_delay; + while (gethrtime() < import_expire) { vdev_uberblock_load(rvd, ub, &mmp_label); - if (txg != ub->ub_txg || timestamp != ub->ub_timestamp) { + if (txg != ub->ub_txg || timestamp != ub->ub_timestamp || + mmp_seq != (MMP_SEQ_VALID(ub) ? MMP_SEQ(ub) : 0)) { + zfs_dbgmsg("multihost activity detected " + "txg %llu ub_txg %llu " + "timestamp %llu ub_timestamp %llu " + "mmp_config %#llx ub_mmp_config %#llx", + txg, ub->ub_txg, timestamp, ub->ub_timestamp, + mmp_config, ub->ub_mmp_config); + error = SET_ERROR(EREMOTEIO); break; } @@ -2844,6 +2914,9 @@ spa_ld_select_uberblock(spa_t *spa, spa_import_type_t ZPOOL_CONFIG_MMP_STATE, MMP_STATE_INACTIVE); fnvlist_add_uint64(spa->spa_load_info, ZPOOL_CONFIG_MMP_TXG, ub->ub_txg); + fnvlist_add_uint16(spa->spa_load_info, + ZPOOL_CONFIG_MMP_SEQ, + (MMP_SEQ_VALID(ub) ? MMP_SEQ(ub) : 0)); } /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h Wed Nov 6 09:09:03 2019 (r354386) @@ -29,8 +29,13 @@ extern "C" { #define MMP_MIN_INTERVAL 100 /* ms */ #define MMP_DEFAULT_INTERVAL 1000 /* ms */ -#define MMP_DEFAULT_IMPORT_INTERVALS 10 -#define MMP_DEFAULT_FAIL_INTERVALS 5 +#define MMP_DEFAULT_IMPORT_INTERVALS 20 +#define MMP_DEFAULT_FAIL_INTERVALS 10 +#define MMP_MIN_FAIL_INTERVALS 2 /* min if != 0 */ +#define MMP_IMPORT_SAFETY_FACTOR 200 /* pct */ +#define MMP_INTERVAL_OK(interval) MAX(interval, MMP_MIN_INTERVAL) +#define MMP_FAIL_INTVS_OK(fails) (fails == 0 ? 0 : MAX(fails, \ + MMP_MIN_FAIL_INTERVALS)) typedef struct mmp_thread { kmutex_t mmp_thread_lock; /* protect thread mgmt fields */ @@ -46,6 +51,7 @@ typedef struct mmp_thread { int mmp_skip_error; /* reason for last skipped write */ vdev_t *mmp_last_leaf; /* last mmp write sent here */ uint64_t mmp_leaf_last_gen; /* last mmp write sent here */ + uint32_t mmp_seq; /* intra-second update counter */ } mmp_thread_t; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h Wed Nov 6 09:09:03 2019 (r354386) @@ -44,8 +44,37 @@ extern "C" { */ #define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ #define UBERBLOCK_SHIFT 10 /* up to 1K */ -#define MMP_MAGIC 0xa11cea11 /* all-see-all */ +#define MMP_MAGIC 0xa11cea11 /* all-see-all */ +#define MMP_INTERVAL_VALID_BIT 0x01 +#define MMP_SEQ_VALID_BIT 0x02 +#define MMP_FAIL_INT_VALID_BIT 0x04 + +#define MMP_VALID(ubp) (ubp->ub_magic == UBERBLOCK_MAGIC && \ + ubp->ub_mmp_magic == MMP_MAGIC) +#define MMP_INTERVAL_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_INTERVAL_VALID_BIT)) +#define MMP_SEQ_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_SEQ_VALID_BIT)) +#define MMP_FAIL_INT_VALID(ubp) (MMP_VALID(ubp) && (ubp->ub_mmp_config & \ + MMP_FAIL_INT_VALID_BIT)) + +#define MMP_INTERVAL(ubp) ((ubp->ub_mmp_config & 0x00000000FFFFFF00) \ + >> 8) +#define MMP_SEQ(ubp) ((ubp->ub_mmp_config & 0x0000FFFF00000000) \ + >> 32) +#define MMP_FAIL_INT(ubp) ((ubp->ub_mmp_config & 0xFFFF000000000000) \ + >> 48) + +#define MMP_INTERVAL_SET(write) \ + (((uint64_t)(write & 0xFFFFFF) << 8) | MMP_INTERVAL_VALID_BIT) + +#define MMP_SEQ_SET(seq) \ + (((uint64_t)(seq & 0xFFFF) << 32) | MMP_SEQ_VALID_BIT) + +#define MMP_FAIL_INT_SET(fail) \ + (((uint64_t)(fail & 0xFFFF) << 48) | MMP_FAIL_INT_VALID_BIT) + struct uberblock { uint64_t ub_magic; /* UBERBLOCK_MAGIC */ uint64_t ub_version; /* SPA_VERSION */ @@ -59,8 +88,31 @@ struct uberblock { /* Maybe missing in uberblocks we read, but always written */ uint64_t ub_mmp_magic; + /* + * If ub_mmp_delay == 0 and ub_mmp_magic is valid, MMP is off. + * Otherwise, nanosec since last MMP write. + */ uint64_t ub_mmp_delay; - uint64_t ub_mmp_seq; + + /* + * The ub_mmp_config contains the multihost write interval, multihost + * fail intervals, sequence number for sub-second granularity, and + * valid bit mask. This layout is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | Fail Intervals| Seq | Write Interval (ms) | VALID | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * This allows a write_interval of (2^24/1000)s, over 4.5 hours + * + * VALID Bits: + * - 0x01 - Write Interval (ms) + * - 0x02 - Sequence number exists + * - 0x04 - Fail Intervals + * - 0xf8 - Reserved + */ + uint64_t ub_mmp_config; /* * ub_checkpoint_txg indicates two things about the current uberblock: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c Wed Nov 6 09:09:03 2019 (r354386) @@ -26,6 +26,7 @@ #include #include #include +#include int uberblock_verify(uberblock_t *ub) @@ -58,8 +59,15 @@ uberblock_update(uberblock_t *ub, vdev_t *rvd, uint64_ ub->ub_timestamp = gethrestime_sec(); ub->ub_software_version = SPA_VERSION; ub->ub_mmp_magic = MMP_MAGIC; - ub->ub_mmp_delay = spa_multihost(rvd->vdev_spa) ? mmp_delay : 0; - ub->ub_mmp_seq = 0; + if (spa_multihost(rvd->vdev_spa)) { + ub->ub_mmp_delay = mmp_delay; + ub->ub_mmp_config = MMP_SEQ_SET(0) | + MMP_INTERVAL_SET(zfs_multihost_interval) | + MMP_FAIL_INT_SET(zfs_multihost_fail_intervals); + } else { + ub->ub_mmp_delay = 0; + ub->ub_mmp_config = 0; + } ub->ub_checkpoint_txg = 0; return (ub->ub_rootbp.blk_birth == txg); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c Wed Nov 6 09:09:03 2019 (r354386) @@ -1016,10 +1016,35 @@ static int vdev_uberblock_compare(const uberblock_t *ub1, const uberblock_t *ub2) { int cmp = AVL_CMP(ub1->ub_txg, ub2->ub_txg); + if (likely(cmp)) return (cmp); - return (AVL_CMP(ub1->ub_timestamp, ub2->ub_timestamp)); + cmp = AVL_CMP(ub1->ub_timestamp, ub2->ub_timestamp); + if (likely(cmp)) + return (cmp); + + /* + * If MMP_VALID(ub) && MMP_SEQ_VALID(ub) then the host has an MMP-aware + * ZFS, e.g. zfsonlinux >= 0.7. + * + * If one ub has MMP and the other does not, they were written by + * different hosts, which matters for MMP. So we treat no MMP/no SEQ as + * a 0 value. + * + * Since timestamp and txg are the same if we get this far, either is + * acceptable for importing the pool. + */ + unsigned int seq1 = 0; + unsigned int seq2 = 0; + + if (MMP_VALID(ub1) && MMP_SEQ_VALID(ub1)) + seq1 = MMP_SEQ(ub1); + + if (MMP_VALID(ub2) && MMP_SEQ_VALID(ub2)) + seq2 = MMP_SEQ(ub2); + + return (AVL_CMP(seq1, seq2)); } struct ubl_cbdata { Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Wed Nov 6 09:05:39 2019 (r354385) +++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Wed Nov 6 09:09:03 2019 (r354386) @@ -600,6 +600,7 @@ typedef struct zpool_load_policy { #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */ +#define ZPOOL_CONFIG_MMP_SEQ "mmp_seq" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */ #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */ #define ZPOOL_CONFIG_ALLOCATION_BIAS "alloc_bias" /* not stored on disk */ From owner-svn-src-all@freebsd.org Wed Nov 6 09:09:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 202AD1AF63D; Wed, 6 Nov 2019 09:09:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477LLn06csz3LMD; Wed, 6 Nov 2019 09:09:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC74E22B9C; Wed, 6 Nov 2019 09:09:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6994KO053259; Wed, 6 Nov 2019 09:09:04 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6994ZX053258; Wed, 6 Nov 2019 09:09:04 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911060909.xA6994ZX053258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 6 Nov 2019 09:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354386 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb X-SVN-Group: vendor X-SVN-Commit-Author: avg X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/illumos/dist/cmd/zdb X-SVN-Commit-Revision: 354386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 09:09:05 -0000 Author: avg Date: Wed Nov 6 09:09:03 2019 New Revision: 354386 URL: https://svnweb.freebsd.org/changeset/base/354386 Log: 11770 additional mmp fixes illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e https://www.illumos.org/issues/11770 Port a few additional MMP fixes from ZoL that came in after our initial MMP port. 4ca457b065 ZTS: Fix mmp_interval failure ca95f70dff zpool import progress kstat (only minimal changes from above can be pulled in right now) 060f0226e6 MMP interval and fail_intervals in uberblock Portions contributed by: Jerry Jelinek Portions contributed by: Brian Behlendorf Author: Olaf Faaland Modified: vendor/illumos/dist/cmd/zdb/zdb.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/mmp.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/mmp.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/uberblock.c vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Modified: vendor/illumos/dist/cmd/zdb/zdb.c ============================================================================== --- vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 09:05:39 2019 (r354385) +++ vendor/illumos/dist/cmd/zdb/zdb.c Wed Nov 6 09:09:03 2019 (r354386) @@ -2425,9 +2425,22 @@ dump_uberblock(uberblock_t *ub, const char *header, co (void) printf("\tmmp_magic = %016llx\n", (u_longlong_t)ub->ub_mmp_magic); - if (ub->ub_mmp_magic == MMP_MAGIC) + if (MMP_VALID(ub)) { (void) printf("\tmmp_delay = %0llu\n", (u_longlong_t)ub->ub_mmp_delay); + if (MMP_SEQ_VALID(ub)) + (void) printf("\tmmp_seq = %u\n", + (unsigned int) MMP_SEQ(ub)); + if (MMP_FAIL_INT_VALID(ub)) + (void) printf("\tmmp_fail = %u\n", + (unsigned int) MMP_FAIL_INT(ub)); + if (MMP_INTERVAL_VALID(ub)) + (void) printf("\tmmp_write = %u\n", + (unsigned int) MMP_INTERVAL(ub)); + /* After MMP_* to make summarize_uberblock_mmp cleaner */ + (void) printf("\tmmp_valid = %x\n", + (unsigned int) ub->ub_mmp_config & 0xFF); + } if (dump_opt['u'] >= 3) { char blkbuf[BP_SPRINTF_LEN]; From owner-svn-src-all@freebsd.org Wed Nov 6 13:45:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6E111B6644; Wed, 6 Nov 2019 13:45:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477STc5r4Hz47Cb; Wed, 6 Nov 2019 13:45:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC04125E11; Wed, 6 Nov 2019 13:45:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6DjOFo024660; Wed, 6 Nov 2019 13:45:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6DjOkT024659; Wed, 6 Nov 2019 13:45:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911061345.xA6DjOkT024659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 6 Nov 2019 13:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354387 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 354387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 13:45:25 -0000 Author: kib Date: Wed Nov 6 13:45:24 2019 New Revision: 354387 URL: https://svnweb.freebsd.org/changeset/base/354387 Log: MFC r353888, r353916, r353964 (by markj): vm_fault(): extract code to lock the vnode into a helper vm_fault_lock_vnode(). Modified: stable/12/sys/vm/vm_fault.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_fault.c ============================================================================== --- stable/12/sys/vm/vm_fault.c Wed Nov 6 09:09:03 2019 (r354386) +++ stable/12/sys/vm/vm_fault.c Wed Nov 6 13:45:24 2019 (r354387) @@ -152,11 +152,13 @@ static inline void release_page(struct faultstate *fs) { - vm_page_xunbusy(fs->m); - vm_page_lock(fs->m); - vm_page_deactivate(fs->m); - vm_page_unlock(fs->m); - fs->m = NULL; + if (fs->m != NULL) { + vm_page_xunbusy(fs->m); + vm_page_lock(fs->m); + vm_page_deactivate(fs->m); + vm_page_unlock(fs->m); + fs->m = NULL; + } } static inline void @@ -630,19 +632,64 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot return (result); } +static int +vm_fault_lock_vnode(struct faultstate *fs) +{ + struct vnode *vp; + int error, locked; + + if (fs->object->type != OBJT_VNODE) + return (KERN_SUCCESS); + vp = fs->object->handle; + if (vp == fs->vp) { + ASSERT_VOP_LOCKED(vp, "saved vnode is not locked"); + return (KERN_SUCCESS); + } + + /* + * Perform an unlock in case the desired vnode changed while + * the map was unlocked during a retry. + */ + unlock_vp(fs); + + locked = VOP_ISLOCKED(vp); + if (locked != LK_EXCLUSIVE) + locked = LK_SHARED; + + /* + * We must not sleep acquiring the vnode lock while we have + * the page exclusive busied or the object's + * paging-in-progress count incremented. Otherwise, we could + * deadlock. + */ + error = vget(vp, locked | LK_CANRECURSE | LK_NOWAIT, curthread); + if (error == 0) { + fs->vp = vp; + return (KERN_SUCCESS); + } + + vhold(vp); + release_page(fs); + unlock_and_deallocate(fs); + error = vget(vp, locked | LK_RETRY | LK_CANRECURSE, curthread); + vdrop(vp); + fs->vp = vp; + KASSERT(error == 0, ("vm_fault: vget failed %d", error)); + return (KERN_RESOURCE_SHORTAGE); +} + int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold) { struct faultstate fs; - struct vnode *vp; struct domainset *dset; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; vm_prot_t prot, retry_prot; - int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; - int locked, nera, oom, result, rv; + int ahead, alloc_req, behind, cluster_offset, era, faultcount; + int nera, oom, result, rv; u_char behavior; boolean_t wired; /* Passed by reference. */ bool dead, hardfault, is_first_object_locked; @@ -1006,41 +1053,11 @@ readrest: */ unlock_map(&fs); - if (fs.object->type == OBJT_VNODE && - (vp = fs.object->handle) != fs.vp) { - /* - * Perform an unlock in case the desired vnode - * changed while the map was unlocked during a - * retry. - */ - unlock_vp(&fs); - - locked = VOP_ISLOCKED(vp); - if (locked != LK_EXCLUSIVE) - locked = LK_SHARED; - - /* - * We must not sleep acquiring the vnode lock - * while we have the page exclusive busied or - * the object's paging-in-progress count - * incremented. Otherwise, we could deadlock. - */ - error = vget(vp, locked | LK_CANRECURSE | - LK_NOWAIT, curthread); - if (error != 0) { - vhold(vp); - release_page(&fs); - unlock_and_deallocate(&fs); - error = vget(vp, locked | LK_RETRY | - LK_CANRECURSE, curthread); - vdrop(vp); - fs.vp = vp; - KASSERT(error == 0, - ("vm_fault: vget failed")); - goto RetryFault; - } - fs.vp = vp; - } + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; KASSERT(fs.vp == NULL || !fs.map->system_map, ("vm_fault: vnode-backed object mapped by system map")); From owner-svn-src-all@freebsd.org Wed Nov 6 14:09:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 758101B7017; Wed, 6 Nov 2019 14:09:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477T1t3FNNz4939; Wed, 6 Nov 2019 14:09:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5348B2618D; Wed, 6 Nov 2019 14:09:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6E9sb4040776; Wed, 6 Nov 2019 14:09:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6E9rgh040770; Wed, 6 Nov 2019 14:09:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061409.xA6E9rgh040770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 14:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354388 - in vendor/NetBSD/blacklist/dist: bin diff lib X-SVN-Group: vendor X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in vendor/NetBSD/blacklist/dist: bin diff lib X-SVN-Commit-Revision: 354388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:09:54 -0000 Author: emaste Date: Wed Nov 6 14:09:52 2019 New Revision: 354388 URL: https://svnweb.freebsd.org/changeset/base/354388 Log: Vendor import of NetBSD's external/bsd/blacklist @ 20191106 Sponsored by: The FreeBSD Foundation Modified: vendor/NetBSD/blacklist/dist/bin/blacklistctl.c vendor/NetBSD/blacklist/dist/bin/blacklistd.c vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5 vendor/NetBSD/blacklist/dist/bin/support.c vendor/NetBSD/blacklist/dist/diff/ssh.diff vendor/NetBSD/blacklist/dist/lib/Makefile vendor/NetBSD/blacklist/dist/lib/libblacklist.3 Modified: vendor/NetBSD/blacklist/dist/bin/blacklistctl.c ============================================================================== --- vendor/NetBSD/blacklist/dist/bin/blacklistctl.c Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/bin/blacklistctl.c Wed Nov 6 14:09:52 2019 (r354388) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $ */ +/* $NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $"); +__RCSID("$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $"); #include #include @@ -67,6 +67,15 @@ usage(int c) exit(EXIT_FAILURE); } +static const char * +star(char *buf, size_t len, int val) +{ + if (val == -1) + return "*"; + snprintf(buf, len, "%d", val); + return buf; +} + int main(int argc, char *argv[]) { @@ -128,9 +137,10 @@ main(int argc, char *argv[]) "address", remain ? "remaining time" : "last access"); for (i = 1; state_iterate(db, &c, &dbi, i) != 0; i = 0) { char buf[BUFSIZ]; + char mbuf[64], pbuf[64]; if (!all) { if (blocked) { - if (dbi.count < c.c_nfail) + if (c.c_nfail == -1 || dbi.count < c.c_nfail) continue; } else { if (dbi.count >= c.c_nfail) @@ -138,13 +148,20 @@ main(int argc, char *argv[]) } } sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&c.c_ss); - printf("%*.*s/%d:%d\t", wide, wide, buf, c.c_lmask, c.c_port); - if (remain) - fmtydhms(buf, sizeof(buf), - c.c_duration - (ts.tv_sec - dbi.last)); - else - fmttime(buf, sizeof(buf), dbi.last); - printf("%s\t%d/%d\t%-s\n", dbi.id, dbi.count, c.c_nfail, buf); + printf("%*.*s/%s:%s\t", wide, wide, buf, + star(mbuf, sizeof(mbuf), c.c_lmask), + star(pbuf, sizeof(pbuf), c.c_port)); + if (c.c_duration == -1) { + strlcpy(buf, "never", sizeof(buf)); + } else { + if (remain) + fmtydhms(buf, sizeof(buf), + c.c_duration - (ts.tv_sec - dbi.last)); + else + fmttime(buf, sizeof(buf), dbi.last); + } + printf("%s\t%d/%s\t%-s\n", dbi.id, dbi.count, + star(mbuf, sizeof(mbuf), c.c_nfail), buf); } state_close(db); return EXIT_SUCCESS; Modified: vendor/NetBSD/blacklist/dist/bin/blacklistd.c ============================================================================== --- vendor/NetBSD/blacklist/dist/bin/blacklistd.c Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/bin/blacklistd.c Wed Nov 6 14:09:52 2019 (r354388) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $ */ +/* $NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "config.h" #endif #include -__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $"); +__RCSID("$NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $"); #include #include @@ -394,7 +394,6 @@ rules_restore(void) for (f = 1; state_iterate(state, &c, &dbi, f) == 1; f = 0) { if (dbi.id[0] == '\0') continue; - (void)run_change("rem", &c, dbi.id, 0); (void)run_change("add", &c, dbi.id, sizeof(dbi.id)); } } @@ -491,7 +490,8 @@ main(int argc, char *argv[]) conf_parse(configfile); if (flush) { rules_flush(); - flags |= O_TRUNC; + if (!restore) + flags |= O_TRUNC; } struct pollfd *pfd = NULL; @@ -522,8 +522,11 @@ main(int argc, char *argv[]) if (state == NULL) return EXIT_FAILURE; - if (restore) + if (restore) { + if (!flush) + rules_flush(); rules_restore(); + } if (!debug) { if (daemon(0, 0) == -1) Modified: vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5 ============================================================================== --- vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5 Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5 Wed Nov 6 14:09:52 2019 (r354388) @@ -1,4 +1,4 @@ -.\" $NetBSD: blacklistd.conf.5,v 1.5 2016/06/08 12:48:37 wiz Exp $ +.\" $NetBSD: blacklistd.conf.5,v 1.7 2017/06/07 13:50:57 wiz Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 7, 2016 +.Dd June 5, 2017 .Dt BLACKLISTD.CONF 5 .Os .Sh NAME @@ -36,12 +36,13 @@ .Sh DESCRIPTION The .Nm -files contains configuration lines for -.Xr blacklistd 8 . -It contains one entry per line, and is similar to +files contains configuration entries for +.Xr blacklistd 8 +in a fashion similar to .Xr inetd.conf 5 . -There must be an entry for each field of the configuration file, with -entries for each field separated by a tab or a space. +Only one entry per line is permitted. +Every entry must have all fields populated. +Each field can be separated by a tab or a space. Comments are denoted by a .Dq # at the beginning of a line. @@ -109,7 +110,7 @@ The can be an IPv4 address in numeric format, an IPv6 address in numeric format and enclosed by square brackets, or an interface name. Mask modifiers are not allowed on interfaces because interfaces -have multiple address in different protocols where the mask has a different +can have multiple addresses in different protocols where the mask has a different size. .Pp The @@ -150,8 +151,8 @@ If the contains a .Dq / , the remaining portion of the name is interpreted as the mask to be -applied to the address specified in the rule, so one can block whole -subnets for a single rule violation. +applied to the address specified in the rule, causing a single rule violation to +block the entire subnet for the configured prefix. .Pp The .Va nfail @@ -176,10 +177,11 @@ for days. .Pp Matching is done first by checking the .Va local -rules one by one, from the most specific to the least specific. +rules individually, in the order of the most specific to the least specific. If a match is found, then the .Va remote -rules are applied, and if a match is found the +rules are applied. +The .Va name , .Va nfail , and @@ -191,15 +193,15 @@ rule that matched. The .Va remote rules can be used for whitelisting specific addresses, changing the mask -size, or the rule that the packet filter uses, the number of failed attempts, -or the blocked duration. +size, the rule that the packet filter uses, the number of failed attempts, +or the block duration. .Sh FILES .Bl -tag -width /etc/blacklistd.conf -compact .It Pa /etc/blacklistd.conf Configuration file. .El .Sh EXAMPLES -.Bd -literal -offset +.Bd -literal -offset 8n # Block ssh, after 3 attempts for 6 hours on the bnx0 interface [local] # location type proto owner name nfail duration Modified: vendor/NetBSD/blacklist/dist/bin/support.c ============================================================================== --- vendor/NetBSD/blacklist/dist/bin/support.c Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/bin/support.c Wed Nov 6 14:09:52 2019 (r354388) @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.8 2016/04/04 15:52:56 christos Exp $ */ +/* $NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: support.c,v 1.8 2016/04/04 15:52:56 christos Exp $"); +__RCSID("$NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $"); #include #include @@ -105,12 +105,16 @@ fmtydhms(char *b, size_t l, time_t t) s = t % 60; t /= 60; + m = t % 60; t /= 60; - h = t % 60; + + h = t % 24; t /= 24; - d = t % 24; - t /= 356; + + d = t % 365; + t /= 365; + y = t; z = 0; Modified: vendor/NetBSD/blacklist/dist/diff/ssh.diff ============================================================================== --- vendor/NetBSD/blacklist/dist/diff/ssh.diff Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/diff/ssh.diff Wed Nov 6 14:09:52 2019 (r354388) @@ -1,6 +1,6 @@ --- /dev/null 2015-01-22 23:10:33.000000000 -0500 +++ dist/pfilter.c 2015-01-22 23:46:03.000000000 -0500 -@@ -0,0 +1,28 @@ +@@ -0,0 +1,32 @@ +#include "namespace.h" +#include "includes.h" +#include "ssh.h" @@ -28,6 +28,10 @@ + // XXX: 3? + fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3; + (void)blacklist_r(blstate, a, fd, "ssh"); ++ if (a == 0) { ++ blacklist_close(blstate); ++ blstate = NULL; ++ } +} --- /dev/null 2015-01-20 21:14:44.000000000 -0500 +++ dist/pfilter.h 2015-01-20 20:16:20.000000000 -0500 @@ -58,174 +62,89 @@ diff -u -u -r1.10 Makefile + +LDADD+= -lblacklist +DPADD+= ${LIBBLACKLIST} -Index: dist/auth.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth.c,v -retrieving revision 1.10 -diff -u -u -r1.10 auth.c ---- dist/auth.c 19 Oct 2014 16:30:58 -0000 1.10 -+++ dist/auth.c 22 Jan 2015 21:39:22 -0000 -@@ -62,6 +62,7 @@ - #include "monitor_wrap.h" - #include "krl.h" - #include "compat.h" -+#include "pfilter.h" - - #ifdef HAVE_LOGIN_CAP - #include -@@ -362,6 +363,8 @@ - compat20 ? "ssh2" : "ssh1", - authctxt->info != NULL ? ": " : "", - authctxt->info != NULL ? authctxt->info : ""); -+ if (!authctxt->postponed) -+ pfilter_notify(!authenticated); - free(authctxt->info); - authctxt->info = NULL; - } -Index: dist/sshd.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v -retrieving revision 1.15 -diff -u -u -r1.15 sshd.c ---- dist/sshd.c 28 Oct 2014 21:36:16 -0000 1.15 -+++ dist/sshd.c 22 Jan 2015 21:39:22 -0000 -@@ -109,6 +109,7 @@ - #include "roaming.h" - #include "ssh-sandbox.h" - #include "version.h" -+#include "pfilter.h" - - #ifdef LIBWRAP - #include -@@ -364,6 +365,7 @@ - killpg(0, SIGTERM); - } - -+ pfilter_notify(1); - /* Log error and exit. */ - sigdie("Timeout before authentication for %s", get_remote_ipaddr()); - } -@@ -1160,6 +1162,7 @@ - for (i = 0; i < options.max_startups; i++) - startup_pipes[i] = -1; - -+ pfilter_init(); - /* - * Stay listening for connections until the system crashes or - * the daemon is killed with a signal. -Index: auth1.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth1.c,v -retrieving revision 1.9 -diff -u -u -r1.9 auth1.c ---- auth1.c 19 Oct 2014 16:30:58 -0000 1.9 -+++ auth1.c 14 Feb 2015 15:40:51 -0000 -@@ -41,6 +41,7 @@ +diff -ru openssh-7.7p1/auth-pam.c dist/auth-pam.c +--- openssh-7.7p1/auth-pam.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/auth-pam.c 2018-05-23 11:56:22.206661484 -0400 +@@ -103,6 +103,7 @@ + #include "ssh-gss.h" #endif #include "monitor_wrap.h" - #include "buffer.h" +#include "pfilter.h" - /* import */ extern ServerOptions options; -@@ -445,6 +446,7 @@ - else { - debug("do_authentication: invalid user %s", user); - authctxt->pw = fakepw(); -+ pfilter_notify(1); - } + extern Buffer loginmsg; +@@ -526,6 +527,7 @@ + ssh_msg_send(ctxt->pam_csock, PAM_MAXTRIES, &buffer); + else + ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); ++ pfilter_notify(1); + buffer_free(&buffer); + pthread_exit(NULL); - /* Configuration may have changed as a result of Match */ -Index: auth2.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth2.c,v -retrieving revision 1.9 -diff -u -u -r1.9 auth2.c ---- auth2.c 19 Oct 2014 16:30:58 -0000 1.9 -+++ auth2.c 14 Feb 2015 15:40:51 -0000 -@@ -52,6 +52,7 @@ +@@ -804,6 +806,7 @@ + free(msg); + return (0); + } ++ pfilter_notify(1); + error("PAM: %s for %s%.100s from %.100s", msg, + sshpam_authctxt->valid ? "" : "illegal user ", + sshpam_authctxt->user, +diff -ru openssh-7.7p1/auth2.c dist/auth2.c +--- openssh-7.7p1/auth2.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/auth2.c 2018-05-23 11:57:31.022197317 -0400 +@@ -51,6 +51,7 @@ + #include "dispatch.h" #include "pathnames.h" #include "buffer.h" - #include "canohost.h" +#include "pfilter.h" #ifdef GSSAPI #include "ssh-gss.h" -@@ -256,6 +257,7 @@ +@@ -242,6 +243,7 @@ } else { - logit("input_userauth_request: invalid user %s", user); + /* Invalid user, fake password information */ authctxt->pw = fakepw(); + pfilter_notify(1); - } - #ifdef USE_PAM - if (options.use_pam) -Index: sshd.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v -retrieving revision 1.16 -diff -u -r1.16 sshd.c ---- sshd.c 25 Jan 2015 15:52:44 -0000 1.16 -+++ sshd.c 14 Feb 2015 09:55:06 -0000 -@@ -628,6 +628,8 @@ - explicit_bzero(pw->pw_passwd, strlen(pw->pw_passwd)); - endpwent(); - -+ pfilter_init(); -+ - /* Change our root directory */ - if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) - fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR, - -Index: auth-pam.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth-pam.c,v -retrieving revision 1.7 -diff -u -u -r1.7 auth-pam.c ---- auth-pam.c 3 Jul 2015 00:59:59 -0000 1.7 -+++ auth-pam.c 23 Jan 2016 00:01:16 -0000 -@@ -114,6 +114,7 @@ - #include "ssh-gss.h" + #ifdef SSH_AUDIT_EVENTS + PRIVSEP(audit_event(SSH_INVALID_USER)); #endif - #include "monitor_wrap.h" +Only in dist: pfilter.c +Only in dist: pfilter.h +diff -ru openssh-7.7p1/sshd.c dist/sshd.c +--- openssh-7.7p1/sshd.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/sshd.c 2018-05-23 11:59:39.573197347 -0400 +@@ -122,6 +122,7 @@ + #include "auth-options.h" + #include "version.h" + #include "ssherr.h" +#include "pfilter.h" - extern ServerOptions options; - extern Buffer loginmsg; -@@ -809,6 +810,7 @@ - free(msg); - return (0); - } -+ pfilter_notify(1); - error("PAM: %s for %s%.100s from %.100s", msg, - sshpam_authctxt->valid ? "" : "illegal user ", - sshpam_authctxt->user, -Index: auth.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth.c,v -retrieving revision 1.15 -diff -u -u -r1.15 auth.c ---- auth.c 21 Aug 2015 08:20:59 -0000 1.15 -+++ auth.c 23 Jan 2016 00:01:16 -0000 -@@ -656,6 +656,7 @@ + /* Re-exec fds */ + #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) +@@ -346,6 +347,7 @@ + static void + grace_alarm_handler(int sig) + { ++ pfilter_notify(1); + if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0) + kill(pmonitor->m_pid, SIGALRM); - pw = getpwnam(user); - if (pw == NULL) { -+ pfilter_notify(1); - logit("Invalid user %.100s from %.100s", - user, get_remote_ipaddr()); - return (NULL); -Index: auth1.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth1.c,v -retrieving revision 1.12 -diff -u -u -r1.12 auth1.c ---- auth1.c 3 Jul 2015 00:59:59 -0000 1.12 -+++ auth1.c 23 Jan 2016 00:01:16 -0000 -@@ -376,6 +376,7 @@ - char *msg; - size_t len; +@@ -1835,6 +1837,8 @@ + if (test_flag) + exit(0); -+ pfilter_notify(1); - error("Access denied for user %s by PAM account " - "configuration", authctxt->user); - len = buffer_len(&loginmsg); ++ pfilter_init(); ++ + /* + * Clear out any supplemental groups we may have inherited. This + * prevents inadvertent creation of files with bad modes (in the +@@ -2280,6 +2284,9 @@ + { + struct ssh *ssh = active_state; /* XXX */ + ++ if (i == 255) ++ pfilter_notify(1); ++ + if (the_authctxt) { + do_cleanup(ssh, the_authctxt); + if (use_privsep && privsep_is_preauth && Modified: vendor/NetBSD/blacklist/dist/lib/Makefile ============================================================================== --- vendor/NetBSD/blacklist/dist/lib/Makefile Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/lib/Makefile Wed Nov 6 14:09:52 2019 (r354388) @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.6 2016/01/05 13:07:46 christos Exp $ +# $NetBSD: Makefile,v 1.7 2019/03/08 20:40:05 christos Exp $ .include USE_SHLIBDIR= yes CPPFLAGS+=-D_REENTRANT -LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread +#LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread LIB=blacklist SRCS=bl.c blacklist.c MAN=libblacklist.3 Modified: vendor/NetBSD/blacklist/dist/lib/libblacklist.3 ============================================================================== --- vendor/NetBSD/blacklist/dist/lib/libblacklist.3 Wed Nov 6 13:45:24 2019 (r354387) +++ vendor/NetBSD/blacklist/dist/lib/libblacklist.3 Wed Nov 6 14:09:52 2019 (r354388) @@ -1,4 +1,4 @@ -.\" $NetBSD: libblacklist.3,v 1.7 2017/02/04 23:33:56 wiz Exp $ +.\" $NetBSD: libblacklist.3,v 1.8 2017/10/22 10:31:57 abhinav Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nm blacklist_close , .Nm blacklist_r , .Nm blacklist , -.Nm blacklist_sa +.Nm blacklist_sa , .Nm blacklist_sa_r .Nd Blacklistd notification library .Sh LIBRARY From owner-svn-src-all@freebsd.org Wed Nov 6 14:10:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39B971B708D; Wed, 6 Nov 2019 14:10:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477T2z1W2xz49KF; Wed, 6 Nov 2019 14:10:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16D01261B3; Wed, 6 Nov 2019 14:10:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EApdR043162; Wed, 6 Nov 2019 14:10:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EAoK3043157; Wed, 6 Nov 2019 14:10:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061410.xA6EAoK3043157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 14:10:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354389 - in vendor/NetBSD/blacklist/20191106: . bin diff lib X-SVN-Group: vendor X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in vendor/NetBSD/blacklist/20191106: . bin diff lib X-SVN-Commit-Revision: 354389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:10:51 -0000 Author: emaste Date: Wed Nov 6 14:10:50 2019 New Revision: 354389 URL: https://svnweb.freebsd.org/changeset/base/354389 Log: Tag import of NetBSD's external/bsd/blacklist @ 20191106 Sponsored by: The FreeBSD Foundation Added: vendor/NetBSD/blacklist/20191106/ - copied from r354387, vendor/NetBSD/blacklist/dist/ Replaced: vendor/NetBSD/blacklist/20191106/bin/blacklistctl.c - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistctl.c vendor/NetBSD/blacklist/20191106/bin/blacklistd.c - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.c vendor/NetBSD/blacklist/20191106/bin/blacklistd.conf.5 - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5 vendor/NetBSD/blacklist/20191106/bin/support.c - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/bin/support.c vendor/NetBSD/blacklist/20191106/diff/ssh.diff - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/diff/ssh.diff vendor/NetBSD/blacklist/20191106/lib/Makefile - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/lib/Makefile vendor/NetBSD/blacklist/20191106/lib/libblacklist.3 - copied unchanged from r354388, vendor/NetBSD/blacklist/dist/lib/libblacklist.3 Copied: vendor/NetBSD/blacklist/20191106/bin/blacklistctl.c (from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistctl.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/blacklist/20191106/bin/blacklistctl.c Wed Nov 6 14:10:50 2019 (r354389, copy of r354388, vendor/NetBSD/blacklist/dist/bin/blacklistctl.c) @@ -0,0 +1,168 @@ +/* $NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $ */ + +/*- + * Copyright (c) 2015 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +__RCSID("$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $"); + +#include +#include +#ifdef HAVE_LIBUTIL_H +#include +#endif +#ifdef HAVE_UTIL_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +#include "conf.h" +#include "state.h" +#include "internal.h" +#include "support.h" + +static __dead void +usage(int c) +{ + if (c == 0) + warnx("Missing/unknown command"); + else + warnx("Unknown option `%c'", (char)c); + fprintf(stderr, "Usage: %s dump [-abdnrw]\n", getprogname()); + exit(EXIT_FAILURE); +} + +static const char * +star(char *buf, size_t len, int val) +{ + if (val == -1) + return "*"; + snprintf(buf, len, "%d", val); + return buf; +} + +int +main(int argc, char *argv[]) +{ + const char *dbname = _PATH_BLSTATE; + DB *db; + struct conf c; + struct dbinfo dbi; + unsigned int i; + struct timespec ts; + int all, blocked, remain, wide, noheader; + int o; + + noheader = wide = blocked = all = remain = 0; + lfun = dlog; + + if (argc == 1 || strcmp(argv[1], "dump") != 0) + usage(0); + + argc--; + argv++; + + while ((o = getopt(argc, argv, "abD:dnrw")) != -1) + switch (o) { + case 'a': + all = 1; + blocked = 0; + break; + case 'b': + blocked = 1; + break; + case 'D': + dbname = optarg; + break; + case 'd': + debug++; + break; + case 'n': + noheader = 1; + break; + case 'r': + remain = 1; + break; + case 'w': + wide = 1; + break; + default: + usage(o); + break; + } + + db = state_open(dbname, O_RDONLY, 0); + if (db == NULL) + err(EXIT_FAILURE, "Can't open `%s'", dbname); + + clock_gettime(CLOCK_REALTIME, &ts); + wide = wide ? 8 * 4 + 7 : 4 * 3 + 3; + if (!noheader) + printf("%*.*s/ma:port\tid\tnfail\t%s\n", wide, wide, + "address", remain ? "remaining time" : "last access"); + for (i = 1; state_iterate(db, &c, &dbi, i) != 0; i = 0) { + char buf[BUFSIZ]; + char mbuf[64], pbuf[64]; + if (!all) { + if (blocked) { + if (c.c_nfail == -1 || dbi.count < c.c_nfail) + continue; + } else { + if (dbi.count >= c.c_nfail) + continue; + } + } + sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&c.c_ss); + printf("%*.*s/%s:%s\t", wide, wide, buf, + star(mbuf, sizeof(mbuf), c.c_lmask), + star(pbuf, sizeof(pbuf), c.c_port)); + if (c.c_duration == -1) { + strlcpy(buf, "never", sizeof(buf)); + } else { + if (remain) + fmtydhms(buf, sizeof(buf), + c.c_duration - (ts.tv_sec - dbi.last)); + else + fmttime(buf, sizeof(buf), dbi.last); + } + printf("%s\t%d/%s\t%-s\n", dbi.id, dbi.count, + star(mbuf, sizeof(mbuf), c.c_nfail), buf); + } + state_close(db); + return EXIT_SUCCESS; +} Copied: vendor/NetBSD/blacklist/20191106/bin/blacklistd.c (from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/blacklist/20191106/bin/blacklistd.c Wed Nov 6 14:10:50 2019 (r354389, copy of r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.c) @@ -0,0 +1,568 @@ +/* $NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $ */ + +/*- + * Copyright (c) 2015 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +__RCSID("$NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $"); + +#include +#include +#include + +#ifdef HAVE_LIBUTIL_H +#include +#endif +#ifdef HAVE_UTIL_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bl.h" +#include "internal.h" +#include "conf.h" +#include "run.h" +#include "state.h" +#include "support.h" + +static const char *configfile = _PATH_BLCONF; +static DB *state; +static const char *dbfile = _PATH_BLSTATE; +static sig_atomic_t readconf; +static sig_atomic_t done; +static int vflag; + +static void +sigusr1(int n __unused) +{ + debug++; +} + +static void +sigusr2(int n __unused) +{ + debug--; +} + +static void +sighup(int n __unused) +{ + readconf++; +} + +static void +sigdone(int n __unused) +{ + done++; +} + +static __dead void +usage(int c) +{ + if (c) + warnx("Unknown option `%c'", (char)c); + fprintf(stderr, "Usage: %s [-vdfr] [-c ] [-R ] " + "[-P ] [-C ] [-D ] " + "[-s ] [-t ]\n", getprogname()); + exit(EXIT_FAILURE); +} + +static int +getremoteaddress(bl_info_t *bi, struct sockaddr_storage *rss, socklen_t *rsl) +{ + *rsl = sizeof(*rss); + memset(rss, 0, *rsl); + + if (getpeername(bi->bi_fd, (void *)rss, rsl) != -1) + return 0; + + if (errno != ENOTCONN) { + (*lfun)(LOG_ERR, "getpeername failed (%m)"); + return -1; + } + + if (bi->bi_slen == 0) { + (*lfun)(LOG_ERR, "unconnected socket with no peer in message"); + return -1; + } + + switch (bi->bi_ss.ss_family) { + case AF_INET: + *rsl = sizeof(struct sockaddr_in); + break; + case AF_INET6: + *rsl = sizeof(struct sockaddr_in6); + break; + default: + (*lfun)(LOG_ERR, "bad client passed socket family %u", + (unsigned)bi->bi_ss.ss_family); + return -1; + } + + if (*rsl != bi->bi_slen) { + (*lfun)(LOG_ERR, "bad client passed socket length %u != %u", + (unsigned)*rsl, (unsigned)bi->bi_slen); + return -1; + } + + memcpy(rss, &bi->bi_ss, *rsl); + +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN + if (*rsl != rss->ss_len) { + (*lfun)(LOG_ERR, + "bad client passed socket internal length %u != %u", + (unsigned)*rsl, (unsigned)rss->ss_len); + return -1; + } +#endif + return 0; +} + +static void +process(bl_t bl) +{ + struct sockaddr_storage rss; + socklen_t rsl; + char rbuf[BUFSIZ]; + bl_info_t *bi; + struct conf c; + struct dbinfo dbi; + struct timespec ts; + + if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { + (*lfun)(LOG_ERR, "clock_gettime failed (%m)"); + return; + } + + if ((bi = bl_recv(bl)) == NULL) { + (*lfun)(LOG_ERR, "no message (%m)"); + return; + } + + if (getremoteaddress(bi, &rss, &rsl) == -1) + goto out; + + if (debug) { + sockaddr_snprintf(rbuf, sizeof(rbuf), "%a:%p", (void *)&rss); + (*lfun)(LOG_DEBUG, "processing type=%d fd=%d remote=%s msg=%s" + " uid=%lu gid=%lu", bi->bi_type, bi->bi_fd, rbuf, + bi->bi_msg, (unsigned long)bi->bi_uid, + (unsigned long)bi->bi_gid); + } + + if (conf_find(bi->bi_fd, bi->bi_uid, &rss, &c) == NULL) { + (*lfun)(LOG_DEBUG, "no rule matched"); + goto out; + } + + + if (state_get(state, &c, &dbi) == -1) + goto out; + + if (debug) { + char b1[128], b2[128]; + (*lfun)(LOG_DEBUG, "%s: initial db state for %s: count=%d/%d " + "last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail, + fmttime(b1, sizeof(b1), dbi.last), + fmttime(b2, sizeof(b2), ts.tv_sec)); + } + + switch (bi->bi_type) { + case BL_ADD: + dbi.count++; + dbi.last = ts.tv_sec; + if (dbi.id[0]) { + /* + * We should not be getting this since the rule + * should have blocked the address. A possible + * explanation is that someone removed that rule, + * and another would be that we got another attempt + * before we added the rule. In anycase, we remove + * and re-add the rule because we don't want to add + * it twice, because then we'd lose track of it. + */ + (*lfun)(LOG_DEBUG, "rule exists %s", dbi.id); + (void)run_change("rem", &c, dbi.id, 0); + dbi.id[0] = '\0'; + } + if (c.c_nfail != -1 && dbi.count >= c.c_nfail) { + int res = run_change("add", &c, dbi.id, sizeof(dbi.id)); + if (res == -1) + goto out; + sockaddr_snprintf(rbuf, sizeof(rbuf), "%a", + (void *)&rss); + (*lfun)(LOG_INFO, + "blocked %s/%d:%d for %d seconds", + rbuf, c.c_lmask, c.c_port, c.c_duration); + + } + break; + case BL_DELETE: + if (dbi.last == 0) + goto out; + dbi.count = 0; + dbi.last = 0; + break; + default: + (*lfun)(LOG_ERR, "unknown message %d", bi->bi_type); + } + state_put(state, &c, &dbi); + +out: + close(bi->bi_fd); + + if (debug) { + char b1[128], b2[128]; + (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d " + "last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail, + fmttime(b1, sizeof(b1), dbi.last), + fmttime(b2, sizeof(b2), ts.tv_sec)); + } +} + +static void +update_interfaces(void) +{ + struct ifaddrs *oifas, *nifas; + + if (getifaddrs(&nifas) == -1) + return; + + oifas = ifas; + ifas = nifas; + + if (oifas) + freeifaddrs(oifas); +} + +static void +update(void) +{ + struct timespec ts; + struct conf c; + struct dbinfo dbi; + unsigned int f, n; + char buf[128]; + void *ss = &c.c_ss; + + if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { + (*lfun)(LOG_ERR, "clock_gettime failed (%m)"); + return; + } + +again: + for (n = 0, f = 1; state_iterate(state, &c, &dbi, f) == 1; + f = 0, n++) + { + time_t when = c.c_duration + dbi.last; + if (debug > 1) { + char b1[64], b2[64]; + sockaddr_snprintf(buf, sizeof(buf), "%a:%p", ss); + (*lfun)(LOG_DEBUG, "%s:[%u] %s count=%d duration=%d " + "last=%s " "now=%s", __func__, n, buf, dbi.count, + c.c_duration, fmttime(b1, sizeof(b1), dbi.last), + fmttime(b2, sizeof(b2), ts.tv_sec)); + } + if (c.c_duration == -1 || when >= ts.tv_sec) + continue; + if (dbi.id[0]) { + run_change("rem", &c, dbi.id, 0); + sockaddr_snprintf(buf, sizeof(buf), "%a", ss); + syslog(LOG_INFO, "released %s/%d:%d after %d seconds", + buf, c.c_lmask, c.c_port, c.c_duration); + } + state_del(state, &c); + goto again; + } +} + +static void +addfd(struct pollfd **pfdp, bl_t **blp, size_t *nfd, size_t *maxfd, + const char *path) +{ + bl_t bl = bl_create(true, path, vflag ? vdlog : vsyslog); + if (bl == NULL || !bl_isconnected(bl)) + exit(EXIT_FAILURE); + if (*nfd >= *maxfd) { + *maxfd += 10; + *blp = realloc(*blp, sizeof(**blp) * *maxfd); + if (*blp == NULL) + err(EXIT_FAILURE, "malloc"); + *pfdp = realloc(*pfdp, sizeof(**pfdp) * *maxfd); + if (*pfdp == NULL) + err(EXIT_FAILURE, "malloc"); + } + + (*pfdp)[*nfd].fd = bl_getfd(bl); + (*pfdp)[*nfd].events = POLLIN; + (*blp)[*nfd] = bl; + *nfd += 1; +} + +static void +uniqueadd(struct conf ***listp, size_t *nlist, size_t *mlist, struct conf *c) +{ + struct conf **list = *listp; + + if (c->c_name[0] == '\0') + return; + for (size_t i = 0; i < *nlist; i++) { + if (strcmp(list[i]->c_name, c->c_name) == 0) + return; + } + if (*nlist == *mlist) { + *mlist += 10; + void *p = realloc(*listp, *mlist * sizeof(*list)); + if (p == NULL) + err(EXIT_FAILURE, "Can't allocate for rule list"); + list = *listp = p; + } + list[(*nlist)++] = c; +} + +static void +rules_flush(void) +{ + struct conf **list; + size_t nlist, mlist; + + list = NULL; + mlist = nlist = 0; + for (size_t i = 0; i < rconf.cs_n; i++) + uniqueadd(&list, &nlist, &mlist, &rconf.cs_c[i]); + for (size_t i = 0; i < lconf.cs_n; i++) + uniqueadd(&list, &nlist, &mlist, &lconf.cs_c[i]); + + for (size_t i = 0; i < nlist; i++) + run_flush(list[i]); + free(list); +} + +static void +rules_restore(void) +{ + struct conf c; + struct dbinfo dbi; + unsigned int f; + + for (f = 1; state_iterate(state, &c, &dbi, f) == 1; f = 0) { + if (dbi.id[0] == '\0') + continue; + (void)run_change("add", &c, dbi.id, sizeof(dbi.id)); + } +} + +int +main(int argc, char *argv[]) +{ + int c, tout, flags, flush, restore, ret; + const char *spath, **blsock; + size_t nblsock, maxblsock; + + setprogname(argv[0]); + + spath = NULL; + blsock = NULL; + maxblsock = nblsock = 0; + flush = 0; + restore = 0; + tout = 0; + flags = O_RDWR|O_EXCL|O_CLOEXEC; + while ((c = getopt(argc, argv, "C:c:D:dfP:rR:s:t:v")) != -1) { + switch (c) { + case 'C': + controlprog = optarg; + break; + case 'c': + configfile = optarg; + break; + case 'D': + dbfile = optarg; + break; + case 'd': + debug++; + break; + case 'f': + flush++; + break; + case 'P': + spath = optarg; + break; + case 'R': + rulename = optarg; + break; + case 'r': + restore++; + break; + case 's': + if (nblsock >= maxblsock) { + maxblsock += 10; + void *p = realloc(blsock, + sizeof(*blsock) * maxblsock); + if (p == NULL) + err(EXIT_FAILURE, + "Can't allocate memory for %zu sockets", + maxblsock); + blsock = p; + } + blsock[nblsock++] = optarg; + break; + case 't': + tout = atoi(optarg) * 1000; + break; + case 'v': + vflag++; + break; + default: + usage(c); + } + } + + argc -= optind; + if (argc) + usage(0); + + signal(SIGHUP, sighup); + signal(SIGINT, sigdone); + signal(SIGQUIT, sigdone); + signal(SIGTERM, sigdone); + signal(SIGUSR1, sigusr1); + signal(SIGUSR2, sigusr2); + + openlog(getprogname(), LOG_PID, LOG_DAEMON); + + if (debug) { + lfun = dlog; + if (tout == 0) + tout = 5000; + } else { + if (tout == 0) + tout = 15000; + } + + update_interfaces(); + conf_parse(configfile); + if (flush) { + rules_flush(); + if (!restore) + flags |= O_TRUNC; + } + + struct pollfd *pfd = NULL; + bl_t *bl = NULL; + size_t nfd = 0; + size_t maxfd = 0; + + for (size_t i = 0; i < nblsock; i++) + addfd(&pfd, &bl, &nfd, &maxfd, blsock[i]); + free(blsock); + + if (spath) { + FILE *fp = fopen(spath, "r"); + char *line; + if (fp == NULL) + err(EXIT_FAILURE, "Can't open `%s'", spath); + for (; (line = fparseln(fp, NULL, NULL, NULL, 0)) != NULL; + free(line)) + addfd(&pfd, &bl, &nfd, &maxfd, line); + fclose(fp); + } + if (nfd == 0) + addfd(&pfd, &bl, &nfd, &maxfd, _PATH_BLSOCK); + + state = state_open(dbfile, flags, 0600); + if (state == NULL) + state = state_open(dbfile, flags | O_CREAT, 0600); + if (state == NULL) + return EXIT_FAILURE; + + if (restore) { + if (!flush) + rules_flush(); + rules_restore(); + } + + if (!debug) { + if (daemon(0, 0) == -1) + err(EXIT_FAILURE, "daemon failed"); + if (pidfile(NULL) == -1) + err(EXIT_FAILURE, "Can't create pidfile"); + } + + for (size_t t = 0; !done; t++) { + if (readconf) { + readconf = 0; + conf_parse(configfile); + } + ret = poll(pfd, (nfds_t)nfd, tout); + if (debug) + (*lfun)(LOG_DEBUG, "received %d from poll()", ret); + switch (ret) { + case -1: + if (errno == EINTR) + continue; + (*lfun)(LOG_ERR, "poll (%m)"); + return EXIT_FAILURE; + case 0: + state_sync(state); + break; + default: + for (size_t i = 0; i < nfd; i++) + if (pfd[i].revents & POLLIN) + process(bl[i]); + } + if (t % 100 == 0) + state_sync(state); + if (t % 10000 == 0) + update_interfaces(); + update(); + } + state_close(state); + return 0; +} Copied: vendor/NetBSD/blacklist/20191106/bin/blacklistd.conf.5 (from r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/blacklist/20191106/bin/blacklistd.conf.5 Wed Nov 6 14:10:50 2019 (r354389, copy of r354388, vendor/NetBSD/blacklist/dist/bin/blacklistd.conf.5) @@ -0,0 +1,229 @@ +.\" $NetBSD: blacklistd.conf.5,v 1.7 2017/06/07 13:50:57 wiz Exp $ +.\" +.\" Copyright (c) 2015 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Christos Zoulas. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 5, 2017 +.Dt BLACKLISTD.CONF 5 +.Os +.Sh NAME +.Nm blacklistd.conf +.Nd configuration file format for blacklistd +.Sh DESCRIPTION +The +.Nm +files contains configuration entries for +.Xr blacklistd 8 +in a fashion similar to +.Xr inetd.conf 5 . +Only one entry per line is permitted. +Every entry must have all fields populated. +Each field can be separated by a tab or a space. +Comments are denoted by a +.Dq # +at the beginning of a line. +.Pp +There are two kinds of configuration lines, +.Va local +and +.Va remote . +By default, configuration lines are +.Va local , +i.e. the address specified refers to the addresses on the local machine. +To switch to between +.Va local +and +.Va remote +configuration lines you can specify the stanzas: +.Dq [local] +and +.Dq [remote] . +.Pp +On +.Va local +and +.Va remote +lines +.Dq * +means use the default, or wildcard match. +In addition, for +.Va remote +lines +.Dq = +means use the values from the matched +.Va local +configuration line. +.Pp +The first four fields, +.Va location , +.Va type , +.Va proto , +and +.Va owner +are used to match the +.Va local +or +.Va remote +addresses, whereas the last 3 fields +.Va name , +.Va nfail , +and +.Va disable +are used to modify the filtering action. +.Pp +The first field denotes the +.Va location +as an address, mask, and port. +The syntax for the +.Va location +is: +.Bd -literal -offset indent + [
|][/][:] +.Ed +.Pp +The +.Dv address +can be an IPv4 address in numeric format, an IPv6 address +in numeric format and enclosed by square brackets, or an interface name. +Mask modifiers are not allowed on interfaces because interfaces +can have multiple addresses in different protocols where the mask has a different +size. +.Pp +The +.Dv mask +is always numeric, but the +.Dv port +can be either numeric or symbolic. +.Pp +The second field is the socket +.Va type : +.Dv stream , +.Dv dgram , +or numeric. +The third field is the +.Va prococol : +.Dv tcp , +.Dv udp , +.Dv tcp6 , +.Dv udp6 , +or numeric. +The fourth file is the effective user +.Va ( owner ) +of the daemon process reporting the event, +either as a username or a userid. +.Pp +The rest of the fields are controlling the behavior of the filter. +.Pp +The +.Va name +field, is the name of the packet filter rule to be used. +If the +.Va name +starts with a +.Dq - , +then the default rulename is prepended to the given name. +If the +.Dv name +contains a +.Dq / , +the remaining portion of the name is interpreted as the mask to be +applied to the address specified in the rule, causing a single rule violation to +block the entire subnet for the configured prefix. +.Pp +The +.Va nfail +field contains the number of failed attempts before access is blocked, +defaulting to +.Dq * +meaning never, and the last field +.Va disable +specifies the amount of time since the last access that the blocking +rule should be active, defaulting to +.Dq * +meaning forever. +The default unit for +.Va disable +is seconds, but one can specify suffixes for different units, such as +.Dq m +for minutes +.Dq h +for hours and +.Dq d +for days. +.Pp +Matching is done first by checking the +.Va local +rules individually, in the order of the most specific to the least specific. +If a match is found, then the +.Va remote +rules are applied. +The +.Va name , +.Va nfail , +and +.Va disable +fields can be altered by the +.Va remote +rule that matched. +.Pp +The +.Va remote +rules can be used for whitelisting specific addresses, changing the mask +size, the rule that the packet filter uses, the number of failed attempts, +or the block duration. +.Sh FILES +.Bl -tag -width /etc/blacklistd.conf -compact +.It Pa /etc/blacklistd.conf +Configuration file. +.El +.Sh EXAMPLES +.Bd -literal -offset 8n +# Block ssh, after 3 attempts for 6 hours on the bnx0 interface +[local] +# location type proto owner name nfail duration +bnx0:ssh * * * * 3 6h +[remote] +# Never block 1.2.3.4 +1.2.3.4:ssh * * * * * * +# For addresses coming from 8.8.0.0/16 block class C networks instead +# individual hosts, but keep the rest of the blocking parameters the same. +8.8.0.0/16:ssh * * * /24 = = +.Ed +.Sh SEE ALSO +.Xr blacklistctl 8 , +.Xr blacklistd 8 +.Sh HISTORY +.Nm +first appeared in +.Nx 7 . +.Fx +support for +.Nm +was implemented in +.Fx 11 . +.Sh AUTHORS +.An Christos Zoulas Copied: vendor/NetBSD/blacklist/20191106/bin/support.c (from r354388, vendor/NetBSD/blacklist/dist/bin/support.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/blacklist/20191106/bin/support.c Wed Nov 6 14:10:50 2019 (r354389, copy of r354388, vendor/NetBSD/blacklist/dist/bin/support.c) @@ -0,0 +1,161 @@ +/* $NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $ */ + +/*- + * Copyright (c) 2015 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 14:30:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CD4C1B752B; Wed, 6 Nov 2019 14:30:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477TV91sN6z4BFh; Wed, 6 Nov 2019 14:30:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 235712658D; Wed, 6 Nov 2019 14:30:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EUvH9053476; Wed, 6 Nov 2019 14:30:57 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EUunq053474; Wed, 6 Nov 2019 14:30:56 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911061430.xA6EUunq053474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 6 Nov 2019 14:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354390 - in head/tests/sys/netinet6: . frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/tests/sys/netinet6: . frag6 X-SVN-Commit-Revision: 354390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:30:57 -0000 Author: bz Date: Wed Nov 6 14:30:56 2019 New Revision: 354390 URL: https://svnweb.freebsd.org/changeset/base/354390 Log: ipv6 tests: cleanup Remove mentions of fragmentation tests from extension header test. Remove setting an MTU > IF_MAXMTU from the test cases to avoid warnings; this was only possible in a local research tree. MFC after: 2 weeks Sponsored by: Netflix Modified: head/tests/sys/netinet6/exthdr.sh head/tests/sys/netinet6/frag6/frag6.subr Modified: head/tests/sys/netinet6/exthdr.sh ============================================================================== --- head/tests/sys/netinet6/exthdr.sh Wed Nov 6 14:10:50 2019 (r354389) +++ head/tests/sys/netinet6/exthdr.sh Wed Nov 6 14:30:56 2019 (r354390) @@ -31,7 +31,7 @@ atf_test_case "exthdr" "cleanup" exthdr_head() { - atf_set descr 'Test IPv6 fragmentation code' + atf_set descr 'Test IPv6 extension header code paths' atf_set require.user root atf_set require.progs scapy } @@ -59,12 +59,12 @@ exthdr_body() { ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}" epair=$(vnet_mkepair) - ifconfig ${epair}a mtu 131071 up + ifconfig ${epair}a up ifconfig ${epair}a inet6 ${ip6a}/64 jname="v6t-${id}-${yl}-${xl}" vnet_mkjail ${jname} ${epair}b - jexec ${jname} ifconfig ${epair}b mtu 131071 up + jexec ${jname} ifconfig ${epair}b up jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 # Let IPv6 ND do its thing. @@ -75,7 +75,7 @@ exthdr_body() { # Clear statistics. jexec ${jname} netstat -z -s > /dev/null - # Run fragment tests. + # Run extension header tests. pyname=$(atf_get ident) pyname=${pyname%*_[0-9]} Modified: head/tests/sys/netinet6/frag6/frag6.subr ============================================================================== --- head/tests/sys/netinet6/frag6/frag6.subr Wed Nov 6 14:10:50 2019 (r354389) +++ head/tests/sys/netinet6/frag6/frag6.subr Wed Nov 6 14:30:56 2019 (r354390) @@ -54,12 +54,12 @@ frag6_body() ip6b="2001:db8:6666:6666:${yl}:${id}:2:${xl}" epair=$(vnet_mkepair) - ifconfig ${epair}a mtu 131071 up + ifconfig ${epair}a up ifconfig ${epair}a inet6 ${ip6a}/64 jname="v6t-${id}-${yl}-${xl}" vnet_mkjail ${jname} ${epair}b - jexec ${jname} ifconfig ${epair}b mtu 131071 up + jexec ${jname} ifconfig ${epair}b up jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 # Let IPv6 ND do its thing. From owner-svn-src-all@freebsd.org Wed Nov 6 14:32:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C77841B75F1; Wed, 6 Nov 2019 14:32:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477TWN4xcMz4BdK; Wed, 6 Nov 2019 14:32:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CEAA266EC; Wed, 6 Nov 2019 14:32:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EW0AT054986; Wed, 6 Nov 2019 14:32:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EW07V054985; Wed, 6 Nov 2019 14:32:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911061432.xA6EW07V054985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Nov 2019 14:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354391 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 354391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:32:00 -0000 Author: imp Date: Wed Nov 6 14:32:00 2019 New Revision: 354391 URL: https://svnweb.freebsd.org/changeset/base/354391 Log: Change current to stable/12. Direct commit because this change isn't relevant to -current Reported by: Jamie Landeg-Jones Modified: stable/12/UPDATING Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Wed Nov 6 14:30:56 2019 (r354390) +++ stable/12/UPDATING Wed Nov 6 14:32:00 2019 (r354391) @@ -1,4 +1,4 @@ - Updating Information for FreeBSD current users. + Updating Information for FreeBSD stable/12 users. This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the From owner-svn-src-all@freebsd.org Wed Nov 6 14:33:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 594E21B77C4; Wed, 6 Nov 2019 14:33:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477TXr1ctYz4BnC; Wed, 6 Nov 2019 14:33:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AF612671B; Wed, 6 Nov 2019 14:33:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EXFr8058504; Wed, 6 Nov 2019 14:33:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EXFt5058503; Wed, 6 Nov 2019 14:33:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911061433.xA6EXFt5058503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Nov 2019 14:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354392 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 354392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:33:16 -0000 Author: imp Date: Wed Nov 6 14:33:15 2019 New Revision: 354392 URL: https://svnweb.freebsd.org/changeset/base/354392 Log: Update to indicate this is for stable/11, not current. Direct commit because it's not relevant to any other branch. Reported by: Jamie Landeg-Jones Modified: stable/11/UPDATING Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Wed Nov 6 14:32:00 2019 (r354391) +++ stable/11/UPDATING Wed Nov 6 14:33:15 2019 (r354392) @@ -1,4 +1,4 @@ -Updating Information for FreeBSD current users. +Updating Information for FreeBSD stable/11 users. This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the From owner-svn-src-all@freebsd.org Wed Nov 6 14:34:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A1C11B783E; Wed, 6 Nov 2019 14:34:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477TYz378Hz4Bvw; Wed, 6 Nov 2019 14:34:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E7EC2671C; Wed, 6 Nov 2019 14:34:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EYFTm058594; Wed, 6 Nov 2019 14:34:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EYFBF058593; Wed, 6 Nov 2019 14:34:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911061434.xA6EYFBF058593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Nov 2019 14:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r354393 - stable/10 X-SVN-Group: stable-10 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/10 X-SVN-Commit-Revision: 354393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:34:15 -0000 Author: imp Date: Wed Nov 6 14:34:14 2019 New Revision: 354393 URL: https://svnweb.freebsd.org/changeset/base/354393 Log: Replace current with stable/10 Direct commit because not relevant to other branches Reported by: Jamie Landeg-Jones Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Wed Nov 6 14:33:15 2019 (r354392) +++ stable/10/UPDATING Wed Nov 6 14:34:14 2019 (r354393) @@ -1,4 +1,4 @@ -Updating Information for FreeBSD current users +Updating Information for FreeBSD stable/10 users This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the From owner-svn-src-all@freebsd.org Wed Nov 6 14:41:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE7071B7B63; Wed, 6 Nov 2019 14:41:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Tjw4SM4z4CCg; Wed, 6 Nov 2019 14:41:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C38C2675C; Wed, 6 Nov 2019 14:41:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Ef8gh059698; Wed, 6 Nov 2019 14:41:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Ef7gs059694; Wed, 6 Nov 2019 14:41:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911061441.xA6Ef7gs059694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 6 Nov 2019 14:41:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354394 - in stable/12/sys: sys vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: sys vm X-SVN-Commit-Revision: 354394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:41:08 -0000 Author: kib Date: Wed Nov 6 14:41:07 2019 New Revision: 354394 URL: https://svnweb.freebsd.org/changeset/base/354394 Log: MFC r353890: Add VV_VMSIZEVNLOCK flag. MFC note: OBJ_SIZEVNLOCK value was changed due to differences between stable/12 and HEAD. Modified: stable/12/sys/sys/vnode.h stable/12/sys/vm/vm_fault.c stable/12/sys/vm/vm_object.h stable/12/sys/vm/vnode_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/vnode.h ============================================================================== --- stable/12/sys/sys/vnode.h Wed Nov 6 14:34:14 2019 (r354393) +++ stable/12/sys/sys/vnode.h Wed Nov 6 14:41:07 2019 (r354394) @@ -246,6 +246,7 @@ struct xvnode { #define VV_NOSYNC 0x0004 /* unlinked, stop syncing */ #define VV_ETERNALDEV 0x0008 /* device that is never destroyed */ #define VV_CACHEDLABEL 0x0010 /* Vnode has valid cached MAC label */ +#define VV_VMSIZEVNLOCK 0x0020 /* object size check requires vnode lock */ #define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ #define VV_SYSTEM 0x0080 /* vnode being used by kernel */ #define VV_PROCDEP 0x0100 /* vnode is process dependent */ Modified: stable/12/sys/vm/vm_fault.c ============================================================================== --- stable/12/sys/vm/vm_fault.c Wed Nov 6 14:34:14 2019 (r354393) +++ stable/12/sys/vm/vm_fault.c Wed Nov 6 14:41:07 2019 (r354394) @@ -896,6 +896,13 @@ RetryFault_oom: */ if (fs.object->type != OBJT_DEFAULT || fs.object == fs.first_object) { + if ((fs.object->flags & OBJ_SIZEVNLOCK) != 0) { + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; + } if (fs.pindex >= fs.object->size) { unlock_and_deallocate(&fs); return (KERN_OUT_OF_BOUNDS); Modified: stable/12/sys/vm/vm_object.h ============================================================================== --- stable/12/sys/vm/vm_object.h Wed Nov 6 14:34:14 2019 (r354393) +++ stable/12/sys/vm/vm_object.h Wed Nov 6 14:41:07 2019 (r354394) @@ -189,6 +189,7 @@ struct vm_object { #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ #define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */ +#define OBJ_SIZEVNLOCK 0x0800 /* lock vnode to check obj size */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */ Modified: stable/12/sys/vm/vnode_pager.c ============================================================================== --- stable/12/sys/vm/vnode_pager.c Wed Nov 6 14:34:14 2019 (r354393) +++ stable/12/sys/vm/vnode_pager.c Wed Nov 6 14:41:07 2019 (r354394) @@ -256,8 +256,12 @@ retry: object->un_pager.vnp.vnp_size = size; object->un_pager.vnp.writemappings = 0; object->domain.dr_policy = vnode_domainset; - object->handle = handle; + if ((vp->v_vflag & VV_VMSIZEVNLOCK) != 0) { + VM_OBJECT_WLOCK(object); + vm_object_set_flag(object, OBJ_SIZEVNLOCK); + VM_OBJECT_WUNLOCK(object); + } VI_LOCK(vp); if (vp->v_object != NULL) { /* From owner-svn-src-all@freebsd.org Wed Nov 6 14:43:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 703B71B7C05; Wed, 6 Nov 2019 14:43:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Tmm2KY4z4CX9; Wed, 6 Nov 2019 14:43:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33C11268D9; Wed, 6 Nov 2019 14:43:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Ehawf064668; Wed, 6 Nov 2019 14:43:36 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EhZZ5064665; Wed, 6 Nov 2019 14:43:35 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911061443.xA6EhZZ5064665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 6 Nov 2019 14:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354395 - head/tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6 X-SVN-Commit-Revision: 354395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:43:36 -0000 Author: bz Date: Wed Nov 6 14:43:35 2019 New Revision: 354395 URL: https://svnweb.freebsd.org/changeset/base/354395 Log: IPv6 tests: test case for scapy bpf parsing bug PR: 239380 Reported by: lwhsu, CI system MFC after: 3 weeks Sponsored by: Netflix Added: head/tests/sys/netinet6/scapyi386.py (contents, props changed) head/tests/sys/netinet6/scapyi386.sh (contents, props changed) Modified: head/tests/sys/netinet6/Makefile Modified: head/tests/sys/netinet6/Makefile ============================================================================== --- head/tests/sys/netinet6/Makefile Wed Nov 6 14:41:07 2019 (r354394) +++ head/tests/sys/netinet6/Makefile Wed Nov 6 14:43:35 2019 (r354395) @@ -6,11 +6,14 @@ TESTSDIR= ${TESTSBASE}/sys/netinet6 FILESDIR= ${TESTSDIR} ATF_TESTS_SH= \ - exthdr + exthdr \ + scapyi386 ${PACKAGE}FILES+= exthdr.py +${PACKAGE}FILES+= scapyi386.py ${PACKAGE}FILESMODE_exthdr.py= 0555 +${PACKAGE}FILESMODE_scapyi386.py=0555 TESTS_SUBDIRS+= frag6 Added: head/tests/sys/netinet6/scapyi386.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/scapyi386.py Wed Nov 6 14:43:35 2019 (r354395) @@ -0,0 +1,85 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys + +def main(): + parser = argparse.ArgumentParser("scapyi386.py", + description="IPv6 Ethernet Dest MAC test") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + ######################################################################## + # + # A test case to check that IPv6 packets are sent with a proper + # (resolved) Ethernet Destination MAC address instead of the BCAST one. + # This was needed as test cases did not work properly on i386 due to a + # scapy BPF parsing bug. (See PR 239380 and duplicates). + # + bcmac = sp.Ether(dst="ff:ff:ff:ff:ff:ff").dst + data = "6" * 88 + pkt = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + sp.sendp(pkt, iface=args.sendif[0], verbose=False) + + eth = pkt.getlayer(sp.Ether) + if eth is None: + print("No Ether in packet") + pkt.display() + sys.exit(1) + if eth.dst == bcmac: + print("Broadcast dMAC on packet") + eth.display() + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/scapyi386.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/scapyi386.sh Wed Nov 6 14:43:35 2019 (r354395) @@ -0,0 +1,94 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# 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. +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "scapyi386" "cleanup" +scapyi386_head() { + + atf_set descr 'Test for correct Ethernet Destination MAC address' + atf_set require.user root + atf_set require.progs scapy +} + +scapyi386_body() { + + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "i386" ]; then + atf_skip "https://bugs.freebsd.org/239380" + fi + + ids=65533 + id=`printf "%x" ${ids}` + if [ $$ -gt 65535 ]; then + xl=`printf "%x" $(($$ - 65535))` + yl="1" + else + xl=`printf "%x" $$` + yl="" + fi + + vnet_init + + ip6a="2001:db8:6666:0000:${yl}:${id}:1:${xl}" + ip6b="2001:db8:6666:0000:${yl}:${id}:2:${xl}" + + epair=$(vnet_mkepair) + ifconfig ${epair}a up + ifconfig ${epair}a inet6 ${ip6a}/64 + + jname="v6t-${id}-${yl}-${xl}" + vnet_mkjail ${jname} ${epair}b + jexec ${jname} ifconfig ${epair}b up + jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 + + # Let IPv6 ND do its thing. + #ping6 -q -c 1 ff02::1%${epair}a + #ping6 -q -c 1 ${ip6b} + sleep 3 + + pyname=$(atf_get ident) + pyname=${pyname%*_[0-9]} + + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a --recvif ${epair}a \ + --src ${ip6a} --to ${ip6b} +} + +scapyi386_cleanup() { + + vnet_cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case "scapyi386" +} + +# end From owner-svn-src-all@freebsd.org Wed Nov 6 14:55:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C8911B7FEC; Wed, 6 Nov 2019 14:55:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477V2Q1mf1z4DBj; Wed, 6 Nov 2019 14:55:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FDC126AE6; Wed, 6 Nov 2019 14:55:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EtQK5070539; Wed, 6 Nov 2019 14:55:26 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EtOba070533; Wed, 6 Nov 2019 14:55:24 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911061455.xA6EtOba070533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 6 Nov 2019 14:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354396 - in head/sys: arm/allwinner arm64/rockchip dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner arm64/rockchip dev/extres/regulator X-SVN-Commit-Revision: 354396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:55:26 -0000 Author: manu Date: Wed Nov 6 14:55:24 2019 New Revision: 354396 URL: https://svnweb.freebsd.org/changeset/base/354396 Log: regulator: Add regulator_check_voltage function This function will call the regnode_check_voltage method for a given regulator and check if the desired voltage in reachable by it. Also adds a default method that check the std_param and which should be enough for most regulators and add it as the method for axp* rk805 and fixed regulators. Reviewed by: mmel MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22260 Modified: head/sys/arm/allwinner/axp209.c head/sys/arm/allwinner/axp81x.c head/sys/arm64/rockchip/rk805.c head/sys/dev/extres/regulator/regnode_if.m head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/regulator/regulator.h head/sys/dev/extres/regulator/regulator_fixed.c Modified: head/sys/arm/allwinner/axp209.c ============================================================================== --- head/sys/arm/allwinner/axp209.c Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/arm/allwinner/axp209.c Wed Nov 6 14:55:24 2019 (r354396) @@ -753,6 +753,7 @@ static regnode_method_t axp2xx_regnode_methods[] = { REGNODEMETHOD(regnode_enable, axp2xx_regnode_enable), REGNODEMETHOD(regnode_set_voltage, axp2xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp2xx_regnode_get_voltage), + REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), REGNODEMETHOD_END }; DEFINE_CLASS_1(axp2xx_regnode, axp2xx_regnode_class, axp2xx_regnode_methods, Modified: head/sys/arm/allwinner/axp81x.c ============================================================================== --- head/sys/arm/allwinner/axp81x.c Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/arm/allwinner/axp81x.c Wed Nov 6 14:55:24 2019 (r354396) @@ -866,6 +866,7 @@ static regnode_method_t axp8xx_regnode_methods[] = { REGNODEMETHOD(regnode_enable, axp8xx_regnode_enable), REGNODEMETHOD(regnode_set_voltage, axp8xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp8xx_regnode_get_voltage), + REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), REGNODEMETHOD_END }; DEFINE_CLASS_1(axp8xx_regnode, axp8xx_regnode_class, axp8xx_regnode_methods, Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/arm64/rockchip/rk805.c Wed Nov 6 14:55:24 2019 (r354396) @@ -362,6 +362,7 @@ static regnode_method_t rk805_regnode_methods[] = { REGNODEMETHOD(regnode_enable, rk805_regnode_enable), REGNODEMETHOD(regnode_set_voltage, rk805_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, rk805_regnode_get_voltage), + REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), REGNODEMETHOD_END }; DEFINE_CLASS_1(rk805_regnode, rk805_regnode_class, rk805_regnode_methods, Modified: head/sys/dev/extres/regulator/regnode_if.m ============================================================================== --- head/sys/dev/extres/regulator/regnode_if.m Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/dev/extres/regulator/regnode_if.m Wed Nov 6 14:55:24 2019 (r354396) @@ -91,6 +91,15 @@ METHOD int get_voltage { }; # +# Check if a given voltage is supported by the regulator +# Returns 0 on success or a standard errno value. +# +METHOD int check_voltage { + struct regnode *regnode; + int uvolt; +}; + +# # Stop (shutdown) regulator # Returns 0 on success or a standard errno value. # Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/dev/extres/regulator/regulator.c Wed Nov 6 14:55:24 2019 (r354396) @@ -84,6 +84,7 @@ static regnode_method_t regnode_methods[] = { REGNODEMETHOD(regnode_status, regnode_method_status), REGNODEMETHOD(regnode_set_voltage, regnode_method_set_voltage), REGNODEMETHOD(regnode_get_voltage, regnode_method_get_voltage), + REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), REGNODEMETHOD_END }; @@ -278,6 +279,16 @@ regnode_method_get_voltage(struct regnode *regnode, in (regnode->std_param.max_uvolt - regnode->std_param.min_uvolt) / 2); } +int +regnode_method_check_voltage(struct regnode *regnode, int uvolt) +{ + + if ((uvolt > regnode->std_param.max_uvolt) || + (uvolt < regnode->std_param.min_uvolt)) + return (ERANGE); + return (0); +} + /* ---------------------------------------------------------------------------- * * Internal functions. @@ -991,6 +1002,22 @@ regulator_set_voltage(regulator_t reg, int min_uvolt, reg->min_uvolt = min_uvolt; reg->max_uvolt = max_uvolt; } + REG_TOPO_UNLOCK(); + return (rv); +} + +int +regulator_check_voltage(regulator_t reg, int uvolt) +{ + int rv; + struct regnode *regnode; + + regnode = reg->regnode; + KASSERT(regnode->ref_cnt > 0, + ("Attempt to access unreferenced regulator: %s\n", regnode->name)); + + REG_TOPO_SLOCK(); + rv = REGNODE_CHECK_VOLTAGE(regnode, uvolt); REG_TOPO_UNLOCK(); return (rv); } Modified: head/sys/dev/extres/regulator/regulator.h ============================================================================== --- head/sys/dev/extres/regulator/regulator.h Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/dev/extres/regulator/regulator.h Wed Nov 6 14:55:24 2019 (r354396) @@ -117,6 +117,10 @@ int regnode_status(struct regnode *regnode, int *statu int regnode_get_voltage(struct regnode *regnode, int *uvolt); int regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt); int regnode_set_constraint(struct regnode *regnode); + +/* Standard method that aren't default */ +int regnode_method_check_voltage(struct regnode *regnode, int uvolt); + #ifdef FDT phandle_t regnode_get_ofw_node(struct regnode *regnode); #endif @@ -134,6 +138,7 @@ int regulator_stop(regulator_t reg); int regulator_status(regulator_t reg, int *status); int regulator_get_voltage(regulator_t reg, int *uvolt); int regulator_set_voltage(regulator_t reg, int min_uvolt, int max_uvolt); +int regulator_check_voltage(regulator_t reg, int uvolt); #ifdef FDT int regulator_get_by_ofw_property(device_t dev, phandle_t node, char *name, Modified: head/sys/dev/extres/regulator/regulator_fixed.c ============================================================================== --- head/sys/dev/extres/regulator/regulator_fixed.c Wed Nov 6 14:43:35 2019 (r354395) +++ head/sys/dev/extres/regulator/regulator_fixed.c Wed Nov 6 14:55:24 2019 (r354396) @@ -80,6 +80,7 @@ static regnode_method_t regnode_fixed_methods[] = { REGNODEMETHOD(regnode_enable, regnode_fixed_enable), REGNODEMETHOD(regnode_status, regnode_fixed_status), REGNODEMETHOD(regnode_stop, regnode_fixed_stop), + REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), REGNODEMETHOD_END }; DEFINE_CLASS_1(regnode_fixed, regnode_fixed_class, regnode_fixed_methods, From owner-svn-src-all@freebsd.org Wed Nov 6 14:58:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB5F71B808A; Wed, 6 Nov 2019 14:58:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477V5s5Nb7z4DMK; Wed, 6 Nov 2019 14:58:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98DED26AFB; Wed, 6 Nov 2019 14:58:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6EwPvw070703; Wed, 6 Nov 2019 14:58:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6EwPWl070702; Wed, 6 Nov 2019 14:58:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911061458.xA6EwPWl070702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 6 Nov 2019 14:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354397 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 354397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 14:58:25 -0000 Author: manu Date: Wed Nov 6 14:58:25 2019 New Revision: 354397 URL: https://svnweb.freebsd.org/changeset/base/354397 Log: arm: allwinner: aw_mmc: Check if the regulator support the voltage Don't blindy say that we support both 3.3V and 1.8V. If we have a regulator for the data lines, check that the voltage is supported before adding the signaling caps. If we don't have a regulator, just assume that the data lines are 3.3V This unbreak eMMC on some allwinner boards. Reported by: ganbold MFC after: 1 month X-MFC-With: r354396 Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Wed Nov 6 14:55:24 2019 (r354396) +++ head/sys/arm/allwinner/aw_mmc.c Wed Nov 6 14:58:25 2019 (r354397) @@ -511,7 +511,13 @@ aw_mmc_attach(device_t dev) MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 | MMC_CAP_MMC_DDR52; - sc->aw_host.caps |= MMC_CAP_SIGNALING_330 | MMC_CAP_SIGNALING_180; + if (sc->aw_reg_vqmmc != NULL) { + if (regulator_check_voltage(sc->aw_reg_vqmmc, 1800000) == 0) + sc->aw_host.caps |= MMC_CAP_SIGNALING_180; + if (regulator_check_voltage(sc->aw_reg_vqmmc, 3300000) == 0) + sc->aw_host.caps |= MMC_CAP_SIGNALING_330; + } else + sc->aw_host.caps |= MMC_CAP_SIGNALING_330; if (bus_width >= 4) sc->aw_host.caps |= MMC_CAP_4_BIT_DATA; From owner-svn-src-all@freebsd.org Wed Nov 6 15:11:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 764771B8595; Wed, 6 Nov 2019 15:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477VPP2XWJz4FKF; Wed, 6 Nov 2019 15:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A45C26E51; Wed, 6 Nov 2019 15:11:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6FBrrR078553; Wed, 6 Nov 2019 15:11:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6FBqJt078546; Wed, 6 Nov 2019 15:11:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911061511.xA6FBqJt078546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 6 Nov 2019 15:11:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354398 - in stable/12/sys/fs: nfs nfsclient X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 354398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 15:11:53 -0000 Author: kib Date: Wed Nov 6 15:11:51 2019 New Revision: 354398 URL: https://svnweb.freebsd.org/changeset/base/354398 Log: MFC r353891: Fix interface between nfsclient and vnode pager. Modified: stable/12/sys/fs/nfs/nfsport.h stable/12/sys/fs/nfsclient/nfs_clnode.c stable/12/sys/fs/nfsclient/nfs_clport.c stable/12/sys/fs/nfsclient/nfs_clsubs.c stable/12/sys/fs/nfsclient/nfs_clvnops.c stable/12/sys/fs/nfsclient/nfsnode.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfs/nfsport.h ============================================================================== --- stable/12/sys/fs/nfs/nfsport.h Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfs/nfsport.h Wed Nov 6 15:11:51 2019 (r354398) @@ -880,6 +880,7 @@ MALLOC_DECLARE(M_NEWNFSDSESSION); int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); int newnfs_realign(struct mbuf **, int); +bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); /* * If the port runs on an SMP box that can enforce Atomic ops with low Modified: stable/12/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clnode.c Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfsclient/nfs_clnode.c Wed Nov 6 15:11:51 2019 (r354398) @@ -162,6 +162,8 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); Modified: stable/12/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clport.c Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfsclient/nfs_clport.c Wed Nov 6 15:11:51 2019 (r354398) @@ -246,6 +246,8 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = nfhp; /* @@ -414,10 +416,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; - vm_object_t object; - u_quad_t nsize; int error, force_fid_err; - bool setnsize; error = 0; @@ -565,27 +564,53 @@ out: if (np->n_attrstamp != 0) KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error); #endif + (void)ncl_pager_setsize(vp, NULL); + return (error); +} + +/* + * Call vnode_pager_setsize() if the size of the node changed, as + * recorded in nfsnode vs. v_object, or delay the call if notifying + * the pager is not possible at the moment. + * + * If nsizep is non-NULL, the call is delayed and the new node size is + * provided. Caller should itself call vnode_pager_setsize() if + * function returned true. If nsizep is NULL, function tries to call + * vnode_pager_setsize() itself if needed and possible, and the nfs + * node is unlocked unconditionally, the return value is not useful. + */ +bool +ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep) +{ + struct nfsnode *np; + vm_object_t object; + struct vattr *vap; + u_quad_t nsize; + bool setnsize; + + np = VTONFS(vp); + NFSASSERTNODE(np); + + vap = &np->n_vattr.na_vattr; nsize = vap->va_size; object = vp->v_object; setnsize = false; - if (object != NULL) { - if (OFF_TO_IDX(nsize + PAGE_MASK) < object->size) { - /* - * When shrinking the size, the call to - * vnode_pager_setsize() cannot be done with - * the mutex held, because we might need to - * wait for a busy page. Delay it until after - * the node is unlocked. - */ + + if (object != NULL && nsize != object->un_pager.vnp.vnp_size) { + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) setnsize = true; - } else { + else + np->n_flag |= NVNSETSZSKIP; + } + if (nsizep == NULL) { + NFSUNLOCKNODE(np); + if (setnsize) vnode_pager_setsize(vp, nsize); - } + setnsize = false; + } else { + *nsizep = nsize; } - NFSUNLOCKNODE(np); - if (setnsize) - vnode_pager_setsize(vp, nsize); - return (error); + return (setnsize); } /* Modified: stable/12/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clsubs.c Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfsclient/nfs_clsubs.c Wed Nov 6 15:11:51 2019 (r354398) @@ -185,6 +185,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper struct vattr *vap; struct nfsmount *nmp; int timeo, mustflush; + u_quad_t nsize; + bool setnsize; np = VTONFS(vp); vap = &np->n_vattr.na_vattr; @@ -230,6 +232,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper return( ENOENT); } nfsstatsv1.attrcache_hits++; + setnsize = false; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (np->n_flag & NMODIFIED) { @@ -240,7 +243,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper } else { np->n_size = vap->va_size; } - vnode_pager_setsize(vp, np->n_size); + setnsize = ncl_pager_setsize(vp, &nsize); } else { np->n_size = vap->va_size; } @@ -253,6 +256,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper vaper->va_mtime = np->n_mtim; } NFSUNLOCKNODE(np); + if (setnsize) + vnode_pager_setsize(vp, nsize); KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap); return (0); } Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clvnops.c Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfsclient/nfs_clvnops.c Wed Nov 6 15:11:51 2019 (r354398) @@ -142,6 +142,7 @@ static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; +static vop_lock1_t nfs_lock; /* * Global vfs data structures for nfs @@ -159,6 +160,7 @@ struct vop_vector newnfs_vnodeops = { .vop_putpages = ncl_putpages, .vop_inactive = ncl_inactive, .vop_link = nfs_link, + .vop_lock1 = nfs_lock, .vop_lookup = nfs_lookup, .vop_mkdir = nfs_mkdir, .vop_mknod = nfs_mknod, @@ -269,6 +271,73 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap rep->r_mtx * rep->r_mtx : Protects the fields in an nfsreq. */ + +static int +nfs_lock(struct vop_lock1_args *ap) +{ + struct vnode *vp; + struct nfsnode *np; + u_quad_t nsize; + int error, lktype; + bool onfault; + + vp = ap->a_vp; + lktype = ap->a_flags & LK_TYPE_MASK; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + np = VTONFS(vp); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && + lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE && + lktype != LK_TRYUPGRADE)) { + NFSUNLOCKNODE(np); + return (0); + } + onfault = (ap->a_flags & LK_EATTR_MASK) == LK_NOWAIT && + (ap->a_flags & LK_INIT_MASK) == LK_CANRECURSE && + (lktype == LK_SHARED || lktype == LK_EXCLUSIVE); + if (onfault && vp->v_vnlock->lk_recurse == 0) { + /* + * Force retry in vm_fault(), to make the lock request + * sleepable, which allows us to piggy-back the + * sleepable call to vnode_pager_setsize(). + */ + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + return (EBUSY); + } + if ((ap->a_flags & LK_NOWAIT) != 0 || + (lktype == LK_SHARED && vp->v_vnlock->lk_recurse > 0)) { + NFSUNLOCKNODE(np); + return (0); + } + if (lktype == LK_SHARED) { + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_EXCLUSIVE; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0) { + NFSUNLOCKNODE(np); + goto downgrade; + } + } + np->n_flag &= ~NVNSETSZSKIP; + nsize = np->n_size; + NFSUNLOCKNODE(np); + vnode_pager_setsize(vp, nsize); +downgrade: + if (lktype == LK_SHARED) { + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_DOWNGRADE; + (void)VOP_LOCK1_APV(&default_vnodeops, ap); + } + return (0); +} static int nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td, Modified: stable/12/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/12/sys/fs/nfsclient/nfsnode.h Wed Nov 6 14:58:25 2019 (r354397) +++ stable/12/sys/fs/nfsclient/nfsnode.h Wed Nov 6 15:11:51 2019 (r354398) @@ -163,6 +163,7 @@ struct nfsnode { #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ #define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ +#define NVNSETSZSKIP 0x00200000 /* Skipped vnode_pager_setsize() */ /* * Convert between nfsnode pointers and vnode pointers From owner-svn-src-all@freebsd.org Wed Nov 6 16:21:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A1911B9D6B; Wed, 6 Nov 2019 16:21:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Wxs4Mr3z4JYl; Wed, 6 Nov 2019 16:21:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 790D127B1C; Wed, 6 Nov 2019 16:21:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6GLbjk022373; Wed, 6 Nov 2019 16:21:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6GLaAL021014; Wed, 6 Nov 2019 16:21:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061621.xA6GLaAL021014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 16:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354399 - in head/contrib/blacklist: bin diff lib X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/contrib/blacklist: bin diff lib X-SVN-Commit-Revision: 354399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 16:21:37 -0000 Author: emaste Date: Wed Nov 6 16:21:35 2019 New Revision: 354399 URL: https://svnweb.freebsd.org/changeset/base/354399 Log: blacklist: update to NetBSD snapshot on 20191106 Cursory review: cem MFC after: 3 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22259 Modified: head/contrib/blacklist/bin/blacklistctl.c head/contrib/blacklist/bin/blacklistd.c head/contrib/blacklist/bin/blacklistd.conf.5 head/contrib/blacklist/bin/support.c head/contrib/blacklist/diff/ssh.diff head/contrib/blacklist/lib/Makefile head/contrib/blacklist/lib/libblacklist.3 Directory Properties: head/contrib/blacklist/ (props changed) Modified: head/contrib/blacklist/bin/blacklistctl.c ============================================================================== --- head/contrib/blacklist/bin/blacklistctl.c Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/bin/blacklistctl.c Wed Nov 6 16:21:35 2019 (r354399) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $ */ +/* $NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $"); +__RCSID("$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $"); #include #include @@ -67,6 +67,15 @@ usage(int c) exit(EXIT_FAILURE); } +static const char * +star(char *buf, size_t len, int val) +{ + if (val == -1) + return "*"; + snprintf(buf, len, "%d", val); + return buf; +} + int main(int argc, char *argv[]) { @@ -128,9 +137,10 @@ main(int argc, char *argv[]) "address", remain ? "remaining time" : "last access"); for (i = 1; state_iterate(db, &c, &dbi, i) != 0; i = 0) { char buf[BUFSIZ]; + char mbuf[64], pbuf[64]; if (!all) { if (blocked) { - if (dbi.count < c.c_nfail) + if (c.c_nfail == -1 || dbi.count < c.c_nfail) continue; } else { if (dbi.count >= c.c_nfail) @@ -138,13 +148,20 @@ main(int argc, char *argv[]) } } sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&c.c_ss); - printf("%*.*s/%d:%d\t", wide, wide, buf, c.c_lmask, c.c_port); - if (remain) - fmtydhms(buf, sizeof(buf), - c.c_duration - (ts.tv_sec - dbi.last)); - else - fmttime(buf, sizeof(buf), dbi.last); - printf("%s\t%d/%d\t%-s\n", dbi.id, dbi.count, c.c_nfail, buf); + printf("%*.*s/%s:%s\t", wide, wide, buf, + star(mbuf, sizeof(mbuf), c.c_lmask), + star(pbuf, sizeof(pbuf), c.c_port)); + if (c.c_duration == -1) { + strlcpy(buf, "never", sizeof(buf)); + } else { + if (remain) + fmtydhms(buf, sizeof(buf), + c.c_duration - (ts.tv_sec - dbi.last)); + else + fmttime(buf, sizeof(buf), dbi.last); + } + printf("%s\t%d/%s\t%-s\n", dbi.id, dbi.count, + star(mbuf, sizeof(mbuf), c.c_nfail), buf); } state_close(db); return EXIT_SUCCESS; Modified: head/contrib/blacklist/bin/blacklistd.c ============================================================================== --- head/contrib/blacklist/bin/blacklistd.c Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/bin/blacklistd.c Wed Nov 6 16:21:35 2019 (r354399) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $ */ +/* $NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "config.h" #endif #include -__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $"); +__RCSID("$NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $"); #include #include @@ -408,7 +408,6 @@ rules_restore(void) for (f = 1; state_iterate(state, &c, &dbi, f) == 1; f = 0) { if (dbi.id[0] == '\0') continue; - (void)run_change("rem", &c, dbi.id, 0); (void)run_change("add", &c, dbi.id, sizeof(dbi.id)); } } @@ -505,7 +504,8 @@ main(int argc, char *argv[]) conf_parse(configfile); if (flush) { rules_flush(); - flags |= O_TRUNC; + if (!restore) + flags |= O_TRUNC; } struct pollfd *pfd = NULL; @@ -536,8 +536,11 @@ main(int argc, char *argv[]) if (state == NULL) return EXIT_FAILURE; - if (restore) + if (restore) { + if (!flush) + rules_flush(); rules_restore(); + } if (!debug) { if (daemon(0, 0) == -1) Modified: head/contrib/blacklist/bin/blacklistd.conf.5 ============================================================================== --- head/contrib/blacklist/bin/blacklistd.conf.5 Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/bin/blacklistd.conf.5 Wed Nov 6 16:21:35 2019 (r354399) @@ -1,4 +1,4 @@ -.\" $NetBSD: blacklistd.conf.5,v 1.5 2016/06/08 12:48:37 wiz Exp $ +.\" $NetBSD: blacklistd.conf.5,v 1.7 2017/06/07 13:50:57 wiz Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 7, 2016 +.Dd June 5, 2017 .Dt BLACKLISTD.CONF 5 .Os .Sh NAME @@ -36,12 +36,13 @@ .Sh DESCRIPTION The .Nm -files contains configuration lines for -.Xr blacklistd 8 . -It contains one entry per line, and is similar to +files contains configuration entries for +.Xr blacklistd 8 +in a fashion similar to .Xr inetd.conf 5 . -There must be an entry for each field of the configuration file, with -entries for each field separated by a tab or a space. +Only one entry per line is permitted. +Every entry must have all fields populated. +Each field can be separated by a tab or a space. Comments are denoted by a .Dq # at the beginning of a line. @@ -109,7 +110,7 @@ The can be an IPv4 address in numeric format, an IPv6 address in numeric format and enclosed by square brackets, or an interface name. Mask modifiers are not allowed on interfaces because interfaces -have multiple address in different protocols where the mask has a different +can have multiple addresses in different protocols where the mask has a different size. .Pp The @@ -150,8 +151,8 @@ If the contains a .Dq / , the remaining portion of the name is interpreted as the mask to be -applied to the address specified in the rule, so one can block whole -subnets for a single rule violation. +applied to the address specified in the rule, causing a single rule violation to +block the entire subnet for the configured prefix. .Pp The .Va nfail @@ -176,10 +177,11 @@ for days. .Pp Matching is done first by checking the .Va local -rules one by one, from the most specific to the least specific. +rules individually, in the order of the most specific to the least specific. If a match is found, then the .Va remote -rules are applied, and if a match is found the +rules are applied. +The .Va name , .Va nfail , and @@ -191,15 +193,15 @@ rule that matched. The .Va remote rules can be used for whitelisting specific addresses, changing the mask -size, or the rule that the packet filter uses, the number of failed attempts, -or the blocked duration. +size, the rule that the packet filter uses, the number of failed attempts, +or the block duration. .Sh FILES .Bl -tag -width /etc/blacklistd.conf -compact .It Pa /etc/blacklistd.conf Configuration file. .El .Sh EXAMPLES -.Bd -literal -offset +.Bd -literal -offset 8n # Block ssh, after 3 attempts for 6 hours on the bnx0 interface [local] # location type proto owner name nfail duration Modified: head/contrib/blacklist/bin/support.c ============================================================================== --- head/contrib/blacklist/bin/support.c Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/bin/support.c Wed Nov 6 16:21:35 2019 (r354399) @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.8 2016/04/04 15:52:56 christos Exp $ */ +/* $NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: support.c,v 1.8 2016/04/04 15:52:56 christos Exp $"); +__RCSID("$NetBSD: support.c,v 1.9 2018/09/18 22:12:19 christos Exp $"); #include #include @@ -105,12 +105,16 @@ fmtydhms(char *b, size_t l, time_t t) s = t % 60; t /= 60; + m = t % 60; t /= 60; - h = t % 60; + + h = t % 24; t /= 24; - d = t % 24; - t /= 356; + + d = t % 365; + t /= 365; + y = t; z = 0; Modified: head/contrib/blacklist/diff/ssh.diff ============================================================================== --- head/contrib/blacklist/diff/ssh.diff Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/diff/ssh.diff Wed Nov 6 16:21:35 2019 (r354399) @@ -1,6 +1,6 @@ --- /dev/null 2015-01-22 23:10:33.000000000 -0500 +++ dist/pfilter.c 2015-01-22 23:46:03.000000000 -0500 -@@ -0,0 +1,28 @@ +@@ -0,0 +1,32 @@ +#include "namespace.h" +#include "includes.h" +#include "ssh.h" @@ -28,6 +28,10 @@ + // XXX: 3? + fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3; + (void)blacklist_r(blstate, a, fd, "ssh"); ++ if (a == 0) { ++ blacklist_close(blstate); ++ blstate = NULL; ++ } +} --- /dev/null 2015-01-20 21:14:44.000000000 -0500 +++ dist/pfilter.h 2015-01-20 20:16:20.000000000 -0500 @@ -58,174 +62,89 @@ diff -u -u -r1.10 Makefile + +LDADD+= -lblacklist +DPADD+= ${LIBBLACKLIST} -Index: dist/auth.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth.c,v -retrieving revision 1.10 -diff -u -u -r1.10 auth.c ---- dist/auth.c 19 Oct 2014 16:30:58 -0000 1.10 -+++ dist/auth.c 22 Jan 2015 21:39:22 -0000 -@@ -62,6 +62,7 @@ - #include "monitor_wrap.h" - #include "krl.h" - #include "compat.h" -+#include "pfilter.h" - - #ifdef HAVE_LOGIN_CAP - #include -@@ -362,6 +363,8 @@ - compat20 ? "ssh2" : "ssh1", - authctxt->info != NULL ? ": " : "", - authctxt->info != NULL ? authctxt->info : ""); -+ if (!authctxt->postponed) -+ pfilter_notify(!authenticated); - free(authctxt->info); - authctxt->info = NULL; - } -Index: dist/sshd.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v -retrieving revision 1.15 -diff -u -u -r1.15 sshd.c ---- dist/sshd.c 28 Oct 2014 21:36:16 -0000 1.15 -+++ dist/sshd.c 22 Jan 2015 21:39:22 -0000 -@@ -109,6 +109,7 @@ - #include "roaming.h" - #include "ssh-sandbox.h" - #include "version.h" -+#include "pfilter.h" - - #ifdef LIBWRAP - #include -@@ -364,6 +365,7 @@ - killpg(0, SIGTERM); - } - -+ pfilter_notify(1); - /* Log error and exit. */ - sigdie("Timeout before authentication for %s", get_remote_ipaddr()); - } -@@ -1160,6 +1162,7 @@ - for (i = 0; i < options.max_startups; i++) - startup_pipes[i] = -1; - -+ pfilter_init(); - /* - * Stay listening for connections until the system crashes or - * the daemon is killed with a signal. -Index: auth1.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth1.c,v -retrieving revision 1.9 -diff -u -u -r1.9 auth1.c ---- auth1.c 19 Oct 2014 16:30:58 -0000 1.9 -+++ auth1.c 14 Feb 2015 15:40:51 -0000 -@@ -41,6 +41,7 @@ +diff -ru openssh-7.7p1/auth-pam.c dist/auth-pam.c +--- openssh-7.7p1/auth-pam.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/auth-pam.c 2018-05-23 11:56:22.206661484 -0400 +@@ -103,6 +103,7 @@ + #include "ssh-gss.h" #endif #include "monitor_wrap.h" - #include "buffer.h" +#include "pfilter.h" - /* import */ extern ServerOptions options; -@@ -445,6 +446,7 @@ - else { - debug("do_authentication: invalid user %s", user); - authctxt->pw = fakepw(); -+ pfilter_notify(1); - } + extern Buffer loginmsg; +@@ -526,6 +527,7 @@ + ssh_msg_send(ctxt->pam_csock, PAM_MAXTRIES, &buffer); + else + ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); ++ pfilter_notify(1); + buffer_free(&buffer); + pthread_exit(NULL); - /* Configuration may have changed as a result of Match */ -Index: auth2.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth2.c,v -retrieving revision 1.9 -diff -u -u -r1.9 auth2.c ---- auth2.c 19 Oct 2014 16:30:58 -0000 1.9 -+++ auth2.c 14 Feb 2015 15:40:51 -0000 -@@ -52,6 +52,7 @@ +@@ -804,6 +806,7 @@ + free(msg); + return (0); + } ++ pfilter_notify(1); + error("PAM: %s for %s%.100s from %.100s", msg, + sshpam_authctxt->valid ? "" : "illegal user ", + sshpam_authctxt->user, +diff -ru openssh-7.7p1/auth2.c dist/auth2.c +--- openssh-7.7p1/auth2.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/auth2.c 2018-05-23 11:57:31.022197317 -0400 +@@ -51,6 +51,7 @@ + #include "dispatch.h" #include "pathnames.h" #include "buffer.h" - #include "canohost.h" +#include "pfilter.h" #ifdef GSSAPI #include "ssh-gss.h" -@@ -256,6 +257,7 @@ +@@ -242,6 +243,7 @@ } else { - logit("input_userauth_request: invalid user %s", user); + /* Invalid user, fake password information */ authctxt->pw = fakepw(); + pfilter_notify(1); - } - #ifdef USE_PAM - if (options.use_pam) -Index: sshd.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/sshd.c,v -retrieving revision 1.16 -diff -u -r1.16 sshd.c ---- sshd.c 25 Jan 2015 15:52:44 -0000 1.16 -+++ sshd.c 14 Feb 2015 09:55:06 -0000 -@@ -628,6 +628,8 @@ - explicit_bzero(pw->pw_passwd, strlen(pw->pw_passwd)); - endpwent(); - -+ pfilter_init(); -+ - /* Change our root directory */ - if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) - fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR, - -Index: auth-pam.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth-pam.c,v -retrieving revision 1.7 -diff -u -u -r1.7 auth-pam.c ---- auth-pam.c 3 Jul 2015 00:59:59 -0000 1.7 -+++ auth-pam.c 23 Jan 2016 00:01:16 -0000 -@@ -114,6 +114,7 @@ - #include "ssh-gss.h" + #ifdef SSH_AUDIT_EVENTS + PRIVSEP(audit_event(SSH_INVALID_USER)); #endif - #include "monitor_wrap.h" +Only in dist: pfilter.c +Only in dist: pfilter.h +diff -ru openssh-7.7p1/sshd.c dist/sshd.c +--- openssh-7.7p1/sshd.c 2018-04-02 01:38:28.000000000 -0400 ++++ dist/sshd.c 2018-05-23 11:59:39.573197347 -0400 +@@ -122,6 +122,7 @@ + #include "auth-options.h" + #include "version.h" + #include "ssherr.h" +#include "pfilter.h" - extern ServerOptions options; - extern Buffer loginmsg; -@@ -809,6 +810,7 @@ - free(msg); - return (0); - } -+ pfilter_notify(1); - error("PAM: %s for %s%.100s from %.100s", msg, - sshpam_authctxt->valid ? "" : "illegal user ", - sshpam_authctxt->user, -Index: auth.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth.c,v -retrieving revision 1.15 -diff -u -u -r1.15 auth.c ---- auth.c 21 Aug 2015 08:20:59 -0000 1.15 -+++ auth.c 23 Jan 2016 00:01:16 -0000 -@@ -656,6 +656,7 @@ + /* Re-exec fds */ + #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) +@@ -346,6 +347,7 @@ + static void + grace_alarm_handler(int sig) + { ++ pfilter_notify(1); + if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0) + kill(pmonitor->m_pid, SIGALRM); - pw = getpwnam(user); - if (pw == NULL) { -+ pfilter_notify(1); - logit("Invalid user %.100s from %.100s", - user, get_remote_ipaddr()); - return (NULL); -Index: auth1.c -=================================================================== -RCS file: /cvsroot/src/crypto/external/bsd/openssh/dist/auth1.c,v -retrieving revision 1.12 -diff -u -u -r1.12 auth1.c ---- auth1.c 3 Jul 2015 00:59:59 -0000 1.12 -+++ auth1.c 23 Jan 2016 00:01:16 -0000 -@@ -376,6 +376,7 @@ - char *msg; - size_t len; +@@ -1835,6 +1837,8 @@ + if (test_flag) + exit(0); -+ pfilter_notify(1); - error("Access denied for user %s by PAM account " - "configuration", authctxt->user); - len = buffer_len(&loginmsg); ++ pfilter_init(); ++ + /* + * Clear out any supplemental groups we may have inherited. This + * prevents inadvertent creation of files with bad modes (in the +@@ -2280,6 +2284,9 @@ + { + struct ssh *ssh = active_state; /* XXX */ + ++ if (i == 255) ++ pfilter_notify(1); ++ + if (the_authctxt) { + do_cleanup(ssh, the_authctxt); + if (use_privsep && privsep_is_preauth && Modified: head/contrib/blacklist/lib/Makefile ============================================================================== --- head/contrib/blacklist/lib/Makefile Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/lib/Makefile Wed Nov 6 16:21:35 2019 (r354399) @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.6 2016/01/05 13:07:46 christos Exp $ +# $NetBSD: Makefile,v 1.7 2019/03/08 20:40:05 christos Exp $ .include USE_SHLIBDIR= yes CPPFLAGS+=-D_REENTRANT -LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread +#LIBDPLIBS+=pthread ${NETBSDSRCDIR}/lib/libpthread LIB=blacklist SRCS=bl.c blacklist.c MAN=libblacklist.3 Modified: head/contrib/blacklist/lib/libblacklist.3 ============================================================================== --- head/contrib/blacklist/lib/libblacklist.3 Wed Nov 6 15:11:51 2019 (r354398) +++ head/contrib/blacklist/lib/libblacklist.3 Wed Nov 6 16:21:35 2019 (r354399) @@ -1,4 +1,4 @@ -.\" $NetBSD: libblacklist.3,v 1.7 2017/02/04 23:33:56 wiz Exp $ +.\" $NetBSD: libblacklist.3,v 1.8 2017/10/22 10:31:57 abhinav Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nm blacklist_close , .Nm blacklist_r , .Nm blacklist , -.Nm blacklist_sa +.Nm blacklist_sa , .Nm blacklist_sa_r .Nd Blacklistd notification library .Sh LIBRARY From owner-svn-src-all@freebsd.org Wed Nov 6 16:59:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F1B31BA744; Wed, 6 Nov 2019 16:59:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477XnK3VwKz4Lgn; Wed, 6 Nov 2019 16:59:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42AEF137; Wed, 6 Nov 2019 16:59:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6GxHHq048101; Wed, 6 Nov 2019 16:59:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6GxGwe048100; Wed, 6 Nov 2019 16:59:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911061659.xA6GxGwe048100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 6 Nov 2019 16:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354400 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 16:59:17 -0000 Author: markj Date: Wed Nov 6 16:59:16 2019 New Revision: 354400 URL: https://svnweb.freebsd.org/changeset/base/354400 Log: Fix a race in release_page(). Since r354156 we may call release_page() without the page's object lock held, specifically following the page copy during a CoW fault. release_page() must therefore unbusy the page only after scheduling the requeue, to avoid racing with a free of the page. Previously, the object lock prevented this race from occurring. Add some assertions that were helpful in tracking this down. Reported by: pho, syzkaller Tested by: pho Reviewed by: alc, jeff, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22234 Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_page.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Nov 6 16:21:35 2019 (r354399) +++ head/sys/vm/vm_fault.c Wed Nov 6 16:59:16 2019 (r354400) @@ -155,10 +155,14 @@ release_page(struct faultstate *fs) { if (fs->m != NULL) { - vm_page_xunbusy(fs->m); + /* + * fs->m's object lock might not be held, so the page must be + * kept busy until we are done with it. + */ vm_page_lock(fs->m); vm_page_deactivate(fs->m); vm_page_unlock(fs->m); + vm_page_xunbusy(fs->m); fs->m = NULL; } } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Nov 6 16:21:35 2019 (r354399) +++ head/sys/vm/vm_page.c Wed Nov 6 16:59:16 2019 (r354400) @@ -3421,7 +3421,7 @@ vm_page_dequeue(vm_page_t m) struct vm_pagequeue *pq, *pq1; uint8_t aflags; - KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL, + KASSERT(mtx_owned(vm_page_lockptr(m)) || m->ref_count == 0, ("page %p is allocated and unlocked", m)); for (pq = vm_page_pagequeue(m);; pq = pq1) { @@ -3475,6 +3475,8 @@ vm_page_enqueue(vm_page_t m, uint8_t queue) vm_page_assert_locked(m); KASSERT(m->queue == PQ_NONE && (m->aflags & PGA_QUEUE_STATE_MASK) == 0, ("%s: page %p is already enqueued", __func__, m)); + KASSERT(m->ref_count > 0, + ("%s: page %p does not carry any references", __func__, m)); m->queue = queue; if ((m->aflags & PGA_REQUEUE) == 0) @@ -3496,6 +3498,8 @@ vm_page_requeue(vm_page_t m) vm_page_assert_locked(m); KASSERT(vm_page_queue(m) != PQ_NONE, ("%s: page %p is not logically enqueued", __func__, m)); + KASSERT(m->ref_count > 0, + ("%s: page %p does not carry any references", __func__, m)); if ((m->aflags & PGA_REQUEUE) == 0) vm_page_aflag_set(m, PGA_REQUEUE); @@ -3889,6 +3893,8 @@ vm_page_mvqueue(vm_page_t m, const uint8_t nqueue) vm_page_assert_locked(m); KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("vm_page_mvqueue: page %p is unmanaged", m)); + KASSERT(m->ref_count > 0, + ("%s: page %p does not carry any references", __func__, m)); if (vm_page_queue(m) != nqueue) { vm_page_dequeue(m); From owner-svn-src-all@freebsd.org Wed Nov 6 17:01:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5FB91BA816; Wed, 6 Nov 2019 17:01:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Xqz5tSdz4M27; Wed, 6 Nov 2019 17:01:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD40D1C1; Wed, 6 Nov 2019 17:01:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6H1ZbC051416; Wed, 6 Nov 2019 17:01:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6H1Z27051415; Wed, 6 Nov 2019 17:01:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061701.xA6H1Z27051415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 17:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354401 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 354401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:01:36 -0000 Author: emaste Date: Wed Nov 6 17:01:35 2019 New Revision: 354401 URL: https://svnweb.freebsd.org/changeset/base/354401 Log: blacklistd.conf.5: pluralization correction Submitted by: bcr in review D22259 MFC with: r354399 Modified: head/contrib/blacklist/bin/blacklistd.conf.5 Modified: head/contrib/blacklist/bin/blacklistd.conf.5 ============================================================================== --- head/contrib/blacklist/bin/blacklistd.conf.5 Wed Nov 6 16:59:16 2019 (r354400) +++ head/contrib/blacklist/bin/blacklistd.conf.5 Wed Nov 6 17:01:35 2019 (r354401) @@ -36,7 +36,7 @@ .Sh DESCRIPTION The .Nm -files contains configuration entries for +file contains configuration entries for .Xr blacklistd 8 in a fashion similar to .Xr inetd.conf 5 . From owner-svn-src-all@freebsd.org Wed Nov 6 17:03:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B93B1BAA64; Wed, 6 Nov 2019 17:03:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Xsl3ZMTz4MMV; Wed, 6 Nov 2019 17:03:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E158332; Wed, 6 Nov 2019 17:03:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6H37v6054420; Wed, 6 Nov 2019 17:03:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6H371C054419; Wed, 6 Nov 2019 17:03:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911061703.xA6H371C054419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 6 Nov 2019 17:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354402 - head/sys/dev/ksyms X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ksyms X-SVN-Commit-Revision: 354402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:03:07 -0000 Author: markj Date: Wed Nov 6 17:03:06 2019 New Revision: 354402 URL: https://svnweb.freebsd.org/changeset/base/354402 Log: Convert ksyms(4) to use an OBJT_PHYS object. The pages stored in the ksyms object are not pageable. Moreover, this obviates the need to set OBJ_NOSPLIT. Reviewed by: alc, kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22229 Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Wed Nov 6 17:01:35 2019 (r354401) +++ head/sys/dev/ksyms/ksyms.c Wed Nov 6 17:03:06 2019 (r354402) @@ -442,9 +442,8 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus ksyms_size_calc(&ts); elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz; - object = vm_object_allocate(OBJT_DEFAULT, + object = vm_object_allocate(OBJT_PHYS, OFF_TO_IDX(round_page(elfsz))); - vm_object_set_flag(object, OBJ_NOSPLIT); sc->sc_obj = object; sc->sc_objsz = elfsz; From owner-svn-src-all@freebsd.org Wed Nov 6 17:06:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2AE81BABB2; Wed, 6 Nov 2019 17:06:35 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 477Xxl3hZBz4MZR; Wed, 6 Nov 2019 17:06:34 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xA6H6OSX010909; Wed, 6 Nov 2019 09:06:24 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xA6H6OSW010908; Wed, 6 Nov 2019 09:06:24 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911061706.xA6H6OSW010908@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354393 - stable/10 In-Reply-To: <201911061434.xA6EYFBF058593@repo.freebsd.org> To: Warner Losh Date: Wed, 6 Nov 2019 09:06:24 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org, re@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 477Xxl3hZBz4MZR X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:06:35 -0000 > Author: imp > Date: Wed Nov 6 14:34:14 2019 > New Revision: 354393 > URL: https://svnweb.freebsd.org/changeset/base/354393 > > Log: > Replace current with stable/10 > > Direct commit because not relevant to other branches Glen, Would you add this to the list of RE@ things to do when a new branch is created? Thanks, Rod > > Reported by: Jamie Landeg-Jones > > Modified: > stable/10/UPDATING > > Modified: stable/10/UPDATING > ============================================================================== > --- stable/10/UPDATING Wed Nov 6 14:33:15 2019 (r354392) > +++ stable/10/UPDATING Wed Nov 6 14:34:14 2019 (r354393) > @@ -1,4 +1,4 @@ > -Updating Information for FreeBSD current users > +Updating Information for FreeBSD stable/10 users > > This file is maintained and copyrighted by M. Warner Losh . > See end of file for further details. For commonly done items, please see the > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Nov 6 17:23:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85EDA1BB0BF; Wed, 6 Nov 2019 17:23:19 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477YK32yjNz4NWM; Wed, 6 Nov 2019 17:23:19 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id B1DD815736; Wed, 6 Nov 2019 17:23:18 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Wed, 6 Nov 2019 17:23:15 +0000 From: Glen Barber To: rgrimes@freebsd.org Cc: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org, re@freebsd.org Subject: Re: svn commit: r354393 - stable/10 Message-ID: <20191106172315.GI1424@FreeBSD.org> References: <201911061434.xA6EYFBF058593@repo.freebsd.org> <201911061706.xA6H6OSW010908@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MD+Ffo4VJSI0Ass3" Content-Disposition: inline In-Reply-To: <201911061706.xA6H6OSW010908@gndrsh.dnsmgr.net> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:23:19 -0000 --MD+Ffo4VJSI0Ass3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 06, 2019 at 09:06:24AM -0800, Rodney W. Grimes wrote: > > Author: imp > > Date: Wed Nov 6 14:34:14 2019 > > New Revision: 354393 > > URL: https://svnweb.freebsd.org/changeset/base/354393 > >=20 > > Log: > > Replace current with stable/10 > > =20 > > Direct commit because not relevant to other branches >=20 > Glen, >=20 > Would you add this to the list of RE@ things to do when a > new branch is created? >=20 It is in the document already, but I still somehow missed it. Glen --MD+Ffo4VJSI0Ass3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3DAX8ACgkQAxRYpUeP 4pNUaBAAjMju8TQhMWE0LjhD8qXHCq0htuKF7jmWXWV1I0JYpolVfP6CSG1OV8BE IswDoN/x9UhrEbRV0UeedO0dTtLTOwSWKqVV3fb5iukPkXscyBAwlZaMlZB42k80 6cNKZCN6O12lIAyKz5yyX9D146ySnqkS2xxLpA5L6xGfoErmjuRZ81DD9JIPPc9F qjrd1wSymM3O8kpY1jaI+0bQVOrAX+9uxD4NrdSAbQ5lWNqz4fXfqqNjZq/GOCj7 1pAkkMtAnOoaLecivTA7UsZQq35ncj6fSE59MvE7WbfoprEz1KeGIatACAQ/Pnaq t8paCzaluaWNTJfI9HcPK2FRmuO1o4qlVQ5ji91y3VSc7ATbiitA71xm6VKnZYBn 9/lL0HLuYx8X0fhf1rY9zS1ywo+14hd9F/tYvye04hbAHqJ8jFjv9Ad6k2XKsuRS KuRDrhck2j1k4J2YH3j84VNowFWqlhLoXXfU/bLUAVo8IK4Y8ambE7yTLKvTK0x/ ZvyK5D1o3FMj0JTfMfnEqZrSIUv4rowxN4CiGuYYmPPDzFV+go49X/1Vq16gyNIT /Nuqjxk5VZ31iS9FjDW9j+0NHf/oFbFpqKuCocO5OlByXVpYqgmk06zpyaIezQan lDR7gD0Pe0/NTUx2tZhJ2nEDXRj60LE+RB7LpiQrQU/kqZMUml8= =wdfZ -----END PGP SIGNATURE----- --MD+Ffo4VJSI0Ass3-- From owner-svn-src-all@freebsd.org Wed Nov 6 17:30:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 706C41BB1ED for ; Wed, 6 Nov 2019 17:30:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477YT03M4jz4Nhx for ; Wed, 6 Nov 2019 17:30:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf31.google.com with SMTP id y18so1749415qve.2 for ; Wed, 06 Nov 2019 09:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CQCNMEzmumHCCUZdTh2+7qPBdDUYUjiKU9G/lIOytp8=; b=kbj16etG84Z5DwbQWvGsJDIH2lgLrjH0fKEEu0djF20lrXVQFpMgG3zojuqujxZbNI zNe6G6AWBwCObhqzbRsL6mTXVaQTLUoto9lOEJtOdymj9EHuHJr2g1FnkuzifH3IWF0G WoLlBD/l/2mIeeWo/sHBNXln/OOQk48qQus6GQnhcQoQ4Oym/uFCMxElWErcaT0/KZKV C6xY6n0o71SgOdrfz9hlFCjUg2QsiVtigmk6dV+G3rfsO+HXz7o7x47NuoOGY4ZWmygh TCXAnU7uDsPMwNzUkD871DoZS4MBXc/4GNoPiQ/1YBGjhIv1cvId4BOAP1PiNUg9LpeM oh7g== 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=CQCNMEzmumHCCUZdTh2+7qPBdDUYUjiKU9G/lIOytp8=; b=kouabGzohjc2WTzxVjU3QGvcpc049EnkVWtsDdfXS32H5pKiRu/kOBrTjJeJeX8z05 8EgsILSDvpf2ml9Xk2+cqljr4NQaxulxmwU73wCfyrD6qM36vY6mdOO575Xzx23aihE6 kjVc8TS34WZTgV5aew8MtKnvJQNjp3YhOWxJy18SZASdazQuLGkVdQW+qi9IivU/2juM rB23pOlh8c4U7aGBidKF8VNoGEeUvxKulA0z9G3+BLBGaNBzxR4SwTylrzScYUGNqQwj Obh35saiJHw28zWTBZdyqyBSGln3eECDcoRjTuVbdMey8ppw/jJzxFudn5i6QxItmrVn HUpg== X-Gm-Message-State: APjAAAUvaAKO8r3nuLe/DJySuGEFgveqi773okMHd+9e2HPEiPhJloZ2 POWNMYqn/kay79DKwErcARnLL0ljxx7YAYhan/rR5g== X-Google-Smtp-Source: APXvYqwXU//1cb3p9i4u4QWo8mU4Gz8orkiziC9Ul9gX8LEepgYl95uD4q6OINCpnHMmi0TeSkwDIJM7xEC3uqCxGws= X-Received: by 2002:a0c:c125:: with SMTP id f34mr3303974qvh.22.1573061405505; Wed, 06 Nov 2019 09:30:05 -0800 (PST) MIME-Version: 1.0 References: <201911061434.xA6EYFBF058593@repo.freebsd.org> <201911061706.xA6H6OSW010908@gndrsh.dnsmgr.net> <20191106172315.GI1424@FreeBSD.org> In-Reply-To: <20191106172315.GI1424@FreeBSD.org> From: Warner Losh Date: Wed, 6 Nov 2019 10:29:54 -0700 Message-ID: Subject: Re: svn commit: r354393 - stable/10 To: Glen Barber Cc: "Rodney W. Grimes" , Warner Losh , src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org, FreeBSD Release Engineering Team X-Rspamd-Queue-Id: 477YT03M4jz4Nhx X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=kbj16etG; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f31) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.88 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_SEVEN(0.00)[8]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.35), asn: 15169(-2.01), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:30:13 -0000 On Wed, Nov 6, 2019 at 10:23 AM Glen Barber wrote: > On Wed, Nov 06, 2019 at 09:06:24AM -0800, Rodney W. Grimes wrote: > > > Author: imp > > > Date: Wed Nov 6 14:34:14 2019 > > > New Revision: 354393 > > > URL: https://svnweb.freebsd.org/changeset/base/354393 > > > > > > Log: > > > Replace current with stable/10 > > > > > > Direct commit because not relevant to other branches > > > > Glen, > > > > Would you add this to the list of RE@ things to do when a > > new branch is created? > That's a great idea... Thanks Rod. It is in the document already, but I still somehow missed it. > There's a lot on this list, so that's understandable... Maybe it's something we should enshrine in a shell script? Warner From owner-svn-src-all@freebsd.org Wed Nov 6 17:49:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E80361BB8EC; Wed, 6 Nov 2019 17:49:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477YvQ6bc1z4Ppn; Wed, 6 Nov 2019 17:49:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6F72AAB; Wed, 6 Nov 2019 17:49:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6HncqE078739; Wed, 6 Nov 2019 17:49:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Hncgc078737; Wed, 6 Nov 2019 17:49:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911061749.xA6Hncgc078737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 6 Nov 2019 17:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354403 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:49:39 -0000 Author: mav Date: Wed Nov 6 17:49:38 2019 New Revision: 354403 URL: https://svnweb.freebsd.org/changeset/base/354403 Log: MFC r354241: Some more taskqueue optimizations. - Optimize enqueue for two task priority values by adding new tq_hint field, pointing to the last task inserted into the middle of the list. In case of more then two priority values it should halve average search. - Move tq_active insert/remove out of the taskqueue_run_locked loop. Instead of dirtying few shared cache lines per task introduce different mechanism to drain active tasks, based on task sequence number counter, that uses only cache lines already present in cache. Since the new mechanism does not need ordering, switch tq_active from TAILQ to LIST. - Move static and dynamic struct taskqueue fields into different cache lines. Move lock into its own cache line, so that heavy lock spinning by multiple waiting threads would not affect the running thread. - While there, correct some TQ_SLEEP() wait messages. This change fixes certain ZFS write workloads, causing huge congestion on taskqueue lock. Those workloads combine some large block writes to saturate the pool and trigger allocation throttling, which uses higher priority tasks to requeue the delayed I/Os, with many small blocks to generate deep queue of small tasks for taskqueue to sort. Sponsored by: iXsystems, Inc. Modified: stable/12/sys/kern/subr_gtaskqueue.c stable/12/sys/kern/subr_taskqueue.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/12/sys/kern/subr_gtaskqueue.c Wed Nov 6 17:03:06 2019 (r354402) +++ stable/12/sys/kern/subr_gtaskqueue.c Wed Nov 6 17:49:38 2019 (r354403) @@ -58,26 +58,26 @@ TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); TASKQGROUP_DEFINE(config, 1, 1); struct gtaskqueue_busy { - struct gtask *tb_running; - TAILQ_ENTRY(gtaskqueue_busy) tb_link; + struct gtask *tb_running; + u_int tb_seq; + LIST_ENTRY(gtaskqueue_busy) tb_link; }; -static struct gtask * const TB_DRAIN_WAITER = (struct gtask *)0x1; - typedef void (*gtaskqueue_enqueue_fn)(void *context); struct gtaskqueue { STAILQ_HEAD(, gtask) tq_queue; + LIST_HEAD(, gtaskqueue_busy) tq_active; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; gtaskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, gtaskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -116,12 +116,11 @@ gtask_dump(struct gtask *gtask) #endif static __inline int -TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct gtaskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct gtaskqueue * @@ -145,7 +144,7 @@ _gtaskqueue_create(const char *name, int mflags, } STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -168,7 +167,7 @@ gtaskqueue_terminate(struct thread **pp, struct gtaskq while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "gtq_destroy"); } } @@ -179,7 +178,7 @@ gtaskqueue_free(struct gtaskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; gtaskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_GTASKQUEUE); @@ -286,7 +285,7 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_flags & TASK_ENQUEUED) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "gtq_qdrain"); } /* @@ -297,32 +296,25 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) static void gtaskqueue_drain_tq_active(struct gtaskqueue *queue) { - struct gtaskqueue_busy tb_marker, *tb_first; + struct gtaskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return; /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "gtq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -353,40 +345,27 @@ static void gtaskqueue_run_locked(struct gtaskqueue *queue) { struct gtaskqueue_busy tb; - struct gtaskqueue_busy *tb_first; struct gtask *gtask; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * clear its TASK_ENQUEUED flag - */ - gtask = STAILQ_FIRST(&queue->tq_queue); - KASSERT(gtask != NULL, ("task is NULL")); + while ((gtask = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); gtask->ta_flags &= ~TASK_ENQUEUED; tb.tb_running = gtask; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL")); gtask->ta_func(gtask->ta_context); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(gtask); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } static int @@ -395,7 +374,7 @@ task_is_running(struct gtaskqueue *queue, struct gtask struct gtaskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == gtask) return (1); } @@ -428,7 +407,7 @@ static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask) { while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) - TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, gtask, "gtq_drain"); } void @@ -564,7 +543,7 @@ gtaskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } gtaskqueue_run_locked(tq); /* @@ -590,7 +569,7 @@ gtaskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - wakeup_one(tq); + wakeup_any(tq); } Modified: stable/12/sys/kern/subr_taskqueue.c ============================================================================== --- stable/12/sys/kern/subr_taskqueue.c Wed Nov 6 17:03:06 2019 (r354402) +++ stable/12/sys/kern/subr_taskqueue.c Wed Nov 6 17:49:38 2019 (r354403) @@ -56,24 +56,25 @@ static void taskqueue_swi_enqueue(void *); static void taskqueue_swi_giant_enqueue(void *); struct taskqueue_busy { - struct task *tb_running; - TAILQ_ENTRY(taskqueue_busy) tb_link; + struct task *tb_running; + u_int tb_seq; + LIST_ENTRY(taskqueue_busy) tb_link; }; -struct task * const TB_DRAIN_WAITER = (struct task *)0x1; - struct taskqueue { STAILQ_HEAD(, task) tq_queue; + LIST_HEAD(, taskqueue_busy) tq_active; + struct task *tq_hint; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; taskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, taskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -116,12 +117,11 @@ _timeout_task_init(struct taskqueue *queue, struct tim } static __inline int -TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct taskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct taskqueue * @@ -145,7 +145,7 @@ _taskqueue_create(const char *name, int mflags, snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue"); STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -196,7 +196,7 @@ taskqueue_terminate(struct thread **pp, struct taskque while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "tq_destroy"); } } @@ -207,7 +207,7 @@ taskqueue_free(struct taskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_TASKQUEUE); @@ -233,21 +233,30 @@ taskqueue_enqueue_locked(struct taskqueue *queue, stru } /* - * Optimise the case when all tasks have the same priority. + * Optimise cases when all tasks use small set of priorities. + * In case of only one priority we always insert at the end. + * In case of two tq_hint typically gives the insertion point. + * In case of more then two tq_hint should halve the search. */ prev = STAILQ_LAST(&queue->tq_queue, task, ta_link); if (!prev || prev->ta_priority >= task->ta_priority) { STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link); } else { - prev = NULL; - for (ins = STAILQ_FIRST(&queue->tq_queue); ins; - prev = ins, ins = STAILQ_NEXT(ins, ta_link)) + prev = queue->tq_hint; + if (prev && prev->ta_priority >= task->ta_priority) { + ins = STAILQ_NEXT(prev, ta_link); + } else { + prev = NULL; + ins = STAILQ_FIRST(&queue->tq_queue); + } + for (; ins; prev = ins, ins = STAILQ_NEXT(ins, ta_link)) if (ins->ta_priority < task->ta_priority) break; - if (prev) + if (prev) { STAILQ_INSERT_AFTER(&queue->tq_queue, prev, task, ta_link); - else + queue->tq_hint = task; + } else STAILQ_INSERT_HEAD(&queue->tq_queue, task, ta_link); } @@ -364,6 +373,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) */ TASK_INIT(&t_barrier, USHRT_MAX, taskqueue_task_nop_fn, &t_barrier); STAILQ_INSERT_TAIL(&queue->tq_queue, &t_barrier, ta_link); + queue->tq_hint = &t_barrier; t_barrier.ta_pending = 1; /* @@ -371,7 +381,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_pending != 0) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "tq_qdrain"); return (1); } @@ -383,32 +393,25 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) static int taskqueue_drain_tq_active(struct taskqueue *queue) { - struct taskqueue_busy tb_marker, *tb_first; + struct taskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return (0); /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "tq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -440,42 +443,31 @@ static void taskqueue_run_locked(struct taskqueue *queue) { struct taskqueue_busy tb; - struct taskqueue_busy *tb_first; struct task *task; int pending; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * zero its pending count. - */ - task = STAILQ_FIRST(&queue->tq_queue); - KASSERT(task != NULL, ("task is NULL")); + while ((task = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; pending = task->ta_pending; task->ta_pending = 0; tb.tb_running = task; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(task->ta_func != NULL, ("task->ta_func is NULL")); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(task); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } void @@ -493,7 +485,7 @@ task_is_running(struct taskqueue *queue, struct task * struct taskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == task) return (1); } @@ -522,8 +514,11 @@ taskqueue_cancel_locked(struct taskqueue *queue, struc u_int *pendp) { - if (task->ta_pending > 0) + if (task->ta_pending > 0) { STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; + } if (pendp != NULL) *pendp = task->ta_pending; task->ta_pending = 0; @@ -572,7 +567,7 @@ taskqueue_drain(struct taskqueue *queue, struct task * TQ_LOCK(queue); while (task->ta_pending != 0 || task_is_running(queue, task)) - TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, task, "tq_drain"); TQ_UNLOCK(queue); } @@ -778,7 +773,7 @@ taskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } taskqueue_run_locked(tq); /* From owner-svn-src-all@freebsd.org Wed Nov 6 17:59:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12CEF1BBDE3; Wed, 6 Nov 2019 17:59:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477Z6Z6nKSz4QZb; Wed, 6 Nov 2019 17:59:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3C4C8D; Wed, 6 Nov 2019 17:59:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6HxIKi085065; Wed, 6 Nov 2019 17:59:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6HxISr085064; Wed, 6 Nov 2019 17:59:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911061759.xA6HxISr085064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 6 Nov 2019 17:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354404 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 354404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 17:59:19 -0000 Author: mav Date: Wed Nov 6 17:59:18 2019 New Revision: 354404 URL: https://svnweb.freebsd.org/changeset/base/354404 Log: MFC r305368 (by markj): Micro-optimize sleepq_signal(). Lift a comparison out of the loop that finds the highest-priority thread on the queue. Modified: stable/11/sys/kern/subr_sleepqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 17:49:38 2019 (r354403) +++ stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 17:59:18 2019 (r354404) @@ -909,9 +909,9 @@ sleepq_signal(void *wchan, int flags, int pri, int que * been sleeping the longest since threads are always added to * the tail of sleep queues. */ - besttd = NULL; + besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) { - if (besttd == NULL || td->td_priority < besttd->td_priority) + if (td->td_priority < besttd->td_priority) besttd = td; } MPASS(besttd != NULL); From owner-svn-src-all@freebsd.org Wed Nov 6 18:02:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26E941BC017; Wed, 6 Nov 2019 18:02:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477ZB50FzRz4R0V; Wed, 6 Nov 2019 18:02:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E01B9E48; Wed, 6 Nov 2019 18:02:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6I2KFX089725; Wed, 6 Nov 2019 18:02:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6I2Jva089715; Wed, 6 Nov 2019 18:02:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911061802.xA6I2Jva089715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 6 Nov 2019 18:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354405 - in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 354405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 18:02:21 -0000 Author: mav Date: Wed Nov 6 18:02:18 2019 New Revision: 354405 URL: https://svnweb.freebsd.org/changeset/base/354405 Log: MFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9). wakeup_one() and underlying sleepq_signal() spend additional time trying to be fair, waking thread with highest priority, sleeping longest time. But in case of taskqueue there are many absolutely identical threads, and any fairness between them is quite pointless. It makes even worse, since round-robin wakeups not only make previous CPU affinity in scheduler quite useless, but also hide from user chance to see CPU bottlenecks, when sequential workload with one request at a time looks evenly distributed between multiple threads. This change adds new SLEEPQ_UNFAIR flag to sleepq_signal(), making it wakeup thread that went to sleep last, but no longer in context switch (to avoid immediate spinning on the thread lock). On top of that new wakeup_any() function is added, equivalent to wakeup_one(), but setting the flag. On top of that taskqueue(9) is switchied to wakeup_any() to wakeup its threads. As result, on 72-core Xeon v4 machine sequential ZFS write to 12 ZVOLs with 16KB block size spend 34% less time in wakeup_any() and descendants then it was spending in wakeup_one(), and total write throughput increased by ~10% with the same as before CPU usage. Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/sleep.9 stable/11/share/man/man9/sleepqueue.9 stable/11/sys/kern/kern_synch.c stable/11/sys/kern/subr_sleepqueue.c stable/11/sys/kern/subr_taskqueue.c stable/11/sys/sys/queue.h stable/11/sys/sys/sleepqueue.h stable/11/sys/sys/systm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/share/man/man9/Makefile Wed Nov 6 18:02:18 2019 (r354405) @@ -1648,7 +1648,8 @@ MLINKS+=sleep.9 msleep.9 \ sleep.9 tsleep.9 \ sleep.9 tsleep_sbt.9 \ sleep.9 wakeup.9 \ - sleep.9 wakeup_one.9 + sleep.9 wakeup_one.9 \ + sleep.9 wakeup_any.9 MLINKS+=sleepqueue.9 init_sleepqueues.9 \ sleepqueue.9 sleepq_abort.9 \ sleepqueue.9 sleepq_add.9 \ Modified: stable/11/share/man/man9/sleep.9 ============================================================================== --- stable/11/share/man/man9/sleep.9 Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/share/man/man9/sleep.9 Wed Nov 6 18:02:18 2019 (r354405) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2018 +.Dd June 19, 2019 .Dt SLEEP 9 .Os .Sh NAME @@ -38,7 +38,9 @@ .Nm pause_sbt , .Nm tsleep , .Nm tsleep_sbt , -.Nm wakeup +.Nm wakeup , +.Nm wakeup_one , +.Nm wakeup_any .Nd wait for events .Sh SYNOPSIS .In sys/param.h @@ -70,6 +72,8 @@ .Fn wakeup "void *chan" .Ft void .Fn wakeup_one "void *chan" +.Ft void +.Fn wakeup_any "void *chan" .Sh DESCRIPTION The functions .Fn tsleep , @@ -79,8 +83,9 @@ The functions .Fn pause_sig , .Fn pause_sbt , .Fn wakeup , +.Fn wakeup_one , and -.Fn wakeup_one +.Fn wakeup_any handle event-based thread blocking. If a thread must wait for an external event, it is put to sleep by @@ -252,9 +257,10 @@ function is a wrapper around .Fn tsleep that suspends execution of the current thread for the indicated timeout. The thread can not be awakened early by signals or calls to -.Fn wakeup +.Fn wakeup , +.Fn wakeup_one or -.Fn wakeup_one . +.Fn wakeup_any . The .Fn pause_sig function is a variant of @@ -263,8 +269,8 @@ which can be awakened early by signals. .Pp The .Fn wakeup_one -function makes the first thread in the queue that is sleeping on the -parameter +function makes the first highest priority thread in the queue that is +sleeping on the parameter .Fa chan runnable. This reduces the load when a large number of threads are sleeping on @@ -292,6 +298,16 @@ to pay particular attention to ensure that no other threads wait on the same .Fa chan . +.Pp +The +.Fn wakeup_any +function is similar to +.Fn wakeup_one , +except that it makes runnable last thread on the queue (sleeping less), +ignoring fairness. +It can be used when threads sleeping on the +.Fa chan +are known to be identical and there is no reason to be fair. .Pp If the timeout given by .Fa timo Modified: stable/11/share/man/man9/sleepqueue.9 ============================================================================== --- stable/11/share/man/man9/sleepqueue.9 Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/share/man/man9/sleepqueue.9 Wed Nov 6 18:02:18 2019 (r354405) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2014 +.Dd June 19, 2019 .Dt SLEEPQUEUE 9 .Os .Sh NAME @@ -291,7 +291,8 @@ and functions. The .Fn sleepq_signal -function awakens the highest priority thread sleeping on a wait channel while +function awakens the highest priority thread sleeping on a wait channel +(if SLEEPQ_UNFAIR flag is set, thread that went to sleep recently) while .Fn sleepq_broadcast awakens all of the threads sleeping on a wait channel. The Modified: stable/11/sys/kern/kern_synch.c ============================================================================== --- stable/11/sys/kern/kern_synch.c Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/kern/kern_synch.c Wed Nov 6 18:02:18 2019 (r354405) @@ -369,6 +369,19 @@ wakeup_one(void *ident) kick_proc0(); } +void +wakeup_any(void *ident) +{ + int wakeup_swapper; + + sleepq_lock(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR, + 0, 0); + sleepq_release(ident); + if (wakeup_swapper) + kick_proc0(); +} + static void kdb_switch(void) { Modified: stable/11/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 18:02:18 2019 (r354405) @@ -119,7 +119,7 @@ __FBSDID("$FreeBSD$"); * c - sleep queue chain lock */ struct sleepqueue { - TAILQ_HEAD(, thread) sq_blocked[NR_SLEEPQS]; /* (c) Blocked threads. */ + struct threadqueue sq_blocked[NR_SLEEPQS]; /* (c) Blocked threads. */ u_int sq_blockedcnt[NR_SLEEPQS]; /* (c) N. of blocked threads. */ LIST_ENTRY(sleepqueue) sq_hash; /* (c) Chain and free list. */ LIST_HEAD(, sleepqueue) sq_free; /* (c) Free queues. */ @@ -885,12 +885,14 @@ sleepq_init(void *mem, int size, int flags) } /* - * Find the highest priority thread sleeping on a wait channel and resume it. + * Find thread sleeping on a wait channel and resume it. */ int sleepq_signal(void *wchan, int flags, int pri, int queue) { + struct sleepqueue_chain *sc; struct sleepqueue *sq; + struct threadqueue *head; struct thread *td, *besttd; int wakeup_swapper; @@ -903,16 +905,33 @@ sleepq_signal(void *wchan, int flags, int pri, int que KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); - /* - * Find the highest priority thread on the queue. If there is a - * tie, use the thread that first appears in the queue as it has - * been sleeping the longest since threads are always added to - * the tail of sleep queues. - */ - besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); - TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) { - if (td->td_priority < besttd->td_priority) + head = &sq->sq_blocked[queue]; + if (flags & SLEEPQ_UNFAIR) { + /* + * Find the most recently sleeping thread, but try to + * skip threads still in process of context switch to + * avoid spinning on the thread lock. + */ + sc = SC_LOOKUP(wchan); + besttd = TAILQ_LAST_FAST(head, thread, td_slpq); + while (besttd->td_lock != &sc->sc_lock) { + td = TAILQ_PREV_FAST(besttd, head, thread, td_slpq); + if (td == NULL) + break; besttd = td; + } + } else { + /* + * Find the highest priority thread on the queue. If there + * is a tie, use the thread that first appears in the queue + * as it has been sleeping the longest since threads are + * always added to the tail of sleep queues. + */ + besttd = td = TAILQ_FIRST(head); + while ((td = TAILQ_NEXT(td, td_slpq)) != NULL) { + if (td->td_priority < besttd->td_priority) + besttd = td; + } } MPASS(besttd != NULL); thread_lock(besttd); Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/kern/subr_taskqueue.c Wed Nov 6 18:02:18 2019 (r354405) @@ -802,7 +802,7 @@ taskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - wakeup_one(tq); + wakeup_any(tq); } TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, NULL, Modified: stable/11/sys/sys/queue.h ============================================================================== --- stable/11/sys/sys/queue.h Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/sys/queue.h Wed Nov 6 18:02:18 2019 (r354405) @@ -760,6 +760,10 @@ struct { \ #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) +#define TAILQ_PREV_FAST(elm, head, type, field) \ + ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \ + __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next)) + #define TAILQ_REMOVE(head, elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ Modified: stable/11/sys/sys/sleepqueue.h ============================================================================== --- stable/11/sys/sys/sleepqueue.h Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/sys/sleepqueue.h Wed Nov 6 18:02:18 2019 (r354405) @@ -83,6 +83,7 @@ struct thread; #define SLEEPQ_SX 0x03 /* Used by an sx lock. */ #define SLEEPQ_LK 0x04 /* Used by a lockmgr. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ +#define SLEEPQ_UNFAIR 0x200 /* Unfair wakeup order. */ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); Modified: stable/11/sys/sys/systm.h ============================================================================== --- stable/11/sys/sys/systm.h Wed Nov 6 17:59:18 2019 (r354404) +++ stable/11/sys/sys/systm.h Wed Nov 6 18:02:18 2019 (r354405) @@ -422,6 +422,7 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) void wakeup(void * chan); void wakeup_one(void * chan); +void wakeup_any(void * chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning From owner-svn-src-all@freebsd.org Wed Nov 6 18:15:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF9211BC668; Wed, 6 Nov 2019 18:15:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477ZT45RtLz4SG0; Wed, 6 Nov 2019 18:15:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E20C1076; Wed, 6 Nov 2019 18:15:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6IFKZh001023; Wed, 6 Nov 2019 18:15:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6IFKER001021; Wed, 6 Nov 2019 18:15:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911061815.xA6IFKER001021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 6 Nov 2019 18:15:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354406 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 354406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 18:15:20 -0000 Author: mav Date: Wed Nov 6 18:15:20 2019 New Revision: 354406 URL: https://svnweb.freebsd.org/changeset/base/354406 Log: MFC r354241: Some more taskqueue optimizations. - Optimize enqueue for two task priority values by adding new tq_hint field, pointing to the last task inserted into the middle of the list. In case of more then two priority values it should halve average search. - Move tq_active insert/remove out of the taskqueue_run_locked loop. Instead of dirtying few shared cache lines per task introduce different mechanism to drain active tasks, based on task sequence number counter, that uses only cache lines already present in cache. Since the new mechanism does not need ordering, switch tq_active from TAILQ to LIST. - Move static and dynamic struct taskqueue fields into different cache lines. Move lock into its own cache line, so that heavy lock spinning by multiple waiting threads would not affect the running thread. - While there, correct some TQ_SLEEP() wait messages. This change fixes certain ZFS write workloads, causing huge congestion on taskqueue lock. Those workloads combine some large block writes to saturate the pool and trigger allocation throttling, which uses higher priority tasks to requeue the delayed I/Os, with many small blocks to generate deep queue of small tasks for taskqueue to sort. Sponsored by: iXsystems, Inc. Modified: stable/11/sys/kern/subr_gtaskqueue.c stable/11/sys/kern/subr_taskqueue.c Modified: stable/11/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/11/sys/kern/subr_gtaskqueue.c Wed Nov 6 18:02:18 2019 (r354405) +++ stable/11/sys/kern/subr_gtaskqueue.c Wed Nov 6 18:15:20 2019 (r354406) @@ -55,24 +55,24 @@ static void gtaskqueue_thread_loop(void *arg); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); struct gtaskqueue_busy { - struct gtask *tb_running; - TAILQ_ENTRY(gtaskqueue_busy) tb_link; + struct gtask *tb_running; + u_int tb_seq; + LIST_ENTRY(gtaskqueue_busy) tb_link; }; -static struct gtask * const TB_DRAIN_WAITER = (struct gtask *)0x1; - struct gtaskqueue { STAILQ_HEAD(, gtask) tq_queue; + LIST_HEAD(, gtaskqueue_busy) tq_active; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; gtaskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, gtaskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -111,12 +111,11 @@ gtask_dump(struct gtask *gtask) #endif static __inline int -TQ_SLEEP(struct gtaskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct gtaskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct gtaskqueue * @@ -140,7 +139,7 @@ _gtaskqueue_create(const char *name, int mflags, } STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -163,7 +162,7 @@ gtaskqueue_terminate(struct thread **pp, struct gtaskq while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "gtq_destroy"); } } @@ -174,7 +173,7 @@ gtaskqueue_free(struct gtaskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; gtaskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_GTASKQUEUE); @@ -239,7 +238,7 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_flags & TASK_ENQUEUED) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "gtq_qdrain"); } /* @@ -250,32 +249,25 @@ gtaskqueue_drain_tq_queue(struct gtaskqueue *queue) static void gtaskqueue_drain_tq_active(struct gtaskqueue *queue) { - struct gtaskqueue_busy tb_marker, *tb_first; + struct gtaskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return; /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "gtq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -306,40 +298,27 @@ static void gtaskqueue_run_locked(struct gtaskqueue *queue) { struct gtaskqueue_busy tb; - struct gtaskqueue_busy *tb_first; struct gtask *gtask; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * clear its TASK_ENQUEUED flag - */ - gtask = STAILQ_FIRST(&queue->tq_queue); - KASSERT(gtask != NULL, ("task is NULL")); + while ((gtask = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); gtask->ta_flags &= ~TASK_ENQUEUED; tb.tb_running = gtask; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL")); gtask->ta_func(gtask->ta_context); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(gtask); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } static int @@ -348,7 +327,7 @@ task_is_running(struct gtaskqueue *queue, struct gtask struct gtaskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == gtask) return (1); } @@ -386,7 +365,7 @@ gtaskqueue_drain(struct gtaskqueue *queue, struct gtas TQ_LOCK(queue); while ((gtask->ta_flags & TASK_ENQUEUED) || task_is_running(queue, gtask)) - TQ_SLEEP(queue, gtask, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, gtask, "gtq_drain"); TQ_UNLOCK(queue); } @@ -511,7 +490,7 @@ gtaskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } gtaskqueue_run_locked(tq); /* @@ -537,7 +516,7 @@ gtaskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - wakeup_one(tq); + wakeup_any(tq); } Modified: stable/11/sys/kern/subr_taskqueue.c ============================================================================== --- stable/11/sys/kern/subr_taskqueue.c Wed Nov 6 18:02:18 2019 (r354405) +++ stable/11/sys/kern/subr_taskqueue.c Wed Nov 6 18:15:20 2019 (r354406) @@ -54,24 +54,25 @@ static void taskqueue_swi_enqueue(void *); static void taskqueue_swi_giant_enqueue(void *); struct taskqueue_busy { - struct task *tb_running; - TAILQ_ENTRY(taskqueue_busy) tb_link; + struct task *tb_running; + u_int tb_seq; + LIST_ENTRY(taskqueue_busy) tb_link; }; -struct task * const TB_DRAIN_WAITER = (struct task *)0x1; - struct taskqueue { STAILQ_HEAD(, task) tq_queue; + LIST_HEAD(, taskqueue_busy) tq_active; + struct task *tq_hint; + u_int tq_seq; + int tq_callouts; + struct mtx_padalign tq_mutex; taskqueue_enqueue_fn tq_enqueue; void *tq_context; char *tq_name; - TAILQ_HEAD(, taskqueue_busy) tq_active; - struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_callouts; taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; @@ -114,12 +115,11 @@ _timeout_task_init(struct taskqueue *queue, struct tim } static __inline int -TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, - int t) +TQ_SLEEP(struct taskqueue *tq, void *p, const char *wm) { if (tq->tq_spin) - return (msleep_spin(p, m, wm, t)); - return (msleep(p, m, pri, wm, t)); + return (msleep_spin(p, (struct mtx *)&tq->tq_mutex, wm, 0)); + return (msleep(p, &tq->tq_mutex, 0, wm, 0)); } static struct taskqueue * @@ -143,7 +143,7 @@ _taskqueue_create(const char *name, int mflags, snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue"); STAILQ_INIT(&queue->tq_queue); - TAILQ_INIT(&queue->tq_active); + LIST_INIT(&queue->tq_active); queue->tq_enqueue = enqueue; queue->tq_context = context; queue->tq_name = tq_name; @@ -194,7 +194,7 @@ taskqueue_terminate(struct thread **pp, struct taskque while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); - TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); + TQ_SLEEP(tq, pp, "tq_destroy"); } } @@ -205,7 +205,7 @@ taskqueue_free(struct taskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_terminate(queue->tq_threads, queue); - KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(LIST_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_TASKQUEUE); @@ -231,21 +231,30 @@ taskqueue_enqueue_locked(struct taskqueue *queue, stru } /* - * Optimise the case when all tasks have the same priority. + * Optimise cases when all tasks use small set of priorities. + * In case of only one priority we always insert at the end. + * In case of two tq_hint typically gives the insertion point. + * In case of more then two tq_hint should halve the search. */ prev = STAILQ_LAST(&queue->tq_queue, task, ta_link); if (!prev || prev->ta_priority >= task->ta_priority) { STAILQ_INSERT_TAIL(&queue->tq_queue, task, ta_link); } else { - prev = NULL; - for (ins = STAILQ_FIRST(&queue->tq_queue); ins; - prev = ins, ins = STAILQ_NEXT(ins, ta_link)) + prev = queue->tq_hint; + if (prev && prev->ta_priority >= task->ta_priority) { + ins = STAILQ_NEXT(prev, ta_link); + } else { + prev = NULL; + ins = STAILQ_FIRST(&queue->tq_queue); + } + for (; ins; prev = ins, ins = STAILQ_NEXT(ins, ta_link)) if (ins->ta_priority < task->ta_priority) break; - if (prev) + if (prev) { STAILQ_INSERT_AFTER(&queue->tq_queue, prev, task, ta_link); - else + queue->tq_hint = task; + } else STAILQ_INSERT_HEAD(&queue->tq_queue, task, ta_link); } @@ -362,6 +371,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) */ TASK_INIT(&t_barrier, USHRT_MAX, taskqueue_task_nop_fn, &t_barrier); STAILQ_INSERT_TAIL(&queue->tq_queue, &t_barrier, ta_link); + queue->tq_hint = &t_barrier; t_barrier.ta_pending = 1; /* @@ -369,7 +379,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) * have completed or are currently executing. */ while (t_barrier.ta_pending != 0) - TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, &t_barrier, "tq_qdrain"); return (1); } @@ -381,32 +391,25 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) static int taskqueue_drain_tq_active(struct taskqueue *queue) { - struct taskqueue_busy tb_marker, *tb_first; + struct taskqueue_busy *tb; + u_int seq; - if (TAILQ_EMPTY(&queue->tq_active)) + if (LIST_EMPTY(&queue->tq_active)) return (0); /* Block taskq_terminate().*/ queue->tq_callouts++; - /* - * Wait for all currently executing taskqueue threads - * to go idle. - */ - tb_marker.tb_running = TB_DRAIN_WAITER; - TAILQ_INSERT_TAIL(&queue->tq_active, &tb_marker, tb_link); - while (TAILQ_FIRST(&queue->tq_active) != &tb_marker) - TQ_SLEEP(queue, &tb_marker, &queue->tq_mutex, PWAIT, "-", 0); - TAILQ_REMOVE(&queue->tq_active, &tb_marker, tb_link); + /* Wait for any active task with sequence from the past. */ + seq = queue->tq_seq; +restart: + LIST_FOREACH(tb, &queue->tq_active, tb_link) { + if ((int)(tb->tb_seq - seq) <= 0) { + TQ_SLEEP(queue, tb->tb_running, "tq_adrain"); + goto restart; + } + } - /* - * Wakeup any other drain waiter that happened to queue up - * without any intervening active thread. - */ - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); - /* Release taskqueue_terminate(). */ queue->tq_callouts--; if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) @@ -438,42 +441,31 @@ static void taskqueue_run_locked(struct taskqueue *queue) { struct taskqueue_busy tb; - struct taskqueue_busy *tb_first; struct task *task; int pending; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; + LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - while (STAILQ_FIRST(&queue->tq_queue)) { - TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - - /* - * Carefully remove the first task from the queue and - * zero its pending count. - */ - task = STAILQ_FIRST(&queue->tq_queue); - KASSERT(task != NULL, ("task is NULL")); + while ((task = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; pending = task->ta_pending; task->ta_pending = 0; tb.tb_running = task; + tb.tb_seq = ++queue->tq_seq; TQ_UNLOCK(queue); KASSERT(task->ta_func != NULL, ("task->ta_func is NULL")); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - tb.tb_running = NULL; wakeup(task); - - TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); - tb_first = TAILQ_FIRST(&queue->tq_active); - if (tb_first != NULL && - tb_first->tb_running == TB_DRAIN_WAITER) - wakeup(tb_first); } + LIST_REMOVE(&tb, tb_link); } void @@ -491,7 +483,7 @@ task_is_running(struct taskqueue *queue, struct task * struct taskqueue_busy *tb; TQ_ASSERT_LOCKED(queue); - TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + LIST_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == task) return (1); } @@ -520,8 +512,11 @@ taskqueue_cancel_locked(struct taskqueue *queue, struc u_int *pendp) { - if (task->ta_pending > 0) + if (task->ta_pending > 0) { STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); + if (queue->tq_hint == task) + queue->tq_hint = NULL; + } if (pendp != NULL) *pendp = task->ta_pending; task->ta_pending = 0; @@ -570,7 +565,7 @@ taskqueue_drain(struct taskqueue *queue, struct task * TQ_LOCK(queue); while (task->ta_pending != 0 || task_is_running(queue, task)) - TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0); + TQ_SLEEP(queue, task, "tq_drain"); TQ_UNLOCK(queue); } @@ -776,7 +771,7 @@ taskqueue_thread_loop(void *arg) */ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) break; - TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); + TQ_SLEEP(tq, tq, "-"); } taskqueue_run_locked(tq); /* From owner-svn-src-all@freebsd.org Wed Nov 6 18:39:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215D61BCD96; Wed, 6 Nov 2019 18:39:33 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477b1104Mdz4TTR; Wed, 6 Nov 2019 18:39:33 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA38A141C; Wed, 6 Nov 2019 18:39:32 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6IdWWd012949; Wed, 6 Nov 2019 18:39:32 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6IdW2J012948; Wed, 6 Nov 2019 18:39:32 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911061839.xA6IdW2J012948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 6 Nov 2019 18:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354407 - head/sys/arm/allwinner/clkng X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 354407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 18:39:33 -0000 Author: manu Date: Wed Nov 6 18:39:32 2019 New Revision: 354407 URL: https://svnweb.freebsd.org/changeset/base/354407 Log: arm64: allwinner: a64: Do not init the video related clocks This should be handled by the video drivers and this break EFIFB as this changes clock setup by the bootloader. MFC after: 1 month Modified: head/sys/arm/allwinner/clkng/ccu_a64.c Modified: head/sys/arm/allwinner/clkng/ccu_a64.c ============================================================================== --- head/sys/arm/allwinner/clkng/ccu_a64.c Wed Nov 6 18:15:20 2019 (r354406) +++ head/sys/arm/allwinner/clkng/ccu_a64.c Wed Nov 6 18:39:32 2019 (r354407) @@ -789,10 +789,6 @@ static struct aw_clk_init a64_init_clks[] = { {"ahb1", "pll_periph0", 0, false}, {"ahb2", "pll_periph0", 0, false}, {"dram", "pll_ddr0", 0, false}, - {"pll_de", NULL, 432000000, true}, - {"de", "pll_de", 0, true}, - {"tcon0", "pll_video0-2x", 0, false}, - {"tcon1", "pll_video1", 0, false}, }; static int From owner-svn-src-all@freebsd.org Wed Nov 6 18:54:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5414C1BD3FC; Wed, 6 Nov 2019 18:54:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477bKn1X3rz4VTm; Wed, 6 Nov 2019 18:54:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17A4E17D8; Wed, 6 Nov 2019 18:54:05 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Is4TG024530; Wed, 6 Nov 2019 18:54:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Is4v1024529; Wed, 6 Nov 2019 18:54:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201911061854.xA6Is4v1024529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 6 Nov 2019 18:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354408 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 18:54:05 -0000 Author: imp Date: Wed Nov 6 18:54:04 2019 New Revision: 354408 URL: https://svnweb.freebsd.org/changeset/base/354408 Log: Remove obsolete addition of MACHINE_CPUARCH In the past, we would add symbolic links for MACHINE_CPUARCH when it differed from MACHINE. This was for pc98 only, however. All other architectures didn't need this and it was really due to pc98 pulling from i386 rather than something more intrinsic. At the time, we had the split we did to mimic what NetBSD did for its 68k ports where many different kernels were possible for the same architecture. Since then, both projects have moved away from this convention to having a more generic MACHINE for each architecture. FreeBSD's new arm64/aarch64 breaks this old notion and so was an exception to the rule. So, we no longer need to create this link for any old machine or any new machine, delete it entirely. Differential Revision: https://reviews.freebsd.org/D22246 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Wed Nov 6 18:39:32 2019 (r354407) +++ head/sys/conf/kmod.mk Wed Nov 6 18:54:04 2019 (r354408) @@ -283,9 +283,6 @@ _MAP_DEBUG_PREFIX= yes .endif _ILINKS=machine -.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" -_ILINKS+=${MACHINE_CPUARCH} -.endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _ILINKS+=x86 .endif From owner-svn-src-all@freebsd.org Wed Nov 6 19:44:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFB081BE376; Wed, 6 Nov 2019 19:44:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477cSF40J5z4Xvc; Wed, 6 Nov 2019 19:44:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6146A20F5; Wed, 6 Nov 2019 19:44:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6JijPw055314; Wed, 6 Nov 2019 19:44:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Jijg5055313; Wed, 6 Nov 2019 19:44:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911061944.xA6Jijg5055313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 6 Nov 2019 19:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354409 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 19:44:45 -0000 Author: brooks Date: Wed Nov 6 19:44:44 2019 New Revision: 354409 URL: https://svnweb.freebsd.org/changeset/base/354409 Log: libstats: Improve ABI assertion. On platforms where pointers are larger than 64-bits, struct statsblob may be harmlessly padded out such that opaque[] always has some included space. Make the assertion more general by comparing to the offset of opaque rather than the size of struct statsblob. Discussed with: jhb, James Clarke Reviewed by: trasz, lstewart Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22188 Modified: head/sys/kern/subr_stats.c Modified: head/sys/kern/subr_stats.c ============================================================================== --- head/sys/kern/subr_stats.c Wed Nov 6 18:54:04 2019 (r354408) +++ head/sys/kern/subr_stats.c Wed Nov 6 19:44:44 2019 (r354409) @@ -124,7 +124,8 @@ struct statsblobv1 { struct voi vois[]; /* Array indexed by [voi_id]. */ } __aligned(sizeof(void *)); _Static_assert(offsetof(struct statsblobv1, cursz) + - SIZEOF_MEMBER(struct statsblobv1, cursz) == sizeof(struct statsblob), + SIZEOF_MEMBER(struct statsblobv1, cursz) == + offsetof(struct statsblob, opaque), "statsblobv1 ABI mismatch"); struct statsblobv1_tpl { From owner-svn-src-all@freebsd.org Wed Nov 6 19:51:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 315C71BE46B; Wed, 6 Nov 2019 19:51:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477ccF1JT5z4YGb; Wed, 6 Nov 2019 19:51:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1136A2179; Wed, 6 Nov 2019 19:51:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Jpf4o060161; Wed, 6 Nov 2019 19:51:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6JpffX060159; Wed, 6 Nov 2019 19:51:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061951.xA6JpffX060159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 19:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354410 - in head/sys: dev/mgb modules/mgb X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: dev/mgb modules/mgb X-SVN-Commit-Revision: 354410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 19:51:41 -0000 Author: emaste Date: Wed Nov 6 19:51:40 2019 New Revision: 354410 URL: https://svnweb.freebsd.org/changeset/base/354410 Log: Introduce if_mgb driver for Microchip LAN743x PCIe NIC The Microchip LAN7430 is a PCIe 10/100/1000 Ethernet MAC with integrated PHY, and the LAN7431 is a MAC with RGMII interface. To be connected to the build after further testing and review. Committing now so that changes like r354345 (adding a common ETHER_IS_ZERO macro) will update this driver too. Submitted by: Gerald ND Aryeetey Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20079 Added: head/sys/dev/mgb/ head/sys/dev/mgb/if_mgb.c (contents, props changed) head/sys/dev/mgb/if_mgb.h (contents, props changed) head/sys/modules/mgb/ head/sys/modules/mgb/Makefile (contents, props changed) Added: head/sys/dev/mgb/if_mgb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mgb/if_mgb.c Wed Nov 6 19:51:40 2019 (r354410) @@ -0,0 +1,1634 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 The FreeBSD Foundation, Inc. + * + * This driver was written by Gerald ND Aryeetey + * 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. + */ +#include +__FBSDID("$FreeBSD$"); + +/* + * Microchip LAN7430/LAN7431 PCIe to Gigabit Ethernet Controller driver. + * + * Product information: + * LAN7430 https://www.microchip.com/wwwproducts/en/LAN7430 + * - Integrated IEEE 802.3 compliant PHY + * LAN7431 https://www.microchip.com/wwwproducts/en/LAN7431 + * - RGMII Interface + * + * This driver uses the iflib interface and the default 'ukphy' PHY driver. + * + * UNIMPLEMENTED FEATURES + * ---------------------- + * A number of features supported by LAN743X device are not yet implemented in + * this driver: + * + * - Multiple (up to 4) RX queues support + * - Just needs to remove asserts and malloc multiple `rx_ring_data` + * structs based on ncpus. + * - RX/TX Checksum Offloading support + * - VLAN support + * - Recieve Packet Filtering (Multicast Perfect/Hash Address) support + * - Wake on LAN (WoL) support + * - TX LSO support + * - Recieve Side Scaling (RSS) support + * - Debugging Capabilities: + * - Could include MAC statistics and + * error status registers in sysctl. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "ifdi_if.h" +#include "miibus_if.h" + +static pci_vendor_info_t mgb_vendor_info_array[] = { + PVID(MGB_MICROCHIP_VENDOR_ID, MGB_LAN7430_DEVICE_ID, + "Microchip LAN7430 PCIe Gigabit Ethernet Controller"), + PVID(MGB_MICROCHIP_VENDOR_ID, MGB_LAN7431_DEVICE_ID, + "Microchip LAN7431 PCIe Gigabit Ethernet Controller"), + PVID_END +}; + +/* Device methods */ +static device_register_t mgb_register; + +/* IFLIB methods */ +static ifdi_attach_pre_t mgb_attach_pre; +static ifdi_attach_post_t mgb_attach_post; +static ifdi_detach_t mgb_detach; + +static ifdi_tx_queues_alloc_t mgb_tx_queues_alloc; +static ifdi_rx_queues_alloc_t mgb_rx_queues_alloc; +static ifdi_queues_free_t mgb_queues_free; + +static ifdi_init_t mgb_init; +static ifdi_stop_t mgb_stop; + +static ifdi_msix_intr_assign_t mgb_msix_intr_assign; +static ifdi_tx_queue_intr_enable_t mgb_tx_queue_intr_enable; +static ifdi_rx_queue_intr_enable_t mgb_rx_queue_intr_enable; +static ifdi_intr_enable_t mgb_intr_enable_all; +static ifdi_intr_disable_t mgb_intr_disable_all; + +/* IFLIB_TXRX methods */ +static int mgb_isc_txd_encap(void *, + if_pkt_info_t); +static void mgb_isc_txd_flush(void *, + uint16_t, qidx_t); +static int mgb_isc_txd_credits_update(void *, + uint16_t, bool); +static int mgb_isc_rxd_available(void *, + uint16_t, qidx_t, qidx_t); +static int mgb_isc_rxd_pkt_get(void *, + if_rxd_info_t); +static void mgb_isc_rxd_refill(void *, + if_rxd_update_t); +static void mgb_isc_rxd_flush(void *, + uint16_t, uint8_t, qidx_t); + +/* Interrupts */ +static driver_filter_t mgb_legacy_intr; +static driver_filter_t mgb_admin_intr; +static driver_filter_t mgb_rxq_intr; +static bool mgb_intr_test(struct mgb_softc *); + +/* MII methods */ +static miibus_readreg_t mgb_miibus_readreg; +static miibus_writereg_t mgb_miibus_writereg; +static miibus_linkchg_t mgb_miibus_linkchg; +static miibus_statchg_t mgb_miibus_statchg; + +static int mgb_media_change(if_t); +static void mgb_media_status(if_t, + struct ifmediareq *); + +/* Helper/Test functions */ +static int mgb_test_bar(struct mgb_softc *); +static int mgb_alloc_regs(struct mgb_softc *); +static int mgb_release_regs(struct mgb_softc *); + +static void mgb_get_ethaddr(struct mgb_softc *, + struct ether_addr *); + +static int mgb_wait_for_bits(struct mgb_softc *, + int, int, int); + +/* H/W init, reset and teardown helpers */ +static int mgb_hw_init(struct mgb_softc *); +static int mgb_hw_teardown(struct mgb_softc *); +static int mgb_hw_reset(struct mgb_softc *); +static int mgb_mac_init(struct mgb_softc *); +static int mgb_dmac_reset(struct mgb_softc *); +static int mgb_phy_reset(struct mgb_softc *); + +static int mgb_dma_init(struct mgb_softc *); +static int mgb_dma_tx_ring_init(struct mgb_softc *, + int); +static int mgb_dma_rx_ring_init(struct mgb_softc *, + int); + +static int mgb_dmac_control(struct mgb_softc *, + int, int, enum mgb_dmac_cmd); +static int mgb_fct_control(struct mgb_softc *, + int, int, enum mgb_fct_cmd); + +/********************************************************************* + * FreeBSD Device Interface Entry Points + *********************************************************************/ + +static device_method_t mgb_methods[] = { + /* Device interface */ + DEVMETHOD(device_register, mgb_register), + DEVMETHOD(device_probe, iflib_device_probe), + DEVMETHOD(device_attach, iflib_device_attach), + DEVMETHOD(device_detach, iflib_device_detach), + DEVMETHOD(device_shutdown, iflib_device_shutdown), + DEVMETHOD(device_suspend, iflib_device_suspend), + DEVMETHOD(device_resume, iflib_device_resume), + + /* MII Interface */ + DEVMETHOD(miibus_readreg, mgb_miibus_readreg), + DEVMETHOD(miibus_writereg, mgb_miibus_writereg), + DEVMETHOD(miibus_linkchg, mgb_miibus_linkchg), + DEVMETHOD(miibus_statchg, mgb_miibus_statchg), + + DEVMETHOD_END +}; + +static driver_t mgb_driver = { + "mgb", mgb_methods, sizeof(struct mgb_softc) +}; + +devclass_t mgb_devclass; +DRIVER_MODULE(mgb, pci, mgb_driver, mgb_devclass, NULL, NULL); +IFLIB_PNP_INFO(pci, mgb, mgb_vendor_info_array); +MODULE_VERSION(mgb, 1); + +#if 0 /* MIIBUS_DEBUG */ +/* If MIIBUS debug stuff is in attach then order matters. Use below instead. */ +DRIVER_MODULE_ORDERED(miibus, mgb, miibus_driver, miibus_devclass, NULL, NULL, + SI_ORDER_ANY); +#endif /* MIIBUS_DEBUG */ +DRIVER_MODULE(miibus, mgb, miibus_driver, miibus_devclass, NULL, NULL); + +MODULE_DEPEND(mgb, pci, 1, 1, 1); +MODULE_DEPEND(mgb, ether, 1, 1, 1); +MODULE_DEPEND(mgb, miibus, 1, 1, 1); +MODULE_DEPEND(mgb, iflib, 1, 1, 1); + +static device_method_t mgb_iflib_methods[] = { + DEVMETHOD(ifdi_attach_pre, mgb_attach_pre), + DEVMETHOD(ifdi_attach_post, mgb_attach_post), + DEVMETHOD(ifdi_detach, mgb_detach), + + DEVMETHOD(ifdi_init, mgb_init), + DEVMETHOD(ifdi_stop, mgb_stop), + + DEVMETHOD(ifdi_tx_queues_alloc, mgb_tx_queues_alloc), + DEVMETHOD(ifdi_rx_queues_alloc, mgb_rx_queues_alloc), + DEVMETHOD(ifdi_queues_free, mgb_queues_free), + + DEVMETHOD(ifdi_msix_intr_assign, mgb_msix_intr_assign), + DEVMETHOD(ifdi_tx_queue_intr_enable, mgb_tx_queue_intr_enable), + DEVMETHOD(ifdi_rx_queue_intr_enable, mgb_rx_queue_intr_enable), + DEVMETHOD(ifdi_intr_enable, mgb_intr_enable_all), + DEVMETHOD(ifdi_intr_disable, mgb_intr_disable_all), + + +#if 0 /* Not yet implemented IFLIB methods */ + /* + * Set multicast addresses, mtu and promiscuous mode + */ + DEVMETHOD(ifdi_multi_set, mgb_multi_set), + DEVMETHOD(ifdi_mtu_set, mgb_mtu_set), + DEVMETHOD(ifdi_promisc_set, mgb_promisc_set), + + /* + * Needed for VLAN support + */ + DEVMETHOD(ifdi_vlan_register, mgb_vlan_register), + DEVMETHOD(ifdi_vlan_unregister, mgb_vlan_unregister), + + /* + * Needed for WOL support + * at the very least. + */ + DEVMETHOD(ifdi_shutdown, mgb_shutdown), + DEVMETHOD(ifdi_suspend, mgb_suspend), + DEVMETHOD(ifdi_resume, mgb_resume), +#endif /* UNUSED_IFLIB_METHODS */ + DEVMETHOD_END +}; + +static driver_t mgb_iflib_driver = { + "mgb", mgb_iflib_methods, sizeof(struct mgb_softc) +}; + +struct if_txrx mgb_txrx = { + .ift_txd_encap = mgb_isc_txd_encap, + .ift_txd_flush = mgb_isc_txd_flush, + .ift_txd_credits_update = mgb_isc_txd_credits_update, + .ift_rxd_available = mgb_isc_rxd_available, + .ift_rxd_pkt_get = mgb_isc_rxd_pkt_get, + .ift_rxd_refill = mgb_isc_rxd_refill, + .ift_rxd_flush = mgb_isc_rxd_flush, + + .ift_legacy_intr = mgb_legacy_intr +}; + +struct if_shared_ctx mgb_sctx_init = { + .isc_magic = IFLIB_MAGIC, + + .isc_q_align = PAGE_SIZE, + .isc_admin_intrcnt = 1, + .isc_flags = IFLIB_DRIVER_MEDIA /* | IFLIB_HAS_RXCQ | IFLIB_HAS_TXCQ*/, + + .isc_vendor_info = mgb_vendor_info_array, + .isc_driver_version = "1", + .isc_driver = &mgb_iflib_driver, + /* 2 queues per set for TX and RX (ring queue, head writeback queue) */ + .isc_ntxqs = 2, + + .isc_tx_maxsize = MGB_DMA_MAXSEGS * MCLBYTES, + /* .isc_tx_nsegments = MGB_DMA_MAXSEGS, */ + .isc_tx_maxsegsize = MCLBYTES, + + .isc_ntxd_min = {1, 1}, /* Will want to make this bigger */ + .isc_ntxd_max = {MGB_DMA_RING_SIZE, 1}, + .isc_ntxd_default = {MGB_DMA_RING_SIZE, 1}, + + .isc_nrxqs = 2, + + .isc_rx_maxsize = MCLBYTES, + .isc_rx_nsegments = 1, + .isc_rx_maxsegsize = MCLBYTES, + + .isc_nrxd_min = {1, 1}, /* Will want to make this bigger */ + .isc_nrxd_max = {MGB_DMA_RING_SIZE, 1}, + .isc_nrxd_default = {MGB_DMA_RING_SIZE, 1}, + + .isc_nfl = 1, /*one free list since there is only one queue */ +#if 0 /* UNUSED_CTX */ + + .isc_tso_maxsize = MGB_TSO_MAXSIZE + sizeof(struct ether_vlan_header), + .isc_tso_maxsegsize = MGB_TX_MAXSEGSIZE, +#endif /* UNUSED_CTX */ +}; + +/*********************************************************************/ + + +static void * +mgb_register(device_t dev) +{ + + return (&mgb_sctx_init); +} + +static int +mgb_attach_pre(if_ctx_t ctx) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + int error, phyaddr, rid; + struct ether_addr hwaddr; + struct mii_data *miid; + + sc = iflib_get_softc(ctx); + sc->ctx = ctx; + sc->dev = iflib_get_dev(ctx); + scctx = iflib_get_softc_ctx(ctx); + + /* IFLIB required setup */ + scctx->isc_txrx = &mgb_txrx; + scctx->isc_tx_nsegments = MGB_DMA_MAXSEGS; + /* Ring desc queues */ + scctx->isc_txqsizes[0] = sizeof(struct mgb_ring_desc) * + scctx->isc_ntxd[0]; + scctx->isc_rxqsizes[0] = sizeof(struct mgb_ring_desc) * + scctx->isc_nrxd[0]; + + /* Head WB queues */ + scctx->isc_txqsizes[1] = sizeof(uint32_t) * scctx->isc_ntxd[1]; + scctx->isc_rxqsizes[1] = sizeof(uint32_t) * scctx->isc_nrxd[1]; + + /* XXX: Must have 1 txqset, but can have up to 4 rxqsets */ + scctx->isc_nrxqsets = 1; + scctx->isc_ntxqsets = 1; + + /* scctx->isc_tx_csum_flags = (CSUM_TCP | CSUM_UDP) | + (CSUM_TCP_IPV6 | CSUM_UDP_IPV6) | CSUM_TSO */ + scctx->isc_tx_csum_flags = 0; + scctx->isc_capabilities = scctx->isc_capenable = 0; +#if 0 + /* + * CSUM, TSO and VLAN support are TBD + */ + IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 | + IFCAP_TSO4 | IFCAP_TSO6 | + IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | + IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO | + IFCAP_JUMBO_MTU; + scctx->isc_capabilities |= IFCAP_LRO | IFCAP_VLAN_HWFILTER; +#endif + + /* get the BAR */ + error = mgb_alloc_regs(sc); + if (error != 0) { + device_printf(sc->dev, + "Unable to allocate bus resource: registers.\n"); + goto fail; + } + + error = mgb_test_bar(sc); + if (error != 0) + goto fail; + + error = mgb_hw_init(sc); + if (error != 0) { + device_printf(sc->dev, + "MGB device init failed. (err: %d)\n", error); + goto fail; + } + + switch (pci_get_device(sc->dev)) + { + case MGB_LAN7430_DEVICE_ID: + phyaddr = 1; + break; + case MGB_LAN7431_DEVICE_ID: + default: + phyaddr = MII_PHY_ANY; + break; + } + + /* XXX: Would be nice(r) if locked methods were here */ + error = mii_attach(sc->dev, &sc->miibus, iflib_get_ifp(ctx), + mgb_media_change, mgb_media_status, + BMSR_DEFCAPMASK, phyaddr, MII_OFFSET_ANY, MIIF_DOPAUSE); + if (error != 0) { + device_printf(sc->dev, "Failed to attach MII interface\n"); + goto fail; + } + + miid = device_get_softc(sc->miibus); + scctx->isc_media = &miid->mii_media; + + scctx->isc_msix_bar = pci_msix_table_bar(sc->dev); + /** Setup PBA BAR **/ + rid = pci_msix_pba_bar(sc->dev); + if (rid != scctx->isc_msix_bar) { + sc->pba = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->pba == NULL) { + error = ENXIO; + device_printf(sc->dev, "Failed to setup PBA BAR\n"); + goto fail; + } + } + + mgb_get_ethaddr(sc, &hwaddr); + if (ETHER_IS_BROADCAST(hwaddr.octet) || + ETHER_IS_MULTICAST(hwaddr.octet) || + ETHER_IS_ZERO(hwaddr.octet)) + ether_gen_addr(iflib_get_ifp(ctx), &hwaddr); + + /* + * XXX: if the MAC address was generated the linux driver + * writes it back to the device. + */ + iflib_set_mac(ctx, hwaddr.octet); + + /* Map all vectors to vector 0 (admin interrupts) by default. */ + CSR_WRITE_REG(sc, MGB_INTR_VEC_RX_MAP, 0); + CSR_WRITE_REG(sc, MGB_INTR_VEC_TX_MAP, 0); + CSR_WRITE_REG(sc, MGB_INTR_VEC_OTHER_MAP, 0); + + return (0); + +fail: + mgb_detach(ctx); + return (error); +} + +static int +mgb_attach_post(if_ctx_t ctx) +{ + struct mgb_softc *sc; + + sc = iflib_get_softc(ctx); + + device_printf(sc->dev, "Interrupt test: %s\n", + (mgb_intr_test(sc) ? "PASS" : "FAIL")); + + return (0); +} + +static int +mgb_detach(if_ctx_t ctx) +{ + struct mgb_softc *sc; + int error; + + sc = iflib_get_softc(ctx); + + /* XXX: Should report errors but still detach everything. */ + error = mgb_hw_teardown(sc); + + /* Release IRQs */ + iflib_irq_free(ctx, &sc->rx_irq); + iflib_irq_free(ctx, &sc->admin_irq); + + if (sc->miibus != NULL) + device_delete_child(sc->dev, sc->miibus); + + if (sc->pba != NULL) + error = bus_release_resource(sc->dev, SYS_RES_MEMORY, + rman_get_rid(sc->pba), sc->pba); + sc->pba = NULL; + + error = mgb_release_regs(sc); + + return (error); +} + +static int +mgb_media_change(if_t ifp) +{ + struct mii_data *miid; + struct mii_softc *miisc; + struct mgb_softc *sc; + if_ctx_t ctx; + int needs_reset; + + ctx = if_getsoftc(ifp); + sc = iflib_get_softc(ctx); + miid = device_get_softc(sc->miibus); + LIST_FOREACH(miisc, &miid->mii_phys, mii_list) + PHY_RESET(miisc); + + needs_reset = mii_mediachg(miid); + if (needs_reset != 0) + ifp->if_init(ctx); + return (needs_reset); +} + +static void +mgb_media_status(if_t ifp, struct ifmediareq *ifmr) +{ + struct mgb_softc *sc; + struct mii_data *miid; + + sc = iflib_get_softc(if_getsoftc(ifp)); + miid = device_get_softc(sc->miibus); + if ((if_getflags(ifp) & IFF_UP) == 0) + return; + + mii_pollstat(miid); + ifmr->ifm_active = miid->mii_media_active; + ifmr->ifm_status = miid->mii_media_status; +} + +static int +mgb_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int ntxqs, + int ntxqsets) +{ + struct mgb_softc *sc; + struct mgb_ring_data *rdata; + int q; + + sc = iflib_get_softc(ctx); + KASSERT(ntxqsets == 1, ("ntxqsets = %d", ntxqsets)); + rdata = &sc->tx_ring_data; + for (q = 0; q < ntxqsets; q++) { + KASSERT(ntxqs == 2, ("ntxqs = %d", ntxqs)); + /* Ring */ + rdata->ring = (struct mgb_ring_desc *) vaddrs[q * ntxqs + 0]; + rdata->ring_bus_addr = paddrs[q * ntxqs + 0]; + + /* Head WB */ + rdata->head_wb = (uint32_t *) vaddrs[q * ntxqs + 1]; + rdata->head_wb_bus_addr = paddrs[q * ntxqs + 1]; + } + return 0; +} + +static int +mgb_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, + int nrxqsets) +{ + struct mgb_softc *sc; + struct mgb_ring_data *rdata; + int q; + + sc = iflib_get_softc(ctx); + KASSERT(nrxqsets == 1, ("nrxqsets = %d", nrxqsets)); + rdata = &sc->rx_ring_data; + for (q = 0; q < nrxqsets; q++) { + KASSERT(nrxqs == 2, ("nrxqs = %d", nrxqs)); + /* Ring */ + rdata->ring = (struct mgb_ring_desc *) vaddrs[q * nrxqs + 0]; + rdata->ring_bus_addr = paddrs[q * nrxqs + 0]; + + /* Head WB */ + rdata->head_wb = (uint32_t *) vaddrs[q * nrxqs + 1]; + rdata->head_wb_bus_addr = paddrs[q * nrxqs + 1]; + } + return 0; +} + +static void +mgb_queues_free(if_ctx_t ctx) +{ + struct mgb_softc *sc; + + sc = iflib_get_softc(ctx); + + memset(&sc->rx_ring_data, 0, sizeof(struct mgb_ring_data)); + memset(&sc->tx_ring_data, 0, sizeof(struct mgb_ring_data)); +} + +static void +mgb_init(if_ctx_t ctx) +{ + struct mgb_softc *sc; + struct mii_data *miid; + int error; + + sc = iflib_get_softc(ctx); + miid = device_get_softc(sc->miibus); + device_printf(sc->dev, "running init ...\n"); + + mgb_dma_init(sc); + + /* XXX: Turn off perfect filtering, turn on (broad|multi|uni)cast rx */ + CSR_CLEAR_REG(sc, MGB_RFE_CTL, MGB_RFE_ALLOW_PERFECT_FILTER); + CSR_UPDATE_REG(sc, MGB_RFE_CTL, + MGB_RFE_ALLOW_BROADCAST | + MGB_RFE_ALLOW_UNICAST | + MGB_RFE_ALLOW_UNICAST); + + error = mii_mediachg(miid); + KASSERT(!error, ("mii_mediachg returned: %d", error)); +} + +#ifdef DEBUG +static void +mgb_dump_some_stats(struct mgb_softc *sc) +{ + int i; + int first_stat = 0x1200; + int last_stat = 0x12FC; + + for (i = first_stat; i <= last_stat; i += 4) + if (CSR_READ_REG(sc, i) != 0) + device_printf(sc->dev, "0x%04x: 0x%08x\n", i, + CSR_READ_REG(sc, i)); + char *stat_names[] = { + "MAC_ERR_STS ", + "FCT_INT_STS ", + "DMAC_CFG ", + "DMAC_CMD ", + "DMAC_INT_STS ", + "DMAC_INT_EN ", + "DMAC_RX_ERR_STS0 ", + "DMAC_RX_ERR_STS1 ", + "DMAC_RX_ERR_STS2 ", + "DMAC_RX_ERR_STS3 ", + "INT_STS ", + "INT_EN ", + "INT_VEC_EN ", + "INT_VEC_MAP0 ", + "INT_VEC_MAP1 ", + "INT_VEC_MAP2 ", + "TX_HEAD0", + "TX_TAIL0", + "DMAC_TX_ERR_STS0 ", + NULL + }; + int stats[] = { + 0x114, + 0xA0, + 0xC00, + 0xC0C, + 0xC10, + 0xC14, + 0xC60, + 0xCA0, + 0xCE0, + 0xD20, + 0x780, + 0x788, + 0x794, + 0x7A0, + 0x7A4, + 0x780, + 0xD58, + 0xD5C, + 0xD60, + 0x0 + }; + i = 0; + printf("==============================\n"); + while (stats[i++]) + device_printf(sc->dev, "%s at offset 0x%04x = 0x%08x\n", + stat_names[i - 1], stats[i - 1], + CSR_READ_REG(sc, stats[i - 1])); + printf("==== TX RING DESCS ====\n"); + for (i = 0; i < MGB_DMA_RING_SIZE; i++) + device_printf(sc->dev, "ring[%d].data0=0x%08x\n" + "ring[%d].data1=0x%08x\n" + "ring[%d].data2=0x%08x\n" + "ring[%d].data3=0x%08x\n", + i, sc->tx_ring_data.ring[i].ctl, + i, sc->tx_ring_data.ring[i].addr.low, + i, sc->tx_ring_data.ring[i].addr.high, + i, sc->tx_ring_data.ring[i].sts); + device_printf(sc->dev, "==== DUMP_TX_DMA_RAM ====\n"); + int i; + CSR_WRITE_REG(sc, 0x24, 0xF); // DP_SEL & TX_RAM_0 + for (i = 0; i < 128; i++) { + CSR_WRITE_REG(sc, 0x2C, i); // DP_ADDR + + CSR_WRITE_REG(sc, 0x28, 0); // DP_CMD + + while ((CSR_READ_REG(sc, 0x24) & 0x80000000) == 0) // DP_SEL & READY + DELAY(1000); + + device_printf(sc->dev, "DMAC_TX_RAM_0[%u]=%08x\n", i, + CSR_READ_REG(sc, 0x30)); // DP_DATA + } +} +#endif + +static void +mgb_stop(if_ctx_t ctx) +{ + struct mgb_softc *sc ; + if_softc_ctx_t scctx; + int i; + + sc = iflib_get_softc(ctx); + scctx = iflib_get_softc_ctx(ctx); + + /* XXX: Could potentially timeout */ + for (i = 0; i < scctx->isc_nrxqsets; i++) { + mgb_dmac_control(sc, MGB_DMAC_RX_START, 0, DMAC_STOP); + mgb_fct_control(sc, MGB_FCT_RX_CTL, 0, FCT_DISABLE); + } + for (i = 0; i < scctx->isc_ntxqsets; i++) { + mgb_dmac_control(sc, MGB_DMAC_TX_START, 0, DMAC_STOP); + mgb_fct_control(sc, MGB_FCT_TX_CTL, 0, FCT_DISABLE); + } +} + +static int +mgb_legacy_intr(void *xsc) +{ + struct mgb_softc *sc; + + sc = xsc; + iflib_admin_intr_deferred(sc->ctx); + return (FILTER_HANDLED); +} + +static int +mgb_rxq_intr(void *xsc) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + uint32_t intr_sts, intr_en; + int qidx; + + sc = xsc; + scctx = iflib_get_softc_ctx(sc->ctx); + + intr_sts = CSR_READ_REG(sc, MGB_INTR_STS); + intr_en = CSR_READ_REG(sc, MGB_INTR_ENBL_SET); + intr_sts &= intr_en; + + for (qidx = 0; qidx < scctx->isc_nrxqsets; qidx++) { + if ((intr_sts & MGB_INTR_STS_RX(qidx))){ + CSR_WRITE_REG(sc, MGB_INTR_ENBL_CLR, + MGB_INTR_STS_RX(qidx)); + CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_RX(qidx)); + } + } + return (FILTER_SCHEDULE_THREAD); +} + +static int +mgb_admin_intr(void *xsc) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + uint32_t intr_sts, intr_en; + int qidx; + + sc = xsc; + scctx = iflib_get_softc_ctx(sc->ctx); + + intr_sts = CSR_READ_REG(sc, MGB_INTR_STS); + intr_en = CSR_READ_REG(sc, MGB_INTR_ENBL_SET); + intr_sts &= intr_en; + + /* + * NOTE: Debugging printfs here + * will likely cause interrupt test failure. + */ + + /* TODO: shouldn't continue if suspended */ + if ((intr_sts & MGB_INTR_STS_ANY) == 0) + { + device_printf(sc->dev, "non-mgb interrupt triggered.\n"); + return (FILTER_SCHEDULE_THREAD); + } + if ((intr_sts & MGB_INTR_STS_TEST) != 0) + { + sc->isr_test_flag = true; + CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); + return (FILTER_HANDLED); + } + if ((intr_sts & MGB_INTR_STS_RX_ANY) != 0) + { + for (qidx = 0; qidx < scctx->isc_nrxqsets; qidx++) { + if ((intr_sts & MGB_INTR_STS_RX(qidx))){ + iflib_rx_intr_deferred(sc->ctx, qidx); + } + } + return (FILTER_HANDLED); + } + /* XXX: TX interrupts should not occur */ + if ((intr_sts & MGB_INTR_STS_TX_ANY) != 0) + { + for (qidx = 0; qidx < scctx->isc_ntxqsets; qidx++) { + if ((intr_sts & MGB_INTR_STS_RX(qidx))) { + /* clear the interrupt sts and run handler */ + CSR_WRITE_REG(sc, MGB_INTR_ENBL_CLR, + MGB_INTR_STS_TX(qidx)); + CSR_WRITE_REG(sc, MGB_INTR_STS, + MGB_INTR_STS_TX(qidx)); + iflib_tx_intr_deferred(sc->ctx, qidx); + } + } + return (FILTER_HANDLED); + } + + return (FILTER_SCHEDULE_THREAD); +} + +static int +mgb_msix_intr_assign(if_ctx_t ctx, int msix) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + int error, i, vectorid; + char irq_name[16]; + + sc = iflib_get_softc(ctx); + scctx = iflib_get_softc_ctx(ctx); + + KASSERT(scctx->isc_nrxqsets == 1 && scctx->isc_ntxqsets == 1, + ("num rxqsets/txqsets != 1 ")); + + /* + * First vector should be admin interrupts, others vectors are TX/RX + * + * RIDs start at 1, and vector ids start at 0. + */ + vectorid = 0; + error = iflib_irq_alloc_generic(ctx, &sc->admin_irq, vectorid + 1, + IFLIB_INTR_ADMIN, mgb_admin_intr, sc, 0, "admin"); + if (error) { + device_printf(sc->dev, + "Failed to register admin interrupt handler\n"); + return (error); + } + + for (i = 0; i < scctx->isc_nrxqsets; i++) { + vectorid++; + snprintf(irq_name, sizeof(irq_name), "rxq%d", i); + error = iflib_irq_alloc_generic(ctx, &sc->rx_irq, vectorid + 1, + IFLIB_INTR_RX, mgb_rxq_intr, sc, i, irq_name); + if (error) { + device_printf(sc->dev, + "Failed to register rxq %d interrupt handler\n", i); + return (error); + } + CSR_UPDATE_REG(sc, MGB_INTR_VEC_RX_MAP, + MGB_INTR_VEC_MAP(vectorid, i)); + } + + /* Not actually mapping hw TX interrupts ... */ + for (i = 0; i < scctx->isc_ntxqsets; i++) { + snprintf(irq_name, sizeof(irq_name), "txq%d", i); + iflib_softirq_alloc_generic(ctx, NULL, IFLIB_INTR_TX, NULL, i, + irq_name); + } + + return (0); +} + +static void +mgb_intr_enable_all(if_ctx_t ctx) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + int i, dmac_enable = 0, intr_sts = 0, vec_en = 0; + + sc = iflib_get_softc(ctx); + scctx = iflib_get_softc_ctx(ctx); + intr_sts |= MGB_INTR_STS_ANY; + vec_en |= MGB_INTR_STS_ANY; + + for (i = 0; i < scctx->isc_nrxqsets; i++) { + intr_sts |= MGB_INTR_STS_RX(i); + dmac_enable |= MGB_DMAC_RX_INTR_ENBL(i); + vec_en |= MGB_INTR_RX_VEC_STS(i); + } + + /* TX interrupts aren't needed ... */ + + CSR_WRITE_REG(sc, MGB_INTR_ENBL_SET, intr_sts); + CSR_WRITE_REG(sc, MGB_INTR_VEC_ENBL_SET, vec_en); + CSR_WRITE_REG(sc, MGB_DMAC_INTR_STS, dmac_enable); + CSR_WRITE_REG(sc, MGB_DMAC_INTR_ENBL_SET, dmac_enable); +} + +static void +mgb_intr_disable_all(if_ctx_t ctx) +{ + struct mgb_softc *sc; + + sc = iflib_get_softc(ctx); + CSR_WRITE_REG(sc, MGB_INTR_ENBL_CLR, UINT32_MAX); + CSR_WRITE_REG(sc, MGB_INTR_VEC_ENBL_CLR, UINT32_MAX); + CSR_WRITE_REG(sc, MGB_INTR_STS, UINT32_MAX); + + CSR_WRITE_REG(sc, MGB_DMAC_INTR_ENBL_CLR, UINT32_MAX); + CSR_WRITE_REG(sc, MGB_DMAC_INTR_STS, UINT32_MAX); +} + +static int +mgb_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid) +{ + /* called after successful rx isr */ + struct mgb_softc *sc; + + sc = iflib_get_softc(ctx); + CSR_WRITE_REG(sc, MGB_INTR_VEC_ENBL_SET, MGB_INTR_RX_VEC_STS(qid)); + CSR_WRITE_REG(sc, MGB_INTR_ENBL_SET, MGB_INTR_STS_RX(qid)); + + CSR_WRITE_REG(sc, MGB_DMAC_INTR_STS, MGB_DMAC_RX_INTR_ENBL(qid)); + CSR_WRITE_REG(sc, MGB_DMAC_INTR_ENBL_SET, MGB_DMAC_RX_INTR_ENBL(qid)); + return (0); +} + +static int +mgb_tx_queue_intr_enable(if_ctx_t ctx, uint16_t qid) +{ + /* XXX: not called (since tx interrupts not used) */ + struct mgb_softc *sc; + + sc = iflib_get_softc(ctx); + + CSR_WRITE_REG(sc, MGB_INTR_ENBL_SET, MGB_INTR_STS_TX(qid)); + + CSR_WRITE_REG(sc, MGB_DMAC_INTR_STS, MGB_DMAC_TX_INTR_ENBL(qid)); + CSR_WRITE_REG(sc, MGB_DMAC_INTR_ENBL_SET, MGB_DMAC_TX_INTR_ENBL(qid)); + return (0); +} + +static bool +mgb_intr_test(struct mgb_softc *sc) +{ + int i; + + sc->isr_test_flag = false; + CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); + CSR_WRITE_REG(sc, MGB_INTR_VEC_ENBL_SET, MGB_INTR_STS_ANY); + CSR_WRITE_REG(sc, MGB_INTR_ENBL_SET, + MGB_INTR_STS_ANY | MGB_INTR_STS_TEST); + CSR_WRITE_REG(sc, MGB_INTR_SET, MGB_INTR_STS_TEST); + if (sc->isr_test_flag) + return true; + for (i = 0; i < MGB_TIMEOUT; i++) { + DELAY(10); + if (sc->isr_test_flag) + break; + } + CSR_WRITE_REG(sc, MGB_INTR_ENBL_CLR, MGB_INTR_STS_TEST); + CSR_WRITE_REG(sc, MGB_INTR_STS, MGB_INTR_STS_TEST); + return sc->isr_test_flag; +} + +static int +mgb_isc_txd_encap(void *xsc , if_pkt_info_t ipi) +{ + struct mgb_softc *sc; + if_softc_ctx_t scctx; + struct mgb_ring_data *rdata; + struct mgb_ring_desc *txd; + bus_dma_segment_t *segs; + qidx_t pidx, nsegs; + int i; + + KASSERT(ipi->ipi_qsidx == 0, + ("tried to refill TX Channel %d.\n", ipi->ipi_qsidx)); + sc = xsc; + scctx = iflib_get_softc_ctx(sc->ctx); + rdata = &sc->tx_ring_data; + + pidx = ipi->ipi_pidx; + segs = ipi->ipi_segs; + nsegs = ipi->ipi_nsegs; + + /* For each seg, create a descriptor */ + for (i = 0; i < nsegs; ++i) { + KASSERT(nsegs == 1, ("Multisegment packet !!!!!\n")); + txd = &rdata->ring[pidx]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Nov 6 19:52:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 941001BE650; Wed, 6 Nov 2019 19:52:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477cdD3Tkyz4YT7; Wed, 6 Nov 2019 19:52:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4193722C9; Wed, 6 Nov 2019 19:52:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6JqW81060872; Wed, 6 Nov 2019 19:52:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6JqWtO060871; Wed, 6 Nov 2019 19:52:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911061952.xA6JqWtO060871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 19:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354411 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 19:52:32 -0000 Author: emaste Date: Wed Nov 6 19:52:31 2019 New Revision: 354411 URL: https://svnweb.freebsd.org/changeset/base/354411 Log: Add mgb(4) (Microchip LAN783x PCIe NIC) man page Sponsored by: The FreeBSD Foundation Added: head/share/man/man4/mgb.4 (contents, props changed) Added: head/share/man/man4/mgb.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/mgb.4 Wed Nov 6 19:52:31 2019 (r354411) @@ -0,0 +1,86 @@ +.\" Copyright (c) 2019 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$ +.\" +.Dd May 2, 2019 +.Dt MGB 4 +.Os +.Sh NAME +.Nm mgb +.Nd "Microchip LAN743x PCIe Gigabit Ethernet driver" +.Sh SYNOPSIS +To load the driver as a module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_mgb_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for PCIe Gigabit Ethernet adapters based on +Microchip's LAN7430 and LAN7431. +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports: +.Pp +.Bl -bullet -compact +.It +Microchip LAN7430 PCIe Gigabit Ethernet controller with PHY +.It +Microchip LAN7431 PCIe Gigabit Ethernet controller with RGMII interface +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr miibus 4 , +.Xr ifconfig 8 +.Sh CAVEATS +The driver does not yet implement support for many hardware features, +including: +.Bl -bullet -compact +.It +Multiple RX queue support +.It +RX and TX checksum offload +.It +Hardware VLAN tagging or untagging +.It +Multicast receive packet filtering +.It +Wake on LAN (WoL) +.It +LSO +.It +RSS +.El +.Pp +LAN7431 support is completely untested. +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 13.0 . From owner-svn-src-all@freebsd.org Wed Nov 6 20:40:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 540CF1BF8BB for ; Wed, 6 Nov 2019 20:40:16 +0000 (UTC) (envelope-from njm@njm.me.uk) Received: from smtp001-out2.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 477dhH294Fz4bwR for ; Wed, 6 Nov 2019 20:40:14 +0000 (UTC) (envelope-from njm@njm.me.uk) Received: (qmail 74614 invoked from network); 6 Nov 2019 20:40:12 -0000 X-APM-Out-ID: 15730728127460 X-APM-Authkey: 18389/1(18389/1) 5 Received: from unknown (HELO meld.njm.me.uk) (90.194.130.32) by smtp001.apm-internet.net with SMTP; 6 Nov 2019 20:40:12 -0000 Received: from triton.njm.me.uk (triton.njm.me.uk [192.168.144.133]) by meld.njm.me.uk (8.15.2/8.15.2) with ESMTP id xA6KeCeH047286; Wed, 6 Nov 2019 20:40:12 GMT (envelope-from njm@njm.me.uk) Received: from localhost (localhost [127.0.0.1]) by triton.njm.me.uk (8.15.2/8.15.2) with ESMTP id xA6KeC21076802; Wed, 6 Nov 2019 20:40:12 GMT (envelope-from njm@njm.me.uk) Date: Wed, 06 Nov 2019 20:40:12 +0000 From: "N.J. Mann" To: Ed Maste , svn-src-all@freebsd.org Subject: Re: svn commit: r354410 - in head/sys: dev/mgb modules/mgb Message-ID: In-Reply-To: <201911061951.xA6JpffX060159@repo.freebsd.org> References: <201911061951.xA6JpffX060159@repo.freebsd.org> X-Mailer: Mulberry/4.0.8 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Rspamd-Queue-Id: 477dhH294Fz4bwR X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of njm@njm.me.uk has no SPF policy when checking 85.119.248.222) smtp.mailfrom=njm@njm.me.uk X-Spamd-Result: default: False [0.46 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.71)[-0.712,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[njm.me.uk]; AUTH_NA(1.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_LONG(0.02)[0.016,0]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[222.248.119.85.list.dnswl.org : 127.0.3.1]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:35259, ipnet:85.119.248.0/21, country:GB]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(0.36)[ipnet: 85.119.248.0/21(1.03), asn: 35259(0.82), country: GB(-0.08)]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 20:40:16 -0000 Hi, I cannot comment on the code, but... On Wednesday, November 06, 2019 19:51:41 +0000 Ed Maste wrote: > Author: emaste > Date: Wed Nov 6 19:51:40 2019 > New Revision: 354410 > URL: https://svnweb.freebsd.org/changeset/base/354410 [...] > Added: head/sys/dev/mgb/if_mgb.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/mgb/if_mgb.c Wed Nov 6 19:51:40 2019 (r354410) > @@ -0,0 +1,1634 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2019 The FreeBSD Foundation, Inc. > + * > + * This driver was written by Gerald ND Aryeetey > + * 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. > + */ > +#include > +__FBSDID("$FreeBSD$"); > + > +/* > + * Microchip LAN7430/LAN7431 PCIe to Gigabit Ethernet Controller driver. > + * > + * Product information: > + * LAN7430 https://www.microchip.com/wwwproducts/en/LAN7430 > + * - Integrated IEEE 802.3 compliant PHY > + * LAN7431 https://www.microchip.com/wwwproducts/en/LAN7431 > + * - RGMII Interface > + * > + * This driver uses the iflib interface and the default 'ukphy' PHY driver. > + * > + * UNIMPLEMENTED FEATURES > + * ---------------------- > + * A number of features supported by LAN743X device are not yet implemented in > + * this driver: > + * > + * - Multiple (up to 4) RX queues support > + * - Just needs to remove asserts and malloc multiple `rx_ring_data` > + * structs based on ncpus. > + * - RX/TX Checksum Offloading support > + * - VLAN support > + * - Recieve Packet Filtering (Multicast Perfect/Hash Address) support ^^^^^^^ Should be Receive (and all the later ones). Cheers, Nick. -- From owner-svn-src-all@freebsd.org Wed Nov 6 20:43:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B1B61BFB65; Wed, 6 Nov 2019 20:43:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477dmD6Wylz4cJB; Wed, 6 Nov 2019 20:43:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C45452C18; Wed, 6 Nov 2019 20:43:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Khefh092200; Wed, 6 Nov 2019 20:43:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Khei1092198; Wed, 6 Nov 2019 20:43:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911062043.xA6Khei1092198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 6 Nov 2019 20:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354412 - head/sys/dev/mgb X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/mgb X-SVN-Commit-Revision: 354412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 20:43:41 -0000 Author: emaste Date: Wed Nov 6 20:43:40 2019 New Revision: 354412 URL: https://svnweb.freebsd.org/changeset/base/354412 Log: mgb: Correct spello - recieve -> receive Reported by: N. J. Mann MFC with: r354410 Modified: head/sys/dev/mgb/if_mgb.c head/sys/dev/mgb/if_mgb.h Modified: head/sys/dev/mgb/if_mgb.c ============================================================================== --- head/sys/dev/mgb/if_mgb.c Wed Nov 6 19:52:31 2019 (r354411) +++ head/sys/dev/mgb/if_mgb.c Wed Nov 6 20:43:40 2019 (r354412) @@ -51,10 +51,10 @@ __FBSDID("$FreeBSD$"); * structs based on ncpus. * - RX/TX Checksum Offloading support * - VLAN support - * - Recieve Packet Filtering (Multicast Perfect/Hash Address) support + * - Receive Packet Filtering (Multicast Perfect/Hash Address) support * - Wake on LAN (WoL) support * - TX LSO support - * - Recieve Side Scaling (RSS) support + * - Receive Side Scaling (RSS) support * - Debugging Capabilities: * - Could include MAC statistics and * error status registers in sysctl. Modified: head/sys/dev/mgb/if_mgb.h ============================================================================== --- head/sys/dev/mgb/if_mgb.h Wed Nov 6 19:52:31 2019 (r354411) +++ head/sys/dev/mgb/if_mgb.h Wed Nov 6 20:43:40 2019 (r354412) @@ -75,7 +75,7 @@ #define MGB_MAC_STAT_RX_FRAME_CNT 0x1254 /* etc. */ -/** Recieve Filtering Engine **/ +/** Receive Filtering Engine **/ #define MGB_RFE_CTL 0x508 #define MGB_RFE_ALLOW_BROADCAST (1 << 10) #define MGB_RFE_ALLOW_MULTICAST (1 << 9) From owner-svn-src-all@freebsd.org Wed Nov 6 20:44:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84D161BFBEB for ; Wed, 6 Nov 2019 20:44:25 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477dn45NwFz4cR3 for ; Wed, 6 Nov 2019 20:44:24 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id j13so12033102ioe.0 for ; Wed, 06 Nov 2019 12:44:24 -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=/40CaMiB7QvPRgIg1fovIhUtg9gGzdwgefQ2XLbP9pI=; b=j+Nq734reGzxDZ007lgF2jvuKYCBqOcCLQTp4wGVQa/Di+QdQVdC0mbN4XpteToXV3 2PvcQXyClpPwa7+fNy3HDx/qEQKxI7p06srfgc7cKcvsrDvCQ3Q41t1ZCM+JFvp0om/g ALT5YgiZ4r86zpJEDB2YornLmoM4aNurczUQf95RFnaThw60BP6nAfv8FpTmmUS1LQdB IR+MLARy3lkkCVXkKJS9onLNLjFh8DaJiyT7HWpi8Ava5wRnlPDurFKTp4vTdn7cY4NP i/qp57Vfq5wCCor9pEwaeRHaOfpMxCgSTxOHzLQUW7cyeBPValzsuU66uR9Pay+IerJ2 DycA== X-Gm-Message-State: APjAAAXVBOlq7DoqRrx3tGt9gfMbzl36FplM9TIX296jq8dSsqDP22rQ TfdzThOImef5FbCD+oOQuYlBhyPsBZT2DvqFK+stjQ== X-Google-Smtp-Source: APXvYqzbGqNKwkaC2mXQLUxjxzvCQDdcjVxaWViXQDb3fcPAIWD0LLuKG6u0ptIxXkrhINhyGeszeF6G22zDOVEVwqo= X-Received: by 2002:a02:b710:: with SMTP id g16mr8028645jam.111.1573073063505; Wed, 06 Nov 2019 12:44:23 -0800 (PST) MIME-Version: 1.0 References: <201911061951.xA6JpffX060159@repo.freebsd.org> In-Reply-To: From: Ed Maste Date: Wed, 6 Nov 2019 11:57:37 -0500 Message-ID: Subject: Re: svn commit: r354410 - in head/sys: dev/mgb modules/mgb To: "N.J. Mann" Cc: svn-src-all Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 477dn45NwFz4cR3 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.44 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.74 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; MIME_TRACE(0.00)[0:+]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[44.166.85.209.list.dnswl.org : 127.0.5.0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(-1.75)[ip: (-3.45), ipnet: 209.85.128.0/17(-3.21), asn: 15169(-2.01), country: US(-0.05)]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[44.166.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 20:44:25 -0000 On Wed, 6 Nov 2019 at 15:40, N.J. Mann wrote: > > Should be Receive (and all the later ones). Thanks, fixed in r354412 From owner-svn-src-all@freebsd.org Wed Nov 6 20:53:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A76D1BFF31; Wed, 6 Nov 2019 20:53:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477dzf2cyBz4cyX; Wed, 6 Nov 2019 20:53:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E8AC2DEF; Wed, 6 Nov 2019 20:53:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6KrYMt099029; Wed, 6 Nov 2019 20:53:34 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6KrXiQ099026; Wed, 6 Nov 2019 20:53:33 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911062053.xA6KrXiQ099026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 6 Nov 2019 20:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354413 - in head/sys: compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys: compat/linux i386/linux X-SVN-Commit-Revision: 354413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 20:53:34 -0000 Author: trasz Date: Wed Nov 6 20:53:33 2019 New Revision: 354413 URL: https://svnweb.freebsd.org/changeset/base/354413 Log: Make linux(4) create /dev/shm. Linux applications often expect a tmpfs to be mounted there, and because they like to verify it's actually a mountpoint, a symlink won't do. Reviewed by: dchagin (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20333 Modified: head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_common.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/compat/linux/linux.c ============================================================================== --- head/sys/compat/linux/linux.c Wed Nov 6 20:43:40 2019 (r354412) +++ head/sys/compat/linux/linux.c Wed Nov 6 20:53:33 2019 (r354413) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -129,6 +130,12 @@ static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = { SIGSYS /* LINUX_SIGSYS */ }; +static struct cdev *dev_shm_cdev; +static struct cdevsw dev_shm_cdevsw = { + .d_version = D_VERSION, + .d_name = "dev_shm", +}; + /* * Map Linux RT signals to the FreeBSD RT signals. */ @@ -523,4 +530,24 @@ linux_to_bsd_sockaddr(const struct l_sockaddr *osa, st out: free(kosa, M_SONAME); return (error); +} + +void +linux_dev_shm_create(void) +{ + int error; + + error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev_shm_cdev, + &dev_shm_cdevsw, NULL, UID_ROOT, GID_WHEEL, 0, "shm/.mountpoint"); + if (error != 0) { + printf("%s: failed to create device node, error %d\n", + __func__, error); + } +} + +void +linux_dev_shm_destroy(void) +{ + + destroy_dev(dev_shm_cdev); } Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Wed Nov 6 20:43:40 2019 (r354412) +++ head/sys/compat/linux/linux.h Wed Nov 6 20:53:33 2019 (r354413) @@ -143,4 +143,7 @@ int bsd_to_linux_signal(int sig); extern LIST_HEAD(futex_list, futex) futex_list; extern struct mtx futex_mtx; +void linux_dev_shm_create(void); +void linux_dev_shm_destroy(void); + #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_common.c ============================================================================== --- head/sys/compat/linux/linux_common.c Wed Nov 6 20:43:40 2019 (r354412) +++ head/sys/compat/linux/linux_common.c Wed Nov 6 20:53:33 2019 (r354413) @@ -68,6 +68,7 @@ linux_common_modevent(module_t mod, int type, void *da switch(type) { case MOD_LOAD: + linux_dev_shm_create(); linux_osd_jail_register(); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, NULL, 1000); @@ -81,6 +82,7 @@ linux_common_modevent(module_t mod, int type, void *da mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); break; case MOD_UNLOAD: + linux_dev_shm_destroy(); linux_osd_jail_deregister(); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Wed Nov 6 20:43:40 2019 (r354412) +++ head/sys/i386/linux/linux_sysvec.c Wed Nov 6 20:53:33 2019 (r354413) @@ -1006,6 +1006,7 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_get_machine(&linux_kplatform); linux_szplatform = roundup(strlen(linux_kplatform) + 1, sizeof(char *)); + linux_dev_shm_create(); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) @@ -1031,6 +1032,7 @@ linux_elf_modevent(module_t mod, int type, void *data) EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); + linux_dev_shm_destroy(); linux_osd_jail_deregister(); if (bootverbose) printf("Linux ELF exec handler removed\n"); From owner-svn-src-all@freebsd.org Wed Nov 6 21:04:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B51391782CF; Wed, 6 Nov 2019 21:04:02 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477fCk4Qt0z4dYJ; Wed, 6 Nov 2019 21:04:02 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A57E2FF4; Wed, 6 Nov 2019 21:04:02 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6L42Dr005080; Wed, 6 Nov 2019 21:04:02 GMT (envelope-from rene@FreeBSD.org) Received: (from rene@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6L42kW005079; Wed, 6 Nov 2019 21:04:02 GMT (envelope-from rene@FreeBSD.org) Message-Id: <201911062104.xA6L42kW005079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rene set sender to rene@FreeBSD.org using -f From: Rene Ladan Date: Wed, 6 Nov 2019 21:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r354414 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: rene X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 354414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 21:04:02 -0000 Author: rene (doc,ports committer) Date: Wed Nov 6 21:04:02 2019 New Revision: 354414 URL: https://svnweb.freebsd.org/changeset/base/354414 Log: Sort access file correctly to prevent false alarms. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Wed Nov 6 20:53:33 2019 (r354413) +++ svnadmin/conf/access Wed Nov 6 21:04:02 2019 (r354414) @@ -35,8 +35,8 @@ avatar avg avos bapt -bde bcran +bde bdragon bdrewery benno @@ -48,8 +48,8 @@ bryanv bwidawsk bz cem -chuck chs +chuck cognet cperciva cracauer From owner-svn-src-all@freebsd.org Wed Nov 6 21:13:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682FF178877; Wed, 6 Nov 2019 21:13:11 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477fQH27RBz4f6L; Wed, 6 Nov 2019 21:13:11 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1487531B0; Wed, 6 Nov 2019 21:13:11 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6LDA5a011048; Wed, 6 Nov 2019 21:13:10 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6LDAEw011047; Wed, 6 Nov 2019 21:13:10 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911062113.xA6LDAEw011047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Wed, 6 Nov 2019 21:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354415 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 354415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 21:13:11 -0000 Author: tsoome Date: Wed Nov 6 21:13:10 2019 New Revision: 354415 URL: https://svnweb.freebsd.org/changeset/base/354415 Log: loader.efi: HARDDRIVE_DEVICE_PATH may have subpaths The macos does create Vendor Media devices on top of APFS container (like partition table inside the partition), so we need to collect such devices into respective device tree. MFC after: 1 week Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Wed Nov 6 21:04:02 2019 (r354414) +++ head/stand/efi/libefi/efipart.c Wed Nov 6 21:13:10 2019 (r354415) @@ -313,11 +313,14 @@ efipart_floppy(EFI_DEVICE_PATH *node) static pdinfo_t * efipart_find_parent(pdinfo_list_t *pdi, EFI_DEVICE_PATH *devpath) { - pdinfo_t *pd; + pdinfo_t *pd, *part; STAILQ_FOREACH(pd, pdi, pd_link) { if (efi_devpath_is_prefix(pd->pd_devpath, devpath)) return (pd); + part = efipart_find_parent(&pd->pd_part, devpath); + if (part != NULL) + return (part); } return (NULL); } @@ -500,22 +503,44 @@ efipart_initcd(void) return (0); } -static void -efipart_hdinfo_add(pdinfo_t *hd, HARDDRIVE_DEVICE_PATH *node) +static bool +efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH *node) { pdinfo_t *pd, *last; + VENDOR_DEVICE_PATH *ven_node; STAILQ_FOREACH(pd, &hdinfo, pd_link) { - if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) { - /* Add the partition. */ - hd->pd_unit = node->PartitionNumber; - hd->pd_parent = pd; - hd->pd_devsw = &efipart_hddev; - STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); - return; - } + if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) + break; } + if (pd == NULL) + return (false); + /* Add the partition. */ + if (DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { + hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; + } else { + last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (last != NULL) + hd->pd_unit = last->pd_unit + 1; + else + hd->pd_unit = 0; + } + hd->pd_parent = pd; + hd->pd_devsw = &efipart_hddev; + + STAILQ_INSERT_TAIL(&pd->pd_part, hd, pd_link); + return (true); +} + +static void +efipart_hdinfo_add(pdinfo_t *hd, EFI_DEVICE_PATH *node) +{ + pdinfo_t *pd, *last; + + if (efipart_hdinfo_add_node(hd, node)) + return; + last = STAILQ_LAST(&hdinfo, pdinfo, pd_link); if (last != NULL) hd->pd_unit = last->pd_unit + 1; @@ -677,7 +702,7 @@ restart: efipart_hdinfo_add(parent, NULL); } - efipart_hdinfo_add(hd, (HARDDRIVE_DEVICE_PATH *)node); + efipart_hdinfo_add(hd, node); goto restart; } } From owner-svn-src-all@freebsd.org Wed Nov 6 22:40:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20E1717A5C0; Wed, 6 Nov 2019 22:40:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477hLq723dz3F44; Wed, 6 Nov 2019 22:40:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D066842A4; Wed, 6 Nov 2019 22:40:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6MeJEr059082; Wed, 6 Nov 2019 22:40:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6MeJL6059081; Wed, 6 Nov 2019 22:40:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911062240.xA6MeJL6059081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 6 Nov 2019 22:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354416 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 22:40:20 -0000 Author: bz Date: Wed Nov 6 22:40:19 2019 New Revision: 354416 URL: https://svnweb.freebsd.org/changeset/base/354416 Log: m_pulldown(): Change an if () panic() into a KASSERT(). If we pass in a NULL mbuf to m_pulldown() we are in a bad situation already. There is no point in doing that check for production code. Change the if () panic() into a KASSERT. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/kern/uipc_mbuf2.c Modified: head/sys/kern/uipc_mbuf2.c ============================================================================== --- head/sys/kern/uipc_mbuf2.c Wed Nov 6 21:13:10 2019 (r354415) +++ head/sys/kern/uipc_mbuf2.c Wed Nov 6 22:40:19 2019 (r354416) @@ -101,8 +101,8 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp int writable; /* check invalid arguments. */ - if (m == NULL) - panic("m == NULL in m_pulldown()"); + KASSERT(m != NULL, ("%s: fix caller: m is NULL off %d len %d offp %p\n", + __func__, off, len, offp)); if (len > MCLBYTES) { m_freem(m); return NULL; /* impossible */ From owner-svn-src-all@freebsd.org Wed Nov 6 23:40:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11CA717BD66; Wed, 6 Nov 2019 23:40:10 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477jgs6mD3z3HjB; Wed, 6 Nov 2019 23:40:09 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C73184D80; Wed, 6 Nov 2019 23:40:09 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Ne9d5093756; Wed, 6 Nov 2019 23:40:09 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Ne999093755; Wed, 6 Nov 2019 23:40:09 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201911062340.xA6Ne999093755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Wed, 6 Nov 2019 23:40:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354417 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 354417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 23:40:10 -0000 Author: sevan (doc committer) Date: Wed Nov 6 23:40:09 2019 New Revision: 354417 URL: https://svnweb.freebsd.org/changeset/base/354417 Log: Add FreeBSD 11.3 Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Wed Nov 6 22:40:19 2019 (r354416) +++ head/share/misc/bsd-family-tree Wed Nov 6 23:40:09 2019 (r354417) @@ -388,18 +388,20 @@ FreeBSD 5.2 | | | | | | | | | | DragonFly 5.2.2 | FreeBSD | | | *--NetBSD | | | 11.2 | | | 7.2 | | - | macOS | | | | | - | 10.14 | | | OpenBSD 6.4 | - | | | | | | | - | | | | | | DragonFly 5.4.0 - *--FreeBSD | | | v | | - | 12.0 | | | | DragonFly 5.4.1 - | | | | | OpenBSD 6.5 | - | | | | | | | - | | | | NetBSD | | - | | | | 8.1 | DragonFly 5.6 - | | | | | | - | | | | | DragonFly 5.6.1 + | | macOS | | | | | + | | 10.14 | | | OpenBSD 6.4 | + | | | | | | | | + | | | | | | | DragonFly 5.4.0 + *--FreeBSD | | | | v | | + | 12.0 | | | | | DragonFly 5.4.1 + | | | | | | OpenBSD 6.5 | + | | | | | | | | + | | | | | NetBSD | | + | | | | | 8.1 | DragonFly 5.6 + | | | | | | | + | | | | | | DragonFly 5.6.1 + | | FreeBSD | | | | + | | 11.3 | | | | | FreeBSD | | OpenBSD 6.6 | | 12.1 | | | | | | | | | | @@ -790,6 +792,7 @@ OpenBSD 6.5 2019-05-01 [OBD] NetBSD 8.1 2019-06-04 [NBD] DragonFly 5.6 2019-06-17 [DFB] DragonFly 5.6.1 2019-06-19 [DFB] +FreeBSD 11.3 2019-07-09 [FBD] OpenBSD 6.6 2019-10-17 [OBD] FreeBSD 12.1 2019-11-04 [FBD] From owner-svn-src-all@freebsd.org Wed Nov 6 23:44:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3261217C160; Wed, 6 Nov 2019 23:44:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477jn30bBhz3JD4; Wed, 6 Nov 2019 23:44:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7FBE4F4B; Wed, 6 Nov 2019 23:44:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6NicgU099658; Wed, 6 Nov 2019 23:44:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6NicLE099656; Wed, 6 Nov 2019 23:44:38 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911062344.xA6NicLE099656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 6 Nov 2019 23:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354418 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Driver/ToolChains X-SVN-Commit-Revision: 354418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 23:44:39 -0000 Author: cem Date: Wed Nov 6 23:44:38 2019 New Revision: 354418 URL: https://svnweb.freebsd.org/changeset/base/354418 Log: clang: Enable unwind tables on !amd64 There doesn't seem to be much sense in defaulting "on" unwind tables on amd64 and not on other arches. It causes surprising differences between platforms, such as the PR below. Prior to this change, FreeBSD inherited the default implementation of the method from the Gnu.h Generic_Elf => Generic_GCC parent class, which returned true only for amd64 targets. Override that and opt on always, similar to, e.g., NetBSD. PR: 241562 Reported by: lwhsu Reviewed by: dim Discussed with: emaste MFC after: I'm not going to, but you should feel free Relnotes: yes Differential Revision: https://reviews.freebsd.org/D22252 Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp Wed Nov 6 23:40:09 2019 (r354417) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp Wed Nov 6 23:44:38 2019 (r354418) @@ -409,6 +409,8 @@ llvm::ExceptionHandling FreeBSD::GetExceptionModel(con bool FreeBSD::HasNativeLLVMSupport() const { return true; } +bool FreeBSD::IsUnwindTablesDefault(const ArgList &Args) const { return true; } + bool FreeBSD::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } SanitizerMask FreeBSD::getSupportedSanitizers() const { Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h Wed Nov 6 23:40:09 2019 (r354417) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.h Wed Nov 6 23:44:38 2019 (r354418) @@ -67,6 +67,7 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic llvm::ExceptionHandling GetExceptionModel( const llvm::opt::ArgList &Args) const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPIEDefault() const override; SanitizerMask getSupportedSanitizers() const override; unsigned GetDefaultDwarfVersion() const override; From owner-svn-src-all@freebsd.org Wed Nov 6 23:45:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E54BD17C21A; Wed, 6 Nov 2019 23:45:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477jpH5lMgz3JMF; Wed, 6 Nov 2019 23:45:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9049C4F56; Wed, 6 Nov 2019 23:45:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA6Njhh3099775; Wed, 6 Nov 2019 23:45:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA6Njh9i099774; Wed, 6 Nov 2019 23:45:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911062345.xA6Njh9i099774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 6 Nov 2019 23:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354419 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2019 23:45:44 -0000 Author: glebius Date: Wed Nov 6 23:45:43 2019 New Revision: 354419 URL: https://svnweb.freebsd.org/changeset/base/354419 Log: If vm_pager_get_pages_async() returns an error synchronously we leak wired and busy pages. Add code that would carefully cleanups the state in case of synchronous error return. Cover a case when a first I/O went on asynchronously, but second or N-th returned error synchronously. In collaboration with: chs Reviewed by: jtl, kib Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Wed Nov 6 23:44:38 2019 (r354418) +++ head/sys/kern/kern_sendfile.c Wed Nov 6 23:45:43 2019 (r354419) @@ -269,6 +269,16 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i if (!refcount_release(&sfio->nios)) return; + if (__predict_false(sfio->error && sfio->m == NULL)) { + /* + * I/O operation failed, but pru_send hadn't been executed - + * nothing had been sent to the socket. The syscall has + * returned error to the user. + */ + free(sfio, M_TEMP); + return; + } + #if defined(KERN_TLS) && defined(INVARIANTS) if ((sfio->m->m_flags & M_EXT) != 0 && sfio->m->m_ext.ext_type == EXT_PGS) @@ -279,7 +289,7 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i ("non-ext_pgs mbuf with TLS session")); #endif CURVNET_SET(so->so_vnet); - if (sfio->error) { + if (__predict_false(sfio->error)) { /* * I/O operation failed. The state of data in the socket * is now inconsistent, and all what we can do is to tear @@ -414,10 +424,25 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, i rv = vm_pager_get_pages_async(obj, pa + i, count, NULL, i + count == npages ? &rhpages : NULL, &sendfile_iodone, sfio); - if (rv != VM_PAGER_OK) { - for (j = i; j < i + count; j++) { - if (pa[j] != bogus_page) - vm_page_unwire(pa[j], PQ_INACTIVE); + if (__predict_false(rv != VM_PAGER_OK)) { + /* + * Perform full pages recovery before returning EIO. + * Pages from 0 to npages are wired. + * Pages from i to npages are also busied. + * Pages from (i + 1) to (i + count - 1) may be + * substituted to bogus page, and not busied. + */ + for (j = 0; j < npages; j++) { + if (j > i && j < i + count - 1 && + pa[j] == bogus_page) + pa[j] = vm_page_lookup(obj, + OFF_TO_IDX(vmoff(j, off))); + else if (j >= i) + vm_page_xunbusy(pa[j]); + KASSERT(pa[j] != NULL && pa[j] != bogus_page, + ("%s: page %p[%d] I/O recovery failure", + __func__, pa, j)); + vm_page_unwire(pa[j], PQ_INACTIVE); } VM_OBJECT_WUNLOCK(obj); return (EIO); @@ -806,7 +831,8 @@ retry_space: if (error != 0) { if (vp != NULL) VOP_UNLOCK(vp, 0); - free(sfio, M_TEMP); + sfio->m = NULL; + sendfile_iodone(sfio, NULL, 0, error); goto done; } From owner-svn-src-all@freebsd.org Thu Nov 7 00:07:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59A6317D0C0; Thu, 7 Nov 2019 00:07:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477kHv1fC3z3KTt; Thu, 7 Nov 2019 00:07:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14D3352E9; Thu, 7 Nov 2019 00:07:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA707sNF011845; Thu, 7 Nov 2019 00:07:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA707sUx011844; Thu, 7 Nov 2019 00:07:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911070007.xA707sUx011844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 00:07:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354420 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:07:55 -0000 Author: brooks Date: Thu Nov 7 00:07:54 2019 New Revision: 354420 URL: https://svnweb.freebsd.org/changeset/base/354420 Log: Fix the alignment of struct xunpcb on systems with >64-bit pointers. Reviewed by: emaste Obtained from: CheriBSD MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22268 Modified: head/sys/sys/unpcb.h Modified: head/sys/sys/unpcb.h ============================================================================== --- head/sys/sys/unpcb.h Wed Nov 6 23:45:43 2019 (r354419) +++ head/sys/sys/unpcb.h Thu Nov 7 00:07:54 2019 (r354420) @@ -156,7 +156,7 @@ struct xunpcb { char xu_dummy2[256]; }; struct xsocket xu_socket; -} __aligned(8); +} __aligned(MAX(8, sizeof(void *))); struct xunpgen { ksize_t xug_len; From owner-svn-src-all@freebsd.org Thu Nov 7 00:08:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F0EE17D152; Thu, 7 Nov 2019 00:08:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477kJj1QNpz3Kck; Thu, 7 Nov 2019 00:08:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E86952EE; Thu, 7 Nov 2019 00:08:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA708aLM011948; Thu, 7 Nov 2019 00:08:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA708YeB011934; Thu, 7 Nov 2019 00:08:34 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911070008.xA708YeB011934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 00:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354421 - in head/sys: dev/cxgbe/cxgbei dev/cxgbe/tom kern netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: dev/cxgbe/cxgbei dev/cxgbe/tom kern netinet X-SVN-Commit-Revision: 354421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:08:37 -0000 Author: glebius Date: Thu Nov 7 00:08:34 2019 New Revision: 354421 URL: https://svnweb.freebsd.org/changeset/base/354421 Log: Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER(). Remove few outdated comments and extraneous assertions. No functional change here. Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/kern/uipc_ktls.c head/sys/netinet/in_pcb.c head/sys/netinet/tcp_lro.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/toecore.c Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c ============================================================================== --- head/sys/dev/cxgbe/cxgbei/cxgbei.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/dev/cxgbe/cxgbei/cxgbei.c Thu Nov 7 00:08:34 2019 (r354421) @@ -412,12 +412,12 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_he SOCKBUF_UNLOCK(sb); INP_WUNLOCK(inp); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); tp = tcp_drop(tp, ECONNRESET); if (tp) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); icl_cxgbei_conn_pdu_free(NULL, ip); #ifdef INVARIANTS Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/dev/cxgbe/tom/t4_connect.c Thu Nov 7 00:08:34 2019 (r354421) @@ -124,12 +124,12 @@ act_open_failure_cleanup(struct adapter *sc, u_int ati CURVNET_SET(toep->vnet); if (status != EAGAIN) - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); toe_connect_failed(tod, inp, status); final_cpl_received(toep); /* unlocks inp */ if (status != EAGAIN) - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 7 00:08:34 2019 (r354421) @@ -1214,7 +1214,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); CURVNET_SET(toep->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1260,7 +1260,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head case TCPS_FIN_WAIT_2: tcp_twstart(tp); INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); INP_WLOCK(inp); @@ -1273,7 +1273,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head } done: INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); } @@ -1303,7 +1303,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_h KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); CURVNET_SET(toep->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1321,7 +1321,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_h tcp_twstart(tp); release: INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); INP_WLOCK(inp); @@ -1346,7 +1346,7 @@ release: } done: INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); } @@ -1423,7 +1423,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_heade inp = toep->inp; CURVNET_SET(toep->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); /* for tcp_close */ + NET_EPOCH_ENTER(et); /* for tcp_close */ INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1457,7 +1457,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_heade final_cpl_received(toep); done: - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); send_abort_rpl(sc, ofld_txq, tid, CPL_ABORT_NO_RST); return (0); @@ -1572,12 +1572,12 @@ do_rx_data(struct sge_iq *iq, const struct rss_header INP_WUNLOCK(inp); CURVNET_SET(toep->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); tp = tcp_drop(tp, ECONNRESET); if (tp) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 7 00:08:34 2019 (r354421) @@ -949,7 +949,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struc #endif struct toepcb *toep = synqe->toep; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* prevents bad race with accept() */ + NET_EPOCH_ASSERT(); /* prevents bad race with accept() */ INP_WLOCK_ASSERT(inp); KASSERT(synqe->flags & TPF_SYNQE, ("%s: %p not a synq_entry?", __func__, arg)); @@ -1242,12 +1242,12 @@ found: REJECT_PASS_ACCEPT_REQ(true); /* Don't offload if the 4-tuple is already in use */ - INP_INFO_RLOCK_ET(&V_tcbinfo, et); /* for 4-tuple check */ + NET_EPOCH_ENTER(et); /* for 4-tuple check */ if (toe_4tuple_check(&inc, &th, ifp) != 0) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); REJECT_PASS_ACCEPT_REQ(false); } - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); inp = lctx->inp; /* listening socket, not owned by TOE */ INP_WLOCK(inp); @@ -1396,7 +1396,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_ ("%s: tid %u (ctx %p) not a synqe", __func__, tid, synqe)); CURVNET_SET(lctx->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); /* for syncache_expand */ + NET_EPOCH_ENTER(et); /* for syncache_expand */ INP_WLOCK(inp); CTR6(KTR_CXGBE, @@ -1412,7 +1412,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_ reset: send_reset_synqe(TOEDEV(ifp), synqe); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); } @@ -1471,7 +1471,7 @@ reset: inp = release_synqe(sc, synqe); if (inp != NULL) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/dev/cxgbe/tom/t4_tls.c Thu Nov 7 00:08:34 2019 (r354421) @@ -2125,12 +2125,12 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head INP_WUNLOCK(inp); CURVNET_SET(toep->vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); tp = tcp_drop(tp, ECONNRESET); if (tp) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return (0); Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/kern/uipc_ktls.c Thu Nov 7 00:08:34 2019 (r354421) @@ -1137,7 +1137,7 @@ ktls_reset_send_tag(void *context, int pending) * the send tag is fixed or just rely on timers? */ } else { - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); if (!in_pcbrele_wlocked(inp)) { if (!(inp->inp_flags & INP_TIMEWAIT) && @@ -1150,7 +1150,7 @@ ktls_reset_send_tag(void *context, int pending) } else INP_WUNLOCK(inp); } - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); counter_u64_add(ktls_ifnet_reset_failed, 1); Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/netinet/in_pcb.c Thu Nov 7 00:08:34 2019 (r354421) @@ -515,7 +515,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbin #ifdef INVARIANTS if (pcbinfo == &V_tcbinfo) { - INP_INFO_RLOCK_ASSERT(pcbinfo); + NET_EPOCH_ASSERT(); } else { INP_INFO_WLOCK_ASSERT(pcbinfo); } @@ -2657,7 +2657,7 @@ in_pcbremlists(struct inpcb *inp) #ifdef INVARIANTS if (pcbinfo == &V_tcbinfo) { - INP_INFO_RLOCK_ASSERT(pcbinfo); + NET_EPOCH_ASSERT(); } else { INP_INFO_WLOCK_ASSERT(pcbinfo); } Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/netinet/tcp_lro.c Thu Nov 7 00:08:34 2019 (r354421) @@ -884,7 +884,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *l */ if ((tcplro_stacks_wanting_mbufq == 0) || (le->m_head->m_flags & M_VLANTAG)) goto skip_lookup; - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); switch (le->eh_type) { #ifdef INET6 case ETHERTYPE_IPV6: @@ -903,7 +903,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *l break; #endif } - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); if (inp && ((inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) || (inp->inp_flags2 & INP_FREED))) { /* We don't want this guy */ Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/netinet/tcp_subr.c Thu Nov 7 00:08:34 2019 (r354421) @@ -1941,7 +1941,7 @@ tcp_timer_discard(void *ptp) tp = (struct tcpcb *)ptp; CURVNET_SET(tp->t_vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); inp = tp->t_inpcb; KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp)); @@ -1961,13 +1961,13 @@ tcp_timer_discard(void *ptp) tp->t_inpcb = NULL; uma_zfree(V_tcpcb_zone, tp); if (in_pcbrele_wlocked(inp)) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); return; } } INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } @@ -2770,7 +2770,7 @@ tcp_drop_syn_sent(struct inpcb *inp, int errno) { struct tcpcb *tp; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); if ((inp->inp_flags & INP_TIMEWAIT) || @@ -3042,7 +3042,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) default: return (EINVAL); } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); switch (addrs[0].ss_family) { #ifdef INET6 case AF_INET6: @@ -3081,7 +3081,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) INP_WUNLOCK(inp); } else error = ESRCH; - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); return (error); } @@ -3157,7 +3157,7 @@ sysctl_switch_tls(SYSCTL_HANDLER_ARGS) default: return (EINVAL); } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); switch (addrs[0].ss_family) { #ifdef INET6 case AF_INET6: @@ -3173,7 +3173,7 @@ sysctl_switch_tls(SYSCTL_HANDLER_ARGS) break; #endif } - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); if (inp != NULL) { if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) != 0 || inp->inp_socket == NULL) { Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/netinet/tcp_syncache.c Thu Nov 7 00:08:34 2019 (r354421) @@ -771,7 +771,7 @@ syncache_socket(struct syncache *sc, struct socket *ls int error; char *s; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); /* * Ok, create the full blown connection, and set things up @@ -1091,11 +1091,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt char *s; bool locked; - /* - * Global TCP locks are held because we manipulate the PCB lists - * and create a new socket. - */ - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); KASSERT((th->th_flags & (TH_RST|TH_ACK|TH_SYN)) == TH_ACK, ("%s: can handle only ACK", __func__)); @@ -1331,11 +1327,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket struct tcpcb *tp; unsigned int *pending_counter; - /* - * Global TCP locks are held because we manipulate the PCB lists - * and create a new socket. - */ - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); pending_counter = intotcpcb(sotoinpcb(*lsop))->t_tfo_pending; *lsop = syncache_socket(sc, *lsop, m); Modified: head/sys/netinet/toecore.c ============================================================================== --- head/sys/netinet/toecore.c Thu Nov 7 00:07:54 2019 (r354420) +++ head/sys/netinet/toecore.c Thu Nov 7 00:08:34 2019 (r354421) @@ -360,7 +360,7 @@ toe_syncache_expand(struct in_conninfo *inc, struct tc struct tcphdr *th, struct socket **lsop) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); return (syncache_expand(inc, to, th, lsop, NULL)); } @@ -390,8 +390,6 @@ toe_4tuple_check(struct in_conninfo *inc, struct tcphd INP_WLOCK_ASSERT(inp); if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) { - - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* for twcheck */ if (!tcp_twcheck(inp, NULL, th, NULL, 0)) return (EADDRINUSE); } else { @@ -529,7 +527,7 @@ toe_connect_failed(struct toedev *tod, struct inpcb *i (void) tp->t_fb->tfb_tcp_output(tp); } else { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); tp = tcp_drop(tp, err); if (tp == NULL) INP_WLOCK(inp); /* re-acquire */ From owner-svn-src-all@freebsd.org Thu Nov 7 00:10:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2411717D279; Thu, 7 Nov 2019 00:10:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477kLb07jkz3Kms; Thu, 7 Nov 2019 00:10:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D769E52F3; Thu, 7 Nov 2019 00:10:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA70AEaQ012133; Thu, 7 Nov 2019 00:10:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA70AES8012132; Thu, 7 Nov 2019 00:10:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911070010.xA70AES8012132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 00:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354422 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:10:15 -0000 Author: glebius Date: Thu Nov 7 00:10:14 2019 New Revision: 354422 URL: https://svnweb.freebsd.org/changeset/base/354422 Log: Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP functions that are executed in syscall context. No functional change here. Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Nov 7 00:08:34 2019 (r354421) +++ head/sys/netinet/tcp_usrreq.c Thu Nov 7 00:10:14 2019 (r354422) @@ -283,7 +283,7 @@ tcp_usr_detach(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_detach: inp == NULL")); if (!INP_INFO_WLOCKED(&V_tcbinfo)) { - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); rlock = 1; } INP_WLOCK(inp); @@ -291,7 +291,7 @@ tcp_usr_detach(struct socket *so) ("tcp_usr_detach: inp_socket == NULL")); tcp_detach(so, inp); if (rlock) - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); } #ifdef INET @@ -706,7 +706,7 @@ tcp_usr_disconnect(struct socket *so) int error = 0; TCPDEBUG0; - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL")); INP_WLOCK(inp); @@ -723,7 +723,7 @@ out: TCPDEBUG2(PRU_DISCONNECT); TCP_PROBE2(debug__user, tp, PRU_DISCONNECT); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); return (error); } @@ -792,7 +792,7 @@ tcp6_usr_accept(struct socket *so, struct sockaddr **n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL")); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = ECONNABORTED; @@ -819,7 +819,7 @@ out: TCPDEBUG2(PRU_ACCEPT); TCP_PROBE2(debug__user, tp, PRU_ACCEPT); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); if (error == 0) { if (v4) *nam = in6_v4mapsin6_sockaddr(port, &addr); @@ -842,7 +842,7 @@ tcp_usr_shutdown(struct socket *so) struct epoch_tracker et; TCPDEBUG0; - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); inp = sotoinpcb(so); KASSERT(inp != NULL, ("inp == NULL")); INP_WLOCK(inp); @@ -861,7 +861,7 @@ out: TCPDEBUG2(PRU_SHUTDOWN); TCP_PROBE2(debug__user, tp, PRU_SHUTDOWN); INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); return (error); } @@ -921,10 +921,10 @@ static int tcp_usr_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td) { + struct epoch_tracker et; int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; - struct epoch_tracker net_et; #ifdef INET #ifdef INET6 struct sockaddr_in sin; @@ -940,11 +940,11 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf TCPDEBUG0; /* - * We require the pcbinfo lock if we will close the socket as part of - * this call. + * We require the pcbinfo "read lock" if we will close the socket + * as part of this call. */ if (flags & PRUS_EOF) - INP_INFO_RLOCK_ET(&V_tcbinfo, net_et); + NET_EPOCH_ENTER(et); inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); @@ -1135,7 +1135,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf * Close the send side of the connection after * the data is sent. */ - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); socantsendmore(so); tcp_usrclosed(tp); } @@ -1231,7 +1231,7 @@ out: ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); INP_WUNLOCK(inp); if (flags & PRUS_EOF) - INP_INFO_RUNLOCK_ET(&V_tcbinfo, net_et); + NET_EPOCH_EXIT(et); return (error); } @@ -1275,7 +1275,7 @@ tcp_usr_abort(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_abort: inp == NULL")); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); KASSERT(inp->inp_socket != NULL, ("tcp_usr_abort: inp_socket == NULL")); @@ -1301,7 +1301,7 @@ tcp_usr_abort(struct socket *so) } INP_WUNLOCK(inp); dropped: - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); } /* @@ -1318,7 +1318,7 @@ tcp_usr_close(struct socket *so) inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL")); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); INP_WLOCK(inp); KASSERT(inp->inp_socket != NULL, ("tcp_usr_close: inp_socket == NULL")); @@ -1342,7 +1342,7 @@ tcp_usr_close(struct socket *so) inp->inp_flags |= INP_SOCKREF; } INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); } /* @@ -2317,10 +2317,10 @@ tcp_attach(struct socket *so) } so->so_rcv.sb_flags |= SB_AUTOSIZE; so->so_snd.sb_flags |= SB_AUTOSIZE; - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); error = in_pcballoc(so, &V_tcbinfo); if (error) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); return (error); } inp = sotoinpcb(so); @@ -2338,12 +2338,12 @@ tcp_attach(struct socket *so) if (tp == NULL) { in_pcbdetach(inp); in_pcbfree(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); return (ENOBUFS); } tp->t_state = TCPS_CLOSED; INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); TCPSTATES_INC(TCPS_CLOSED); return (0); } @@ -2362,7 +2362,7 @@ tcp_disconnect(struct tcpcb *tp) struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); /* @@ -2401,7 +2401,7 @@ static void tcp_usrclosed(struct tcpcb *tp) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(tp->t_inpcb); switch (tp->t_state) { From owner-svn-src-all@freebsd.org Thu Nov 7 00:14:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBBF517D633; Thu, 7 Nov 2019 00:14:26 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 477kRQ5NYKz3LJ1; Thu, 7 Nov 2019 00:14:26 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (c-73-225-95-104.hsd1.wa.comcast.net [73.225.95.104]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id xA70EMe8083790 (version=TLSv1.2 cipher=AES128-SHA bits=128 verify=NO); Wed, 6 Nov 2019 16:14:24 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r354393 - stable/10 To: Warner Losh , Glen Barber Cc: "Rodney W. Grimes" , Warner Losh , src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org, FreeBSD Release Engineering Team References: <201911061434.xA6EYFBF058593@repo.freebsd.org> <201911061706.xA6H6OSW010908@gndrsh.dnsmgr.net> <20191106172315.GI1424@FreeBSD.org> From: Julian Elischer Message-ID: Date: Wed, 6 Nov 2019 16:14:14 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Rspamd-Queue-Id: 477kRQ5NYKz3LJ1 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.93 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.93)[-0.931,0]; ASN(0.00)[asn:36236, ipnet:204.109.60.0/22, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:14:26 -0000 On 11/6/19 9:29 AM, Warner Losh wrote: > > > On Wed, Nov 6, 2019 at 10:23 AM Glen Barber > wrote: > > On Wed, Nov 06, 2019 at 09:06:24AM -0800, Rodney W. Grimes wrote: > > > Author: imp > > > Date: Wed Nov  6 14:34:14 2019 > > > New Revision: 354393 > > > URL: https://svnweb.freebsd.org/changeset/base/354393 > > > > > > Log: > > >   Replace current with stable/10 > > > > > >   Direct commit because not relevant to other branches > > > > Glen, > > > > Would you add this to the list of RE@ things to do when a > > new branch is created? > > > That's a great idea... Thanks Rod. > > It is in the document already, but I still somehow missed it. > > > There's a lot on this list, so that's understandable... > > Maybe it's something we should enshrine in a shell script? > > Warner I am a tremendous believer of such scripts. Firstly it can save time, but more importantly it embodies learned procedures and is authoritative. If a shell script worked prviously and doesn't work now, you know something changed. From owner-svn-src-all@freebsd.org Thu Nov 7 00:27:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7D7F17DD56; Thu, 7 Nov 2019 00:27:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477kkN3y1Cz3M3p; Thu, 7 Nov 2019 00:27:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 669BA56B0; Thu, 7 Nov 2019 00:27:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA70RO6A023827; Thu, 7 Nov 2019 00:27:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA70RO5O023826; Thu, 7 Nov 2019 00:27:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911070027.xA70RO5O023826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 00:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354423 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:27:24 -0000 Author: glebius Date: Thu Nov 7 00:27:23 2019 New Revision: 354423 URL: https://svnweb.freebsd.org/changeset/base/354423 Log: TCP timers are executed in callout context, so they need to enter network epoch to look into PCB lists. Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER(). No functional change here. Modified: head/sys/netinet/tcp_timer.c Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Thu Nov 7 00:10:14 2019 (r354422) +++ head/sys/netinet/tcp_timer.c Thu Nov 7 00:27:23 2019 (r354423) @@ -339,9 +339,9 @@ tcp_timer_2msl(void *xtp) tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_close(tp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); goto out; } else { @@ -353,9 +353,9 @@ tcp_timer_2msl(void *xtp) tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_close(tp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); goto out; } @@ -478,7 +478,7 @@ dropit: tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_drop(tp, ETIMEDOUT); #ifdef TCPDEBUG @@ -487,7 +487,7 @@ dropit: PRU_SLOWTIMO); #endif TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); out: CURVNET_RESTORE(); @@ -542,9 +542,9 @@ tcp_timer_persist(void *xtp) tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_drop(tp, ETIMEDOUT); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); goto out; } @@ -559,9 +559,9 @@ tcp_timer_persist(void *xtp) tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_drop(tp, ETIMEDOUT); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); goto out; } @@ -628,9 +628,9 @@ tcp_timer_rexmt(void * xtp) tcp_inpinfo_lock_del(inp, tp); goto out; } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); tp = tcp_drop(tp, ETIMEDOUT); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); tcp_inpinfo_lock_del(inp, tp); goto out; } From owner-svn-src-all@freebsd.org Thu Nov 7 00:28:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C281617DDFB; Thu, 7 Nov 2019 00:28:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477km24lQcz3MBQ; Thu, 7 Nov 2019 00:28:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 860BF56B1; Thu, 7 Nov 2019 00:28:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA70SoSG023940; Thu, 7 Nov 2019 00:28:50 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA70So0i023939; Thu, 7 Nov 2019 00:28:50 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911070028.xA70So0i023939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 00:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354424 - stable/12/sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: stable/12/sys/netgraph X-SVN-Commit-Revision: 354424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 00:28:50 -0000 Author: glebius Date: Thu Nov 7 00:28:50 2019 New Revision: 354424 URL: https://svnweb.freebsd.org/changeset/base/354424 Log: Merge r353027: Protect access to seq->xwin[] with the seq mutex. Modified: stable/12/sys/netgraph/ng_l2tp.c Modified: stable/12/sys/netgraph/ng_l2tp.c ============================================================================== --- stable/12/sys/netgraph/ng_l2tp.c Thu Nov 7 00:27:23 2019 (r354423) +++ stable/12/sys/netgraph/ng_l2tp.c Thu Nov 7 00:28:50 2019 (r354424) @@ -1462,6 +1462,7 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi /* Sanity check */ L2TP_SEQ_CHECK(seq); + mtx_lock(&seq->mtx); priv->stats.xmitRetransmits++; /* Have we reached the retransmit limit? If so, notify owner. */ @@ -1482,7 +1483,9 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi seq->acks = 0; /* Retransmit oldest unack'd packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT)) == NULL) + m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT); + mtx_unlock(&seq->mtx); + if (m == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->ns++); From owner-svn-src-all@freebsd.org Thu Nov 7 03:46:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D464A1A5F72; Thu, 7 Nov 2019 03:46:20 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477q7w5tRhz43Md; Thu, 7 Nov 2019 03:46:20 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADE357BD3; Thu, 7 Nov 2019 03:46:20 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA73kKfC042751; Thu, 7 Nov 2019 03:46:20 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA73kIS5042739; Thu, 7 Nov 2019 03:46:18 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911070346.xA73kIS5042739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 03:46:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354425 - in vendor/Juniper/libxo/dist: . doc encoder encoder/cbor encoder/csv encoder/test libxo tests/core tests/core/saved tests/gettext tests/gettext/saved tests/xo/saved xo xolint X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in vendor/Juniper/libxo/dist: . doc encoder encoder/cbor encoder/csv encoder/test libxo tests/core tests/core/saved tests/gettext tests/gettext/saved tests/xo/saved xo xolint X-SVN-Commit-Revision: 354425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 03:46:20 -0000 Author: phil Date: Thu Nov 7 03:46:17 2019 New Revision: 354425 URL: https://svnweb.freebsd.org/changeset/base/354425 Log: Import libxo 1.3.0 Added: vendor/Juniper/libxo/dist/doc/encoders.rst vendor/Juniper/libxo/dist/doc/top-link.html.in (contents, props changed) vendor/Juniper/libxo/dist/encoder/csv/ vendor/Juniper/libxo/dist/encoder/csv/Makefile.am (contents, props changed) vendor/Juniper/libxo/dist/encoder/csv/enc_csv.c (contents, props changed) vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv1.err vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv1.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv2.err vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv2.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv3.err vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv3.out Deleted: vendor/Juniper/libxo/dist/doc/libxo-manual.html vendor/Juniper/libxo/dist/doc/libxo.txt Modified: vendor/Juniper/libxo/dist/Makefile.am vendor/Juniper/libxo/dist/README.md vendor/Juniper/libxo/dist/configure.ac vendor/Juniper/libxo/dist/doc/Makefile.am vendor/Juniper/libxo/dist/doc/api.rst vendor/Juniper/libxo/dist/doc/conf.py vendor/Juniper/libxo/dist/doc/faq.rst vendor/Juniper/libxo/dist/doc/field-formatting.rst vendor/Juniper/libxo/dist/doc/field-modifiers.rst vendor/Juniper/libxo/dist/doc/field-roles.rst vendor/Juniper/libxo/dist/doc/index.rst vendor/Juniper/libxo/dist/doc/options.rst vendor/Juniper/libxo/dist/doc/xo.rst vendor/Juniper/libxo/dist/doc/xohtml.rst vendor/Juniper/libxo/dist/doc/xolint.rst vendor/Juniper/libxo/dist/doc/xopo.rst vendor/Juniper/libxo/dist/encoder/Makefile.am vendor/Juniper/libxo/dist/encoder/cbor/enc_cbor.c vendor/Juniper/libxo/dist/encoder/test/enc_test.c vendor/Juniper/libxo/dist/libxo/add.man.in vendor/Juniper/libxo/dist/libxo/libxo.c vendor/Juniper/libxo/dist/libxo/xo_buf.h vendor/Juniper/libxo/dist/libxo/xo_encoder.c vendor/Juniper/libxo/dist/libxo/xo_encoder.h vendor/Juniper/libxo/dist/tests/core/Makefile.am vendor/Juniper/libxo/dist/tests/core/saved/test_01.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.H.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.HIPx.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.HP.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.JP.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.T.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.X.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.XP.out vendor/Juniper/libxo/dist/tests/core/saved/test_02.E.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_02.H.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.HIPx.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.HP.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.JP.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.T.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.X.err vendor/Juniper/libxo/dist/tests/core/saved/test_02.XP.err vendor/Juniper/libxo/dist/tests/core/saved/test_03.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_04.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_05.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_06.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_07.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_08.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_09.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_10.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_11.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.E.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_12.H.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.HIPx.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.HP.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.J.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.JP.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.T.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.X.err vendor/Juniper/libxo/dist/tests/core/saved/test_12.XP.err vendor/Juniper/libxo/dist/tests/core/test_01.c vendor/Juniper/libxo/dist/tests/core/test_02.c vendor/Juniper/libxo/dist/tests/core/test_03.c vendor/Juniper/libxo/dist/tests/core/test_08.c vendor/Juniper/libxo/dist/tests/core/test_09.c vendor/Juniper/libxo/dist/tests/core/test_10.c vendor/Juniper/libxo/dist/tests/core/test_11.c vendor/Juniper/libxo/dist/tests/core/test_12.c vendor/Juniper/libxo/dist/tests/gettext/gt_01.c vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.H.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.HIPx.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.HP.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.J.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.JP.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.T.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.X.out vendor/Juniper/libxo/dist/tests/gettext/saved/gt_01.XP.out vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.H.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HIPx.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.HP.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.J.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.JP.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.T.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.X.err vendor/Juniper/libxo/dist/tests/xo/saved/xo_02.XP.err vendor/Juniper/libxo/dist/xo/xo.c vendor/Juniper/libxo/dist/xolint/xolint.pl Modified: vendor/Juniper/libxo/dist/Makefile.am ============================================================================== --- vendor/Juniper/libxo/dist/Makefile.am Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/Makefile.am Thu Nov 7 03:46:17 2019 (r354425) @@ -32,7 +32,6 @@ errors: docs: @(cd doc ; ${MAKE} docs) - DIST_FILES_DIR = ~/Dropbox/dist-files/ GH_PAGES_DIR = gh-pages/ GH_PAGES_DIR_VER = gh-pages/${PACKAGE_VERSION} @@ -49,18 +48,20 @@ upload: dist upload-docs upload-xohtml-files @echo "Remember to run:" @echo " gt tag ${PACKAGE_VERSION}" -upload-docs: docs - @echo "Uploading libxo-manual.html ... " - @-[ -d ${GH_PAGES_DIR} ] \ - && echo "Updating manual on gh-pages ..." \ - && mkdir -p ${GH_PAGES_DIR_VER} \ - && cp doc/libxo-manual.html ${GH_PAGES_DIR} \ - && cp doc/libxo-manual.html ${GH_PAGES_DIR_VER} \ +upload-docs: docs upload-html + +upload-html: + @echo "Uploading html ... " + @-[ -d ${GH_PAGES_DIR} -a -d doc/html ] \ + && echo "Updating html on gh-pages ..." \ + && mkdir -p ${GH_PAGES_DIR_VER}/html \ + && cp doc/top-link.html ${GH_PAGES_DIR}/libxo.html \ + && cp -r doc/html/* ${GH_PAGES_DIR_VER}/html/ \ && (cd ${GH_PAGES_DIR} \ - && git add ${PACKAGE_VERSION} \ - && git add libxo-manual.html \ + && git add libxo.html \ + && git add ${PACKAGE_VERSION}/html \ && git commit -m 'new docs' \ - libxo-manual.html ${PACKAGE_VERSION} \ + libxo.html ${PACKAGE_VERSION}/html \ && git push origin gh-pages ) ; true upload-xohtml-files: Modified: vendor/Juniper/libxo/dist/README.md ============================================================================== --- vendor/Juniper/libxo/dist/README.md Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/README.md Thu Nov 7 03:46:17 2019 (r354425) @@ -10,6 +10,9 @@ application calls a function "xo_emit" to product outp described in a format string. A "field descriptor" tells libxo what the field is and what it means. +Imagine a simplified ``wc`` that emits its output fields in a single +xo_emit call: + ``` xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} " "{:characters/%7ju/%ju}{d:filename/%s}\n", Modified: vendor/Juniper/libxo/dist/configure.ac ============================================================================== --- vendor/Juniper/libxo/dist/configure.ac Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/configure.ac Thu Nov 7 03:46:17 2019 (r354425) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [1.0.4], [phil@juniper.net]) +AC_INIT([libxo], [1.3.0], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. @@ -452,6 +452,7 @@ AC_CONFIG_FILES([ libxo/add.man encoder/Makefile encoder/cbor/Makefile + encoder/csv/Makefile encoder/test/Makefile xo/Makefile xolint/Makefile @@ -459,6 +460,7 @@ AC_CONFIG_FILES([ xopo/Makefile packaging/libxo.pc doc/Makefile + doc/top-link.html tests/Makefile tests/core/Makefile tests/gettext/Makefile Modified: vendor/Juniper/libxo/dist/doc/Makefile.am ============================================================================== --- vendor/Juniper/libxo/dist/doc/Makefile.am Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/Makefile.am Thu Nov 7 03:46:17 2019 (r354425) @@ -8,68 +8,22 @@ # using the SOFTWARE, you agree to be bound by the terms of that # LICENSE. -if HAVE_OXTRADOC -OXTRADOC_DIR = ${SLAX_OXTRADOCDIR} -OXTRADOC_PREFIX = ${OXTRADOC_DIR} -OXTRADOC = ${OXTRADOC_DIR}/oxtradoc -SLAXPROC_BINDIR = ${SLAX_BINDIR} +doc docs: xolint.rst html -XML2RFC = ${OXTRADOC_DIR}/xml2rfc.tcl -XML2HTMLDIR = ${OXTRADOC_DIR} -XML2HTMLBIN = ${XML2HTMLDIR}/rfc2629-to-html.slax -SLAXPROC = ${SLAX_BINDIR}/slaxproc +# +# The contents of xolint.rst is generated based on xolint.pl, since we +# really want this to be self-documenting. But readthedocs.org needs this +# data to be _in_ repo. So we generate this file on command only, and +# the developer needs to commit any changes. +# -SLAXPROC_ARGS = \ - -a oxtradoc-dir ${OXTRADOC_DIR} \ - -a oxtradoc-install-dir ${OXTRADOC_DIR} \ - -a anchor-prefix docs +xolint.rst: ${top_srcdir}/xolint/xolint.pl + perl ${top_srcdir}/xolint/xolint.pl -D > ${top_srcdir}/doc/xolint.rst -SLAXPROC_ARGS_INLINE = \ - -a oxtradoc-inline yes +SPHINX = python3 -msphinx -SLAXPROC_ARGS += ${SLAXPROC_ARGS_INLINE} - -XML2HTML = \ - ${SLAXPROC} -g -e -I ${OXTRADOC_DIR} -I . \ - ${SLAXPROC_ARGS} \ - ${XML2HTMLBIN} - -OX_ARGS = -P ${OXTRADOC_PREFIX} -L ${OXTRADOC_PREFIX} -OX_ARGS += -S ${SLAXPROC} -p doc -OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS} -OXTRADOC_CMD = ${OX_CMD} - -OUTPUT = libxo-manual -INPUT = libxo - -EXTRA_DIST = \ - ${INPUT}.txt \ - ${OUTPUT}.html \ - ${OUTPUT}.txt - -doc docs: ${OUTPUT}.txt ${OUTPUT}.html - -${OUTPUT}.txt: ${INPUT}.txt ${OXTRADOC} xolint.txt - ${OXTRADOC_CMD} -m text -o $@ $< - -${OUTPUT}.html: ${INPUT}.txt ${OXTRADOC} ${XML2HTMLBIN} xolint.txt - ${OXTRADOC_CMD} -m html -o $@ $< - -xolint.txt: ${top_srcdir}/xolint/xolint.pl - perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt - -CLEANFILES = \ -xolint.txt \ -${INPUT}.xml \ -${INPUT}.fxml \ -${OUTPUT}.txt \ -${OUTPUT}.html -else -doc docs: - @${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org" -endif - -SPHINX = python3.4 -msphinx - html sphinx sphinx-html: - ${SPHINX} -M html ${srcdir} . + ${SPHINX} -M html ${srcdir} . -N -E + +singlehtml: + ${SPHINX} -M singlehtml ${srcdir} . -N -E Modified: vendor/Juniper/libxo/dist/doc/api.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/api.rst Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/api.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -1,4 +1,4 @@ -.. index: API +.. index:: API The libxo API ============= @@ -155,14 +155,14 @@ Output Styles (XO_STYLE\_\*) The libxo functions accept a set of output styles: -=============== ========================= - Flag Description -=============== ========================= - XO_STYLE_TEXT Traditional text output - XO_STYLE_XML XML encoded data - XO_STYLE_JSON JSON encoded data - XO_STYLE_HTML HTML encoded data -=============== ========================= + =============== ========================= + Flag Description + =============== ========================= + XO_STYLE_TEXT Traditional text output + XO_STYLE_XML XML encoded data + XO_STYLE_JSON JSON encoded data + XO_STYLE_HTML HTML encoded data + =============== ========================= The "XML", "JSON", and "HTML" output styles all use the UTF-8 character encoding. "TEXT" using locale-based encoding. @@ -256,26 +256,26 @@ Flags (XOF\_\*) The set of valid flags include: -=================== ========================================= - Flag Description -=================== ========================================= - XOF_CLOSE_FP Close file pointer on `xo_destroy` - XOF_COLOR Enable color and effects in output - XOF_COLOR_ALLOWED Allow color/effect for terminal output - XOF_DTRT Enable "do the right thing" mode - XOF_INFO Display info data attributes (HTML) - XOF_KEYS Emit the key attribute (XML) - XOF_NO_ENV Do not use the :ref:`libxo-options` env var - XOF_NO_HUMANIZE Display humanization (TEXT, HTML) - XOF_PRETTY Make "pretty printed" output - XOF_UNDERSCORES Replaces hyphens with underscores - XOF_UNITS Display units (XML, HMTL) - XOF_WARN Generate warnings for broken calls - XOF_WARN_XML Generate warnings in XML on stdout - XOF_XPATH Emit XPath expressions (HTML) - XOF_COLUMNS Force xo_emit to return columns used - XOF_FLUSH Flush output after each `xo_emit` call -=================== ========================================= + =================== ========================================= + Flag Description + =================== ========================================= + XOF_CLOSE_FP Close file pointer on `xo_destroy` + XOF_COLOR Enable color and effects in output + XOF_COLOR_ALLOWED Allow color/effect for terminal output + XOF_DTRT Enable "do the right thing" mode + XOF_INFO Display info data attributes (HTML) + XOF_KEYS Emit the key attribute (XML) + XOF_NO_ENV Do not use the :ref:`libxo-options` env var + XOF_NO_HUMANIZE Display humanization (TEXT, HTML) + XOF_PRETTY Make "pretty printed" output + XOF_UNDERSCORES Replaces hyphens with underscores + XOF_UNITS Display units (XML, HMTL) + XOF_WARN Generate warnings for broken calls + XOF_WARN_XML Generate warnings in XML on stdout + XOF_XPATH Emit XPath expressions (HTML) + XOF_COLUMNS Force xo_emit to return columns used + XOF_FLUSH Flush output after each `xo_emit` call + =================== ========================================= The `XOF_CLOSE_FP` flag will trigger the call of the *close_func* (provided via `xo_set_writer`) when the handle is destroyed. @@ -300,12 +300,12 @@ regardless of whether warnings are enabled. If the style is `XO_STYLE_HTML`, the following additional flags can be used: -=============== ========================================= - Flag Description -=============== ========================================= - XOF_XPATH Emit "data-xpath" attributes - XOF_INFO Emit additional info fields -=============== ========================================= + =============== ========================================= + Flag Description + =============== ========================================= + XOF_XPATH Emit "data-xpath" attributes + XOF_INFO Emit additional info fields + =============== ========================================= The `XOF_XPATH` flag enables the emission of XPath expressions detailing the hierarchy of XML elements used to encode the data field, if the @@ -317,11 +317,11 @@ output. See :ref:`field-information` for details. If the style is `XO_STYLE_XML`, the following additional flags can be used: -=============== ========================================= - Flag Description -=============== ========================================= - XOF_KEYS Flag "key" fields for XML -=============== ========================================= + =============== ========================================= + Flag Description + =============== ========================================= + XOF_KEYS Flag "key" fields for XML + =============== ========================================= The `XOF_KEYS` flag adds "key" attribute to the XML encoding for field definitions that use the "k" modifier. The key attribute has @@ -1308,52 +1308,52 @@ These values are defined in . The priority value indicates the importance and potential impact of each message: -============= ======================================================= - Priority Description -============= ======================================================= - LOG_EMERG A panic condition, normally broadcast to all users - LOG_ALERT A condition that should be corrected immediately - LOG_CRIT Critical conditions - LOG_ERR Generic errors - LOG_WARNING Warning messages - LOG_NOTICE Non-error conditions that might need special handling - LOG_INFO Informational messages - LOG_DEBUG Developer-oriented messages -============= ======================================================= + ============= ======================================================= + Priority Description + ============= ======================================================= + LOG_EMERG A panic condition, normally broadcast to all users + LOG_ALERT A condition that should be corrected immediately + LOG_CRIT Critical conditions + LOG_ERR Generic errors + LOG_WARNING Warning messages + LOG_NOTICE Non-error conditions that might need special handling + LOG_INFO Informational messages + LOG_DEBUG Developer-oriented messages + ============= ======================================================= The facility value indicates the source of message, in fairly generic terms: -=============== ======================================================= - Facility Description -=============== ======================================================= - LOG_AUTH The authorization system (e.g. :manpage:`login(1)`) - LOG_AUTHPRIV As LOG_AUTH, but logged to a privileged file - LOG_CRON The cron daemon: :manpage:`cron(8)` - LOG_DAEMON System daemons, not otherwise explicitly listed - LOG_FTP The file transfer protocol daemons - LOG_KERN Messages generated by the kernel - LOG_LPR The line printer spooling system - LOG_MAIL The mail system - LOG_NEWS The network news system - LOG_SECURITY Security subsystems, such as :manpage:`ipfw(4)` - LOG_SYSLOG Messages generated internally by :manpage:`syslogd(8)` - LOG_USER Messages generated by user processes (default) - LOG_UUCP The uucp system - LOG_LOCAL0..7 Reserved for local use -=============== ======================================================= + =============== ======================================================= + Facility Description + =============== ======================================================= + LOG_AUTH The authorization system (e.g. :manpage:`login(1)`) + LOG_AUTHPRIV As LOG_AUTH, but logged to a privileged file + LOG_CRON The cron daemon: :manpage:`cron(8)` + LOG_DAEMON System daemons, not otherwise explicitly listed + LOG_FTP The file transfer protocol daemons + LOG_KERN Messages generated by the kernel + LOG_LPR The line printer spooling system + LOG_MAIL The mail system + LOG_NEWS The network news system + LOG_SECURITY Security subsystems, such as :manpage:`ipfw(4)` + LOG_SYSLOG Messages generated internally by :manpage:`syslogd(8)` + LOG_USER Messages generated by user processes (default) + LOG_UUCP The uucp system + LOG_LOCAL0..7 Reserved for local use + =============== ======================================================= In addition to the values listed above, xo_open_log accepts a set of addition flags requesting specific logging behaviors: -============ ==================================================== - Flag Description -============ ==================================================== - LOG_CONS If syslogd fails, attempt to write to /dev/console - LOG_NDELAY Open the connection to :manpage:`syslogd(8)` immediately - LOG_PERROR Write the message also to standard error output - LOG_PID Log the process id with each message -============ ==================================================== + ============ ==================================================== + Flag Description + ============ ==================================================== + LOG_CONS If syslogd fails, attempt to write to /dev/console + LOG_NDELAY Open the connection to :manpage:`syslogd(8)` immediately + LOG_PERROR Write the message also to standard error output + LOG_PID Log the process id with each message + ============ ==================================================== .. index:: xo_syslog @@ -1588,26 +1588,26 @@ processing model of libxo. Content is formatted withi callbacks are made to the encoder's handler function when data is ready to be processed: -======================= ======================================= - Operation Meaning (Base function) -======================= ======================================= - XO_OP_CREATE Called when the handle is created - XO_OP_OPEN_CONTAINER Container opened (xo_open_container) - XO_OP_CLOSE_CONTAINER Container closed (xo_close_container) - XO_OP_OPEN_LIST List opened (xo_open_list) - XO_OP_CLOSE_LIST List closed (xo_close_list) - XO_OP_OPEN_LEAF_LIST Leaf list opened (xo_open_leaf_list) - XO_OP_CLOSE_LEAF_LIST Leaf list closed (xo_close_leaf_list) - XO_OP_OPEN_INSTANCE Instance opened (xo_open_instance) - XO_OP_CLOSE_INSTANCE Instance closed (xo_close_instance) - XO_OP_STRING Field with Quoted UTF-8 string - XO_OP_CONTENT Field with content - XO_OP_FINISH Finish any pending output - XO_OP_FLUSH Flush any buffered output - XO_OP_DESTROY Clean up resources - XO_OP_ATTRIBUTE An attribute name/value pair - XO_OP_VERSION A version string -======================= ======================================= + ======================= ======================================= + Operation Meaning (Base function) + ======================= ======================================= + XO_OP_CREATE Called when the handle is created + XO_OP_OPEN_CONTAINER Container opened (xo_open_container) + XO_OP_CLOSE_CONTAINER Container closed (xo_close_container) + XO_OP_OPEN_LIST List opened (xo_open_list) + XO_OP_CLOSE_LIST List closed (xo_close_list) + XO_OP_OPEN_LEAF_LIST Leaf list opened (xo_open_leaf_list) + XO_OP_CLOSE_LEAF_LIST Leaf list closed (xo_close_leaf_list) + XO_OP_OPEN_INSTANCE Instance opened (xo_open_instance) + XO_OP_CLOSE_INSTANCE Instance closed (xo_close_instance) + XO_OP_STRING Field with Quoted UTF-8 string + XO_OP_CONTENT Field with content + XO_OP_FINISH Finish any pending output + XO_OP_FLUSH Flush any buffered output + XO_OP_DESTROY Clean up resources + XO_OP_ATTRIBUTE An attribute name/value pair + XO_OP_VERSION A version string + ======================= ======================================= For all the open and close operations, the name parameter holds the name of the construct. For string, content, and attribute operations, Modified: vendor/Juniper/libxo/dist/doc/conf.py ============================================================================== --- vendor/Juniper/libxo/dist/doc/conf.py Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/conf.py Thu Nov 7 03:46:17 2019 (r354425) @@ -21,7 +21,15 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +import subprocess +# +# Instead of hardcoding the version number here, we read it from the +# project's configure script +# +vers_cmd = "grep AC_INIT ../configure.ac | awk '{ print substr($2, 2, length($2) - 3);}'" +version = subprocess.check_output(vers_cmd, shell=True).decode("utf-8") + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -47,7 +55,7 @@ master_doc = 'index' # General information about the project. project = 'libxo' -copyright = '2017, Juniper Networks' +copyright = '2017-2019, Juniper Networks Inc' author = 'Phil Shafer' default_role = 'code' primary_domain = 'c' @@ -58,9 +66,9 @@ smart_quotes = False # built documents. # # The short X.Y version. -version = '0.8.4' +#version = 'develop' # The full version, including alpha/beta/rc tags. -release = '0.8.4' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. Added: vendor/Juniper/libxo/dist/doc/encoders.rst ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/Juniper/libxo/dist/doc/encoders.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -0,0 +1,269 @@ +.. index:: encoder + +Encoders +======== + +This section gives an overview of encoders, details on the encoders +that ship with libxo, and documentation for developers of future +encoders. + +Overview +-------- + +The libxo library contains software to generate four "built-in" +formats: text, XML, JSON, and HTML. These formats are common and +useful, but there are other common and useful formats that users will +want, and including them all in the libxo software would be difficult +and cumbersome. + +To allow support for additional encodings, libxo includes a +"pluggable" extension mechanism for dynamically loading new encoders. +libxo-based applications can automatically use any installed encoder. + +Use the "encoder=XXX" option to access encoders. The following +example uses the "cbor" encoder, saving the output into a file:: + + df --libxo encoder=cbor > df-output.cbor + +Encoders can support specific options that can be accessed by +following the encoder name with a colon (':') and one of more options, +separated by a plus sign "+":: + + df --libxo encoder=csv:path=filesystem+leaf=name+no-header + +This example instructs libxo to load the "csv" encoder and pass the +following options:: + + path=filesystem + leaf=name + no-header + +Each of these option is interpreted by the encoder, and all such +options names and semantics are specific to the particular encoder. +Refer to the intended encoder for documentation on its options. + +.. _csv_encoder: + +CSV - Comma Separated Values +---------------------------- + +libxo ships with a custom encoder for "CSV" files, a common format for +comma separated values. The output of the CSV encoder can be loaded +directly into spreadsheets or similar applications. + +A standard for CSV files is provided in :RFC:`4180`, but since the +format predates that standard by decades, there are many minor +differences in CSV file consumers and their expectations. The CSV +encoder has a number of options to tailor output to those +expectations. + +Consider the following XML:: + + % list-items --libxo xml,pretty + + + + GRO-000-415 + gum + 1412 + 54 + 10 + + + HRD-000-212 + rope + 85 + 4 + 2 + + + HRD-000-517 + ladder + 0 + 2 + 1 + + + + +This output is a list of `instances` (named "item"), each containing a +set of `leafs` ("sku", "name", etc). + +The CSV encoder will emit the leaf values in this output as `fields` +inside a CSV `record`, which is a line containing a set of +comma-separated values:: + + % list-items --libxo encoder=csv + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +Be aware that since the CSV encoder looks for data instances, when +used with :ref:`xo`, the `--instance` option will be needed:: + + % xo --libxo encoder=csv --instance foo 'The {:product} is {:status}\n' stereo "in route" + product,status + stereo,in route + +.. _csv_path: + +The `path` Option +~~~~~~~~~~~~~~~~~ + +By default, the CSV encoder will attempt to emit any list instance +generated by the application. In some cases, this may be +unacceptable, and a specific list may be desired. + +Use the "path" option to limit the processing of output to a specific +hierarchy. The path should be one or more names of containers or +lists. + +For example, if the "list-items" application generates other lists, +the user can give "path=top/data/item" as a path:: + + % list-items --libxo encoder=csv:path=top/data/item + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +Paths are "relative", meaning they need not be a complete set +of names to the list. This means that "path=item" may be sufficient +for the above example. + +.. _csv_leafs: + +The `leafs` Option +~~~~~~~~~~~~~~~~~~ + +The CSV encoding requires that all lines of output have the same +number of fields with the same order. In contrast, XML and JSON allow +any order (though libxo forces key leafs to appear before other +leafs). + +To maintain a consistent set of fields inside the CSV file, the same +set of leafs must be selected from each list item. By default, the +CSV encoder records the set of leafs that appear in the first list +instance it processes, and extract only those leafs from future +instances. If the first instance is missing a leaf that is desired by +the consumer, the "leaf" option can be used to ensure that an empty +value is recorded for instances that lack a particular leaf. + +The "leafs" option can also be used to exclude leafs, limiting the +output to only those leafs provided. + +In addition, the order of the output fields follows the order in which +the leafs are listed. "leafs=one.two" and "leafs=two.one" give +distinct output. + +So the "leafs" option can be used to expand, limit, and order the set +of leafs. + +The value of the leafs option should be one or more leaf names, +separated by a period ("."):: + + % list-items --libxo encoder=csv:leafs=sku.on-order + sku,on-order + GRO-000-415,10 + HRD-000-212,2 + HRD-000-517,1 + % list-items -libxo encoder=csv:leafs=on-order.sku + on-order,sku + 10,GRO-000-415 + 2,HRD-000-212 + 1,HRD-000-517 + +Note that since libxo uses terminology from YANG (:RFC:`7950`), the +data modeling language for NETCONF (:RFC:`6241`), which uses "leafs" +as the plural form of "leaf". libxo follows that convention. + +.. _csv_no_header: + +The `no-header` Option +~~~~~~~~~~~~~~~~~~~~~~ + +CSV files typical begin with a line that defines the fields included +in that file, in an attempt to make the contents self-defining:: + + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +There is no reliable mechanism for determining whether this header +line is included, so the consumer must make an assumption. + +The csv encoder defaults to producing the header line, but the +"no-header" option can be included to avoid the header line. + +.. _csv_no_quotes: + +The `no-quotes` Option +~~~~~~~~~~~~~~~~~~~~~~ + +:RFC:`4180` specifies that fields containing spaces should be quoted, but +many CSV consumers do not handle quotes. The "no-quotes" option +instruct the CSV encoder to avoid the use of quotes. + +.. _csv_dos: + +The `dos` Option +~~~~~~~~~~~~~~~~ + +:RFC:`4180` defines the end-of-line marker as a carriage return +followed by a newline. This `CRLF` convention dates from the distant +past, but its use was anchored in the 1980s by the `DOS` operating +system. + +The CSV encoder defaults to using the standard Unix end-of-line +marker, a simple newline. Use the "dos" option to use the `CRLF` +convention. + +The Encoder API +--------------- + +The encoder API consists of three distinct phases: + +- loading the encoder +- initializing the encoder +- feeding operations to the encoder + +To load the encoder, libxo will open a shared library named: + + ${prefix}/lib/libxo/encoder/${name}.enc + +This file is typically a symbolic link to a dynamic library, suitable +for `dlopen`(). libxo looks for a symbol called +`xo_encoder_library_init` inside that library and calls it with the +arguments defined in the header file "xo_encoder.h". This function +should look as follows:: + + int + xo_encoder_library_init (XO_ENCODER_INIT_ARGS) + { + arg->xei_version = XO_ENCODER_VERSION; + arg->xei_handler = test_handler; + + return 0; + } + +Several features here allow for future compatibility: the macro +XO_ENCODER_INIT_ARGS allows the arguments to this function change over +time, and the XO_ENCODER_VERSION allows the library to tell libxo +which version of the API it was compiled with. + +The function places in xei_handler should be have the signature:: + + static int + test_handler (XO_ENCODER_HANDLER_ARGS) + { + ... + +This function will be called with the "op" codes defined in +"xo_encoder.h". Each op code represents a distinct event in the libxo +processing model. For example OP_OPEN_CONTAINER tells the encoder +that a new container has been opened, and the encoder can behave in an +appropriate manner. + + Modified: vendor/Juniper/libxo/dist/doc/faq.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/faq.rst Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/faq.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -202,8 +202,7 @@ will lead users to ask the difference between the two there is no difference, use only one of the field names. If there is a difference, change the names to make that difference more obvious. -.. ignore for now, since we want can't have generated content - What does this message mean? - ---------------------------- +What does this message mean? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!include-file xolint.txt +.. include:: xolint.rst Modified: vendor/Juniper/libxo/dist/doc/field-formatting.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/field-formatting.rst Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/field-formatting.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -53,48 +53,48 @@ removed eventually. The format character is described in the following table: -===== ================= ====================== - Ltr Argument Type Format -===== ================= ====================== - d int base 10 (decimal) - i int base 10 (decimal) - o int base 8 (octal) - u unsigned base 10 (decimal) - x unsigned base 16 (hex) - X unsigned long base 16 (hex) - D long base 10 (decimal) - O unsigned long base 8 (octal) - U unsigned long base 10 (decimal) - e double [-]d.ddde+-dd - E double [-]d.dddE+-dd - f double [-]ddd.ddd - F double [-]ddd.ddd - g double as 'e' or 'f' - G double as 'E' or 'F' - a double [-]0xh.hhhp[+-]d - A double [-]0Xh.hhhp[+-]d - c unsigned char a character - C wint_t a character - s char \* a UTF-8 string - S wchar_t \* a unicode/WCS string - p void \* '%#lx' -===== ================= ====================== + ===== ================= ====================== + Ltr Argument Type Format + ===== ================= ====================== + d int base 10 (decimal) + i int base 10 (decimal) + o int base 8 (octal) + u unsigned base 10 (decimal) + x unsigned base 16 (hex) + X unsigned long base 16 (hex) + D long base 10 (decimal) + O unsigned long base 8 (octal) + U unsigned long base 10 (decimal) + e double [-]d.ddde+-dd + E double [-]d.dddE+-dd + f double [-]ddd.ddd + F double [-]ddd.ddd + g double as 'e' or 'f' + G double as 'E' or 'F' + a double [-]0xh.hhhp[+-]d + A double [-]0Xh.hhhp[+-]d + c unsigned char a character + C wint_t a character + s char \* a UTF-8 string + S wchar_t \* a unicode/WCS string + p void \* '%#lx' + ===== ================= ====================== The 'h' and 'l' modifiers affect the size and treatment of the argument: -===== ============= ==================== - Mod d, i o, u, x, X -===== ============= ==================== - hh signed char unsigned char - h short unsigned short - l long unsigned long - ll long long unsigned long long - j intmax_t uintmax_t - t ptrdiff_t ptrdiff_t - z size_t size_t - q quad_t u_quad_t -===== ============= ==================== + ===== ============= ==================== + Mod d, i o, u, x, X + ===== ============= ==================== + hh signed char unsigned char + h short unsigned short + l long unsigned long + ll long long unsigned long long + j intmax_t uintmax_t + t ptrdiff_t ptrdiff_t + z size_t size_t + q quad_t u_quad_t + ===== ============= ==================== .. index:: UTF-8 .. index:: Locale @@ -122,14 +122,14 @@ style:: xo_emit("All strings are utf-8 content {:tag/%ls}", L"except for wide strings"); -======== ================== =============================== - Format Argument Type Argument Contents -======== ================== =============================== - %s const char \* UTF-8 string - %S const char \* UTF-8 string (alias for '%ls') - %ls const wchar_t \* Wide character UNICODE string - %hs const char * locale-based string -======== ================== =============================== + ======== ================== =============================== + Format Argument Type Argument Contents + ======== ================== =============================== + %s const char \* UTF-8 string + %S const char \* UTF-8 string (alias for '%ls') + %ls const wchar_t \* Wide character UNICODE string + %hs const char * locale-based string + ======== ================== =============================== .. admonition:: "Long", not "locale" @@ -266,21 +266,21 @@ incompatible with printf-like testing: If none of these features are in use by your code, then using the "_p" variants might be wise: -================== ======================== - Function printf-like Equivalent -================== ======================== - xo_emit_hv xo_emit_hvp - xo_emit_h xo_emit_hp - xo_emit xo_emit_p - xo_emit_warn_hcv xo_emit_warn_hcvp - xo_emit_warn_hc xo_emit_warn_hcp - xo_emit_warn_c xo_emit_warn_cp - xo_emit_warn xo_emit_warn_p - xo_emit_warnx xo_emit_warnx_p - xo_emit_err xo_emit_err_p - xo_emit_errx xo_emit_errx_p - xo_emit_errc xo_emit_errc_p -================== ======================== + ================== ======================== + Function printf-like Equivalent + ================== ======================== + xo_emit_hv xo_emit_hvp + xo_emit_h xo_emit_hp + xo_emit xo_emit_p + xo_emit_warn_hcv xo_emit_warn_hcvp + xo_emit_warn_hc xo_emit_warn_hcp + xo_emit_warn_c xo_emit_warn_cp + xo_emit_warn xo_emit_warn_p + xo_emit_warnx xo_emit_warnx_p + xo_emit_err xo_emit_err_p + xo_emit_errx xo_emit_errx_p + xo_emit_errc xo_emit_errc_p + ================== ======================== .. index:: performance .. index:: XOEF_RETAIN @@ -305,16 +305,16 @@ xo_emit_f() function. A complete set of xo_emit_f fun match all the xo_emit function signatures (with handles, varadic argument, and printf-like flags): -================== ======================== - Function Flags Equivalent -================== ======================== - xo_emit_hv xo_emit_hvf - xo_emit_h xo_emit_hf - xo_emit xo_emit_f - xo_emit_hvp xo_emit_hvfp - xo_emit_hp xo_emit_hfp - xo_emit_p xo_emit_fp -================== ======================== + ================== ======================== + Function Flags Equivalent + ================== ======================== + xo_emit_hv xo_emit_hvf + xo_emit_h xo_emit_hf + xo_emit xo_emit_f + xo_emit_hvp xo_emit_hvfp + xo_emit_hp xo_emit_hfp + xo_emit_p xo_emit_fp + ================== ======================== The format string must be immutable across multiple calls to xo_emit_f(), since the library retains the string. Typically this is done by using Modified: vendor/Juniper/libxo/dist/doc/field-modifiers.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/field-modifiers.rst Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/field-modifiers.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -8,26 +8,26 @@ Field Modifiers Field modifiers are flags which modify the way content emitted for particular output styles: -=== =============== =================================================== - M Name Description -=== =============== =================================================== - a argument The content appears as a 'const char \*' argument - c colon A colon (":") is appended after the label - d display Only emit field for display styles (text/HTML) - e encoding Only emit for encoding styles (XML/JSON) - g gettext Call gettext on field's render content - h humanize (hn) Format large numbers in human-readable style -\ hn-space Humanize: Place space between numeric and unit -\ hn-decimal Humanize: Add a decimal digit, if number < 10 -\ hn-1000 Humanize: Use 1000 as divisor instead of 1024 - k key Field is a key, suitable for XPath predicates - l leaf-list Field is a leaf-list - n no-quotes Do not quote the field when using JSON style - p plural Gettext: Use comma-separated plural form - q quotes Quote the field when using JSON style - t trim Trim leading and trailing whitespace - w white A blank (" ") is appended after the label -=== =============== =================================================== + === =============== =================================================== + M Name Description + === =============== =================================================== + a argument The content appears as a 'const char \*' argument + c colon A colon (":") is appended after the label + d display Only emit field for display styles (text/HTML) + e encoding Only emit for encoding styles (XML/JSON) + g gettext Call gettext on field's render content + h humanize (hn) Format large numbers in human-readable style + \ hn-space Humanize: Place space between numeric and unit + \ hn-decimal Humanize: Add a decimal digit, if number < 10 + \ hn-1000 Humanize: Use 1000 as divisor instead of 1024 + k key Field is a key, suitable for XPath predicates + l leaf-list Field is a leaf-list + n no-quotes Do not quote the field when using JSON style + p plural Gettext: Use comma-separated plural form + q quotes Quote the field when using JSON style + t trim Trim leading and trailing whitespace + w white A blank (" ") is appended after the label + === =============== =================================================== Roles and modifiers can also use more verbose names, when preceded by a comma. For example, the modifier string "Lwc" (or "L,white,colon") Modified: vendor/Juniper/libxo/dist/doc/field-roles.rst ============================================================================== --- vendor/Juniper/libxo/dist/doc/field-roles.rst Thu Nov 7 00:28:50 2019 (r354424) +++ vendor/Juniper/libxo/dist/doc/field-roles.rst Thu Nov 7 03:46:17 2019 (r354425) @@ -8,24 +8,26 @@ Field Roles Field roles are optional, and indicate the role and formatting of the content. The roles are listed below; only one role is permitted: -=== ============== ================================================= -R Name Description -=== ============== ================================================= -C color Field has color and effect controls -D decoration Field is non-text (e.g., colon, comma) -E error Field is an error message -G gettext Call gettext(3) on the format string -L label Field is text that prefixes a value -N note Field is text that follows a value -P padding Field is spaces needed for vertical alignment -T title Field is a title value for headings -U units Field is the units for the previous value field -V value Field is the name of field (the default) -W warning Field is a warning message -[ start-anchor Begin a section of anchored variable-width text -] stop-anchor End a section of anchored variable-width text -=== ============== ================================================= + === ============== ================================================= + R Name Description + === ============== ================================================= + C color Field has color and effect controls + D decoration Field is non-text (e.g., colon, comma) + E error Field is an error message + G gettext Call gettext(3) on the format string + L label Field is text that prefixes a value + N note Field is text that follows a value + P padding Field is spaces needed for vertical alignment *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 7 03:47:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DB9F1A601B; Thu, 7 Nov 2019 03:47:14 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477q8x5LFVz43VS; Thu, 7 Nov 2019 03:47:13 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 830D17BD7; Thu, 7 Nov 2019 03:47:13 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA73lDDE042837; Thu, 7 Nov 2019 03:47:13 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA73lDnx042836; Thu, 7 Nov 2019 03:47:13 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911070347.xA73lDnx042836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 03:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354426 - vendor/Juniper/libxo/1.3.0 X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: vendor/Juniper/libxo/1.3.0 X-SVN-Commit-Revision: 354426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 03:47:14 -0000 Author: phil Date: Thu Nov 7 03:47:13 2019 New Revision: 354426 URL: https://svnweb.freebsd.org/changeset/base/354426 Log: Tag libxo 1.3.0 Added: - copied from r354425, vendor/Juniper/libxo/dist/ Directory Properties: vendor/Juniper/libxo/1.3.0/ (props changed) From owner-svn-src-all@freebsd.org Thu Nov 7 03:57:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78E781A62D7; Thu, 7 Nov 2019 03:57:07 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477qNM29gDz43vY; Thu, 7 Nov 2019 03:57:07 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EA6A7DA5; Thu, 7 Nov 2019 03:57:07 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA73v7Pw048847; Thu, 7 Nov 2019 03:57:07 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA73v41Y048836; Thu, 7 Nov 2019 03:57:04 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911070357.xA73v41Y048836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 03:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354427 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/csv contrib/libxo/encoder/test contrib/libxo/libxo contrib/libx... X-SVN-Group: head X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in head: contrib/libxo contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/csv contrib/libxo/encoder/test contrib/libxo/libxo contrib/libxo/tests/core contrib/libx... X-SVN-Commit-Revision: 354427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 03:57:07 -0000 Author: phil Date: Thu Nov 7 03:57:04 2019 New Revision: 354427 URL: https://svnweb.freebsd.org/changeset/base/354427 Log: Import libxo-1.3.0: - move from "oxtradoc" to RST/Sphinx documentation - new "csv" encoder, which allows path and leaf lists - address warnings from PVS-Stdio tool - add "xolint" detected errors to the documentation Added: head/contrib/libxo/doc/encoders.rst - copied unchanged from r354426, vendor/Juniper/libxo/dist/doc/encoders.rst head/contrib/libxo/doc/top-link.html.in - copied unchanged from r354426, vendor/Juniper/libxo/dist/doc/top-link.html.in head/contrib/libxo/encoder/csv/ - copied from r354426, vendor/Juniper/libxo/dist/encoder/csv/ head/contrib/libxo/tests/core/saved/test_01.Ecsv1.err - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv1.err head/contrib/libxo/tests/core/saved/test_01.Ecsv1.out - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv1.out head/contrib/libxo/tests/core/saved/test_01.Ecsv2.err - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv2.err head/contrib/libxo/tests/core/saved/test_01.Ecsv2.out - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv2.out head/contrib/libxo/tests/core/saved/test_01.Ecsv3.err - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv3.err head/contrib/libxo/tests/core/saved/test_01.Ecsv3.out - copied unchanged from r354426, vendor/Juniper/libxo/dist/tests/core/saved/test_01.Ecsv3.out head/lib/libxo/encoder/ head/lib/libxo/encoder/Makefile (contents, props changed) head/lib/libxo/encoder/csv/ head/lib/libxo/encoder/csv/Makefile (contents, props changed) Deleted: head/contrib/libxo/doc/libxo-manual.html head/contrib/libxo/doc/libxo.txt Modified: head/contrib/libxo/Makefile.am head/contrib/libxo/README.md head/contrib/libxo/configure.ac head/contrib/libxo/doc/Makefile.am head/contrib/libxo/doc/api.rst head/contrib/libxo/doc/conf.py head/contrib/libxo/doc/faq.rst head/contrib/libxo/doc/field-formatting.rst head/contrib/libxo/doc/field-modifiers.rst head/contrib/libxo/doc/field-roles.rst head/contrib/libxo/doc/index.rst head/contrib/libxo/doc/options.rst head/contrib/libxo/doc/xo.rst head/contrib/libxo/doc/xohtml.rst head/contrib/libxo/doc/xolint.rst head/contrib/libxo/doc/xopo.rst head/contrib/libxo/encoder/Makefile.am head/contrib/libxo/encoder/cbor/enc_cbor.c head/contrib/libxo/encoder/test/enc_test.c head/contrib/libxo/libxo/add.man.in head/contrib/libxo/libxo/libxo.c head/contrib/libxo/libxo/xo_buf.h head/contrib/libxo/libxo/xo_encoder.c head/contrib/libxo/libxo/xo_encoder.h head/contrib/libxo/tests/core/Makefile.am head/contrib/libxo/tests/core/saved/test_01.E.out head/contrib/libxo/tests/core/saved/test_01.H.out head/contrib/libxo/tests/core/saved/test_01.HIPx.out head/contrib/libxo/tests/core/saved/test_01.HP.out head/contrib/libxo/tests/core/saved/test_01.J.out head/contrib/libxo/tests/core/saved/test_01.JP.out head/contrib/libxo/tests/core/saved/test_01.T.out head/contrib/libxo/tests/core/saved/test_01.X.out head/contrib/libxo/tests/core/saved/test_01.XP.out head/contrib/libxo/tests/core/saved/test_02.E.out head/contrib/libxo/tests/core/saved/test_03.E.out head/contrib/libxo/tests/core/saved/test_04.E.out head/contrib/libxo/tests/core/saved/test_05.E.out head/contrib/libxo/tests/core/saved/test_06.E.out head/contrib/libxo/tests/core/saved/test_07.E.out head/contrib/libxo/tests/core/saved/test_08.E.out head/contrib/libxo/tests/core/saved/test_09.E.out head/contrib/libxo/tests/core/saved/test_10.E.out head/contrib/libxo/tests/core/saved/test_11.E.out head/contrib/libxo/tests/core/saved/test_12.E.err head/contrib/libxo/tests/core/saved/test_12.E.out head/contrib/libxo/tests/core/saved/test_12.H.err head/contrib/libxo/tests/core/saved/test_12.HIPx.err head/contrib/libxo/tests/core/saved/test_12.HP.err head/contrib/libxo/tests/core/saved/test_12.J.err head/contrib/libxo/tests/core/saved/test_12.JP.err head/contrib/libxo/tests/core/saved/test_12.T.err head/contrib/libxo/tests/core/saved/test_12.X.err head/contrib/libxo/tests/core/saved/test_12.XP.err head/contrib/libxo/tests/core/test_01.c head/contrib/libxo/tests/core/test_02.c head/contrib/libxo/tests/core/test_03.c head/contrib/libxo/tests/core/test_08.c head/contrib/libxo/tests/core/test_09.c head/contrib/libxo/tests/core/test_10.c head/contrib/libxo/tests/core/test_11.c head/contrib/libxo/tests/core/test_12.c head/contrib/libxo/tests/gettext/gt_01.c head/contrib/libxo/tests/gettext/saved/gt_01.H.out head/contrib/libxo/tests/gettext/saved/gt_01.HIPx.out head/contrib/libxo/tests/gettext/saved/gt_01.HP.out head/contrib/libxo/tests/gettext/saved/gt_01.J.out head/contrib/libxo/tests/gettext/saved/gt_01.JP.out head/contrib/libxo/tests/gettext/saved/gt_01.T.out head/contrib/libxo/tests/gettext/saved/gt_01.X.out head/contrib/libxo/tests/gettext/saved/gt_01.XP.out head/contrib/libxo/tests/xo/saved/xo_02.H.err head/contrib/libxo/tests/xo/saved/xo_02.HIPx.err head/contrib/libxo/tests/xo/saved/xo_02.HP.err head/contrib/libxo/tests/xo/saved/xo_02.J.err head/contrib/libxo/tests/xo/saved/xo_02.JP.err head/contrib/libxo/tests/xo/saved/xo_02.T.err head/contrib/libxo/tests/xo/saved/xo_02.X.err head/contrib/libxo/tests/xo/saved/xo_02.XP.err head/contrib/libxo/xo/xo.c head/contrib/libxo/xolint/xolint.pl head/lib/libxo/Makefile head/lib/libxo/add.man head/lib/libxo/xo_config.h head/usr.bin/xohtml/xohtml.sh Directory Properties: head/contrib/libxo/ (props changed) Modified: head/contrib/libxo/Makefile.am ============================================================================== --- head/contrib/libxo/Makefile.am Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/Makefile.am Thu Nov 7 03:57:04 2019 (r354427) @@ -32,7 +32,6 @@ errors: docs: @(cd doc ; ${MAKE} docs) - DIST_FILES_DIR = ~/Dropbox/dist-files/ GH_PAGES_DIR = gh-pages/ GH_PAGES_DIR_VER = gh-pages/${PACKAGE_VERSION} @@ -49,18 +48,20 @@ upload: dist upload-docs upload-xohtml-files @echo "Remember to run:" @echo " gt tag ${PACKAGE_VERSION}" -upload-docs: docs - @echo "Uploading libxo-manual.html ... " - @-[ -d ${GH_PAGES_DIR} ] \ - && echo "Updating manual on gh-pages ..." \ - && mkdir -p ${GH_PAGES_DIR_VER} \ - && cp doc/libxo-manual.html ${GH_PAGES_DIR} \ - && cp doc/libxo-manual.html ${GH_PAGES_DIR_VER} \ +upload-docs: docs upload-html + +upload-html: + @echo "Uploading html ... " + @-[ -d ${GH_PAGES_DIR} -a -d doc/html ] \ + && echo "Updating html on gh-pages ..." \ + && mkdir -p ${GH_PAGES_DIR_VER}/html \ + && cp doc/top-link.html ${GH_PAGES_DIR}/libxo.html \ + && cp -r doc/html/* ${GH_PAGES_DIR_VER}/html/ \ && (cd ${GH_PAGES_DIR} \ - && git add ${PACKAGE_VERSION} \ - && git add libxo-manual.html \ + && git add libxo.html \ + && git add ${PACKAGE_VERSION}/html \ && git commit -m 'new docs' \ - libxo-manual.html ${PACKAGE_VERSION} \ + libxo.html ${PACKAGE_VERSION}/html \ && git push origin gh-pages ) ; true upload-xohtml-files: Modified: head/contrib/libxo/README.md ============================================================================== --- head/contrib/libxo/README.md Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/README.md Thu Nov 7 03:57:04 2019 (r354427) @@ -10,6 +10,9 @@ application calls a function "xo_emit" to product outp described in a format string. A "field descriptor" tells libxo what the field is and what it means. +Imagine a simplified ``wc`` that emits its output fields in a single +xo_emit call: + ``` xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} " "{:characters/%7ju/%ju}{d:filename/%s}\n", Modified: head/contrib/libxo/configure.ac ============================================================================== --- head/contrib/libxo/configure.ac Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/configure.ac Thu Nov 7 03:57:04 2019 (r354427) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [1.0.4], [phil@juniper.net]) +AC_INIT([libxo], [1.3.0], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. @@ -452,6 +452,7 @@ AC_CONFIG_FILES([ libxo/add.man encoder/Makefile encoder/cbor/Makefile + encoder/csv/Makefile encoder/test/Makefile xo/Makefile xolint/Makefile @@ -459,6 +460,7 @@ AC_CONFIG_FILES([ xopo/Makefile packaging/libxo.pc doc/Makefile + doc/top-link.html tests/Makefile tests/core/Makefile tests/gettext/Makefile Modified: head/contrib/libxo/doc/Makefile.am ============================================================================== --- head/contrib/libxo/doc/Makefile.am Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/Makefile.am Thu Nov 7 03:57:04 2019 (r354427) @@ -8,68 +8,22 @@ # using the SOFTWARE, you agree to be bound by the terms of that # LICENSE. -if HAVE_OXTRADOC -OXTRADOC_DIR = ${SLAX_OXTRADOCDIR} -OXTRADOC_PREFIX = ${OXTRADOC_DIR} -OXTRADOC = ${OXTRADOC_DIR}/oxtradoc -SLAXPROC_BINDIR = ${SLAX_BINDIR} +doc docs: xolint.rst html -XML2RFC = ${OXTRADOC_DIR}/xml2rfc.tcl -XML2HTMLDIR = ${OXTRADOC_DIR} -XML2HTMLBIN = ${XML2HTMLDIR}/rfc2629-to-html.slax -SLAXPROC = ${SLAX_BINDIR}/slaxproc +# +# The contents of xolint.rst is generated based on xolint.pl, since we +# really want this to be self-documenting. But readthedocs.org needs this +# data to be _in_ repo. So we generate this file on command only, and +# the developer needs to commit any changes. +# -SLAXPROC_ARGS = \ - -a oxtradoc-dir ${OXTRADOC_DIR} \ - -a oxtradoc-install-dir ${OXTRADOC_DIR} \ - -a anchor-prefix docs +xolint.rst: ${top_srcdir}/xolint/xolint.pl + perl ${top_srcdir}/xolint/xolint.pl -D > ${top_srcdir}/doc/xolint.rst -SLAXPROC_ARGS_INLINE = \ - -a oxtradoc-inline yes +SPHINX = python3 -msphinx -SLAXPROC_ARGS += ${SLAXPROC_ARGS_INLINE} - -XML2HTML = \ - ${SLAXPROC} -g -e -I ${OXTRADOC_DIR} -I . \ - ${SLAXPROC_ARGS} \ - ${XML2HTMLBIN} - -OX_ARGS = -P ${OXTRADOC_PREFIX} -L ${OXTRADOC_PREFIX} -OX_ARGS += -S ${SLAXPROC} -p doc -OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS} -OXTRADOC_CMD = ${OX_CMD} - -OUTPUT = libxo-manual -INPUT = libxo - -EXTRA_DIST = \ - ${INPUT}.txt \ - ${OUTPUT}.html \ - ${OUTPUT}.txt - -doc docs: ${OUTPUT}.txt ${OUTPUT}.html - -${OUTPUT}.txt: ${INPUT}.txt ${OXTRADOC} xolint.txt - ${OXTRADOC_CMD} -m text -o $@ $< - -${OUTPUT}.html: ${INPUT}.txt ${OXTRADOC} ${XML2HTMLBIN} xolint.txt - ${OXTRADOC_CMD} -m html -o $@ $< - -xolint.txt: ${top_srcdir}/xolint/xolint.pl - perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt - -CLEANFILES = \ -xolint.txt \ -${INPUT}.xml \ -${INPUT}.fxml \ -${OUTPUT}.txt \ -${OUTPUT}.html -else -doc docs: - @${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org" -endif - -SPHINX = python3.4 -msphinx - html sphinx sphinx-html: - ${SPHINX} -M html ${srcdir} . + ${SPHINX} -M html ${srcdir} . -N -E + +singlehtml: + ${SPHINX} -M singlehtml ${srcdir} . -N -E Modified: head/contrib/libxo/doc/api.rst ============================================================================== --- head/contrib/libxo/doc/api.rst Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/api.rst Thu Nov 7 03:57:04 2019 (r354427) @@ -1,4 +1,4 @@ -.. index: API +.. index:: API The libxo API ============= @@ -155,14 +155,14 @@ Output Styles (XO_STYLE\_\*) The libxo functions accept a set of output styles: -=============== ========================= - Flag Description -=============== ========================= - XO_STYLE_TEXT Traditional text output - XO_STYLE_XML XML encoded data - XO_STYLE_JSON JSON encoded data - XO_STYLE_HTML HTML encoded data -=============== ========================= + =============== ========================= + Flag Description + =============== ========================= + XO_STYLE_TEXT Traditional text output + XO_STYLE_XML XML encoded data + XO_STYLE_JSON JSON encoded data + XO_STYLE_HTML HTML encoded data + =============== ========================= The "XML", "JSON", and "HTML" output styles all use the UTF-8 character encoding. "TEXT" using locale-based encoding. @@ -256,26 +256,26 @@ Flags (XOF\_\*) The set of valid flags include: -=================== ========================================= - Flag Description -=================== ========================================= - XOF_CLOSE_FP Close file pointer on `xo_destroy` - XOF_COLOR Enable color and effects in output - XOF_COLOR_ALLOWED Allow color/effect for terminal output - XOF_DTRT Enable "do the right thing" mode - XOF_INFO Display info data attributes (HTML) - XOF_KEYS Emit the key attribute (XML) - XOF_NO_ENV Do not use the :ref:`libxo-options` env var - XOF_NO_HUMANIZE Display humanization (TEXT, HTML) - XOF_PRETTY Make "pretty printed" output - XOF_UNDERSCORES Replaces hyphens with underscores - XOF_UNITS Display units (XML, HMTL) - XOF_WARN Generate warnings for broken calls - XOF_WARN_XML Generate warnings in XML on stdout - XOF_XPATH Emit XPath expressions (HTML) - XOF_COLUMNS Force xo_emit to return columns used - XOF_FLUSH Flush output after each `xo_emit` call -=================== ========================================= + =================== ========================================= + Flag Description + =================== ========================================= + XOF_CLOSE_FP Close file pointer on `xo_destroy` + XOF_COLOR Enable color and effects in output + XOF_COLOR_ALLOWED Allow color/effect for terminal output + XOF_DTRT Enable "do the right thing" mode + XOF_INFO Display info data attributes (HTML) + XOF_KEYS Emit the key attribute (XML) + XOF_NO_ENV Do not use the :ref:`libxo-options` env var + XOF_NO_HUMANIZE Display humanization (TEXT, HTML) + XOF_PRETTY Make "pretty printed" output + XOF_UNDERSCORES Replaces hyphens with underscores + XOF_UNITS Display units (XML, HMTL) + XOF_WARN Generate warnings for broken calls + XOF_WARN_XML Generate warnings in XML on stdout + XOF_XPATH Emit XPath expressions (HTML) + XOF_COLUMNS Force xo_emit to return columns used + XOF_FLUSH Flush output after each `xo_emit` call + =================== ========================================= The `XOF_CLOSE_FP` flag will trigger the call of the *close_func* (provided via `xo_set_writer`) when the handle is destroyed. @@ -300,12 +300,12 @@ regardless of whether warnings are enabled. If the style is `XO_STYLE_HTML`, the following additional flags can be used: -=============== ========================================= - Flag Description -=============== ========================================= - XOF_XPATH Emit "data-xpath" attributes - XOF_INFO Emit additional info fields -=============== ========================================= + =============== ========================================= + Flag Description + =============== ========================================= + XOF_XPATH Emit "data-xpath" attributes + XOF_INFO Emit additional info fields + =============== ========================================= The `XOF_XPATH` flag enables the emission of XPath expressions detailing the hierarchy of XML elements used to encode the data field, if the @@ -317,11 +317,11 @@ output. See :ref:`field-information` for details. If the style is `XO_STYLE_XML`, the following additional flags can be used: -=============== ========================================= - Flag Description -=============== ========================================= - XOF_KEYS Flag "key" fields for XML -=============== ========================================= + =============== ========================================= + Flag Description + =============== ========================================= + XOF_KEYS Flag "key" fields for XML + =============== ========================================= The `XOF_KEYS` flag adds "key" attribute to the XML encoding for field definitions that use the "k" modifier. The key attribute has @@ -1308,52 +1308,52 @@ These values are defined in . The priority value indicates the importance and potential impact of each message: -============= ======================================================= - Priority Description -============= ======================================================= - LOG_EMERG A panic condition, normally broadcast to all users - LOG_ALERT A condition that should be corrected immediately - LOG_CRIT Critical conditions - LOG_ERR Generic errors - LOG_WARNING Warning messages - LOG_NOTICE Non-error conditions that might need special handling - LOG_INFO Informational messages - LOG_DEBUG Developer-oriented messages -============= ======================================================= + ============= ======================================================= + Priority Description + ============= ======================================================= + LOG_EMERG A panic condition, normally broadcast to all users + LOG_ALERT A condition that should be corrected immediately + LOG_CRIT Critical conditions + LOG_ERR Generic errors + LOG_WARNING Warning messages + LOG_NOTICE Non-error conditions that might need special handling + LOG_INFO Informational messages + LOG_DEBUG Developer-oriented messages + ============= ======================================================= The facility value indicates the source of message, in fairly generic terms: -=============== ======================================================= - Facility Description -=============== ======================================================= - LOG_AUTH The authorization system (e.g. :manpage:`login(1)`) - LOG_AUTHPRIV As LOG_AUTH, but logged to a privileged file - LOG_CRON The cron daemon: :manpage:`cron(8)` - LOG_DAEMON System daemons, not otherwise explicitly listed - LOG_FTP The file transfer protocol daemons - LOG_KERN Messages generated by the kernel - LOG_LPR The line printer spooling system - LOG_MAIL The mail system - LOG_NEWS The network news system - LOG_SECURITY Security subsystems, such as :manpage:`ipfw(4)` - LOG_SYSLOG Messages generated internally by :manpage:`syslogd(8)` - LOG_USER Messages generated by user processes (default) - LOG_UUCP The uucp system - LOG_LOCAL0..7 Reserved for local use -=============== ======================================================= + =============== ======================================================= + Facility Description + =============== ======================================================= + LOG_AUTH The authorization system (e.g. :manpage:`login(1)`) + LOG_AUTHPRIV As LOG_AUTH, but logged to a privileged file + LOG_CRON The cron daemon: :manpage:`cron(8)` + LOG_DAEMON System daemons, not otherwise explicitly listed + LOG_FTP The file transfer protocol daemons + LOG_KERN Messages generated by the kernel + LOG_LPR The line printer spooling system + LOG_MAIL The mail system + LOG_NEWS The network news system + LOG_SECURITY Security subsystems, such as :manpage:`ipfw(4)` + LOG_SYSLOG Messages generated internally by :manpage:`syslogd(8)` + LOG_USER Messages generated by user processes (default) + LOG_UUCP The uucp system + LOG_LOCAL0..7 Reserved for local use + =============== ======================================================= In addition to the values listed above, xo_open_log accepts a set of addition flags requesting specific logging behaviors: -============ ==================================================== - Flag Description -============ ==================================================== - LOG_CONS If syslogd fails, attempt to write to /dev/console - LOG_NDELAY Open the connection to :manpage:`syslogd(8)` immediately - LOG_PERROR Write the message also to standard error output - LOG_PID Log the process id with each message -============ ==================================================== + ============ ==================================================== + Flag Description + ============ ==================================================== + LOG_CONS If syslogd fails, attempt to write to /dev/console + LOG_NDELAY Open the connection to :manpage:`syslogd(8)` immediately + LOG_PERROR Write the message also to standard error output + LOG_PID Log the process id with each message + ============ ==================================================== .. index:: xo_syslog @@ -1588,26 +1588,26 @@ processing model of libxo. Content is formatted withi callbacks are made to the encoder's handler function when data is ready to be processed: -======================= ======================================= - Operation Meaning (Base function) -======================= ======================================= - XO_OP_CREATE Called when the handle is created - XO_OP_OPEN_CONTAINER Container opened (xo_open_container) - XO_OP_CLOSE_CONTAINER Container closed (xo_close_container) - XO_OP_OPEN_LIST List opened (xo_open_list) - XO_OP_CLOSE_LIST List closed (xo_close_list) - XO_OP_OPEN_LEAF_LIST Leaf list opened (xo_open_leaf_list) - XO_OP_CLOSE_LEAF_LIST Leaf list closed (xo_close_leaf_list) - XO_OP_OPEN_INSTANCE Instance opened (xo_open_instance) - XO_OP_CLOSE_INSTANCE Instance closed (xo_close_instance) - XO_OP_STRING Field with Quoted UTF-8 string - XO_OP_CONTENT Field with content - XO_OP_FINISH Finish any pending output - XO_OP_FLUSH Flush any buffered output - XO_OP_DESTROY Clean up resources - XO_OP_ATTRIBUTE An attribute name/value pair - XO_OP_VERSION A version string -======================= ======================================= + ======================= ======================================= + Operation Meaning (Base function) + ======================= ======================================= + XO_OP_CREATE Called when the handle is created + XO_OP_OPEN_CONTAINER Container opened (xo_open_container) + XO_OP_CLOSE_CONTAINER Container closed (xo_close_container) + XO_OP_OPEN_LIST List opened (xo_open_list) + XO_OP_CLOSE_LIST List closed (xo_close_list) + XO_OP_OPEN_LEAF_LIST Leaf list opened (xo_open_leaf_list) + XO_OP_CLOSE_LEAF_LIST Leaf list closed (xo_close_leaf_list) + XO_OP_OPEN_INSTANCE Instance opened (xo_open_instance) + XO_OP_CLOSE_INSTANCE Instance closed (xo_close_instance) + XO_OP_STRING Field with Quoted UTF-8 string + XO_OP_CONTENT Field with content + XO_OP_FINISH Finish any pending output + XO_OP_FLUSH Flush any buffered output + XO_OP_DESTROY Clean up resources + XO_OP_ATTRIBUTE An attribute name/value pair + XO_OP_VERSION A version string + ======================= ======================================= For all the open and close operations, the name parameter holds the name of the construct. For string, content, and attribute operations, Modified: head/contrib/libxo/doc/conf.py ============================================================================== --- head/contrib/libxo/doc/conf.py Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/conf.py Thu Nov 7 03:57:04 2019 (r354427) @@ -21,7 +21,15 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +import subprocess +# +# Instead of hardcoding the version number here, we read it from the +# project's configure script +# +vers_cmd = "grep AC_INIT ../configure.ac | awk '{ print substr($2, 2, length($2) - 3);}'" +version = subprocess.check_output(vers_cmd, shell=True).decode("utf-8") + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -47,7 +55,7 @@ master_doc = 'index' # General information about the project. project = 'libxo' -copyright = '2017, Juniper Networks' +copyright = '2017-2019, Juniper Networks Inc' author = 'Phil Shafer' default_role = 'code' primary_domain = 'c' @@ -58,9 +66,9 @@ smart_quotes = False # built documents. # # The short X.Y version. -version = '0.8.4' +#version = 'develop' # The full version, including alpha/beta/rc tags. -release = '0.8.4' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. Copied: head/contrib/libxo/doc/encoders.rst (from r354426, vendor/Juniper/libxo/dist/doc/encoders.rst) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/doc/encoders.rst Thu Nov 7 03:57:04 2019 (r354427, copy of r354426, vendor/Juniper/libxo/dist/doc/encoders.rst) @@ -0,0 +1,269 @@ +.. index:: encoder + +Encoders +======== + +This section gives an overview of encoders, details on the encoders +that ship with libxo, and documentation for developers of future +encoders. + +Overview +-------- + +The libxo library contains software to generate four "built-in" +formats: text, XML, JSON, and HTML. These formats are common and +useful, but there are other common and useful formats that users will +want, and including them all in the libxo software would be difficult +and cumbersome. + +To allow support for additional encodings, libxo includes a +"pluggable" extension mechanism for dynamically loading new encoders. +libxo-based applications can automatically use any installed encoder. + +Use the "encoder=XXX" option to access encoders. The following +example uses the "cbor" encoder, saving the output into a file:: + + df --libxo encoder=cbor > df-output.cbor + +Encoders can support specific options that can be accessed by +following the encoder name with a colon (':') and one of more options, +separated by a plus sign "+":: + + df --libxo encoder=csv:path=filesystem+leaf=name+no-header + +This example instructs libxo to load the "csv" encoder and pass the +following options:: + + path=filesystem + leaf=name + no-header + +Each of these option is interpreted by the encoder, and all such +options names and semantics are specific to the particular encoder. +Refer to the intended encoder for documentation on its options. + +.. _csv_encoder: + +CSV - Comma Separated Values +---------------------------- + +libxo ships with a custom encoder for "CSV" files, a common format for +comma separated values. The output of the CSV encoder can be loaded +directly into spreadsheets or similar applications. + +A standard for CSV files is provided in :RFC:`4180`, but since the +format predates that standard by decades, there are many minor +differences in CSV file consumers and their expectations. The CSV +encoder has a number of options to tailor output to those +expectations. + +Consider the following XML:: + + % list-items --libxo xml,pretty + + + + GRO-000-415 + gum + 1412 + 54 + 10 + + + HRD-000-212 + rope + 85 + 4 + 2 + + + HRD-000-517 + ladder + 0 + 2 + 1 + + + + +This output is a list of `instances` (named "item"), each containing a +set of `leafs` ("sku", "name", etc). + +The CSV encoder will emit the leaf values in this output as `fields` +inside a CSV `record`, which is a line containing a set of +comma-separated values:: + + % list-items --libxo encoder=csv + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +Be aware that since the CSV encoder looks for data instances, when +used with :ref:`xo`, the `--instance` option will be needed:: + + % xo --libxo encoder=csv --instance foo 'The {:product} is {:status}\n' stereo "in route" + product,status + stereo,in route + +.. _csv_path: + +The `path` Option +~~~~~~~~~~~~~~~~~ + +By default, the CSV encoder will attempt to emit any list instance +generated by the application. In some cases, this may be +unacceptable, and a specific list may be desired. + +Use the "path" option to limit the processing of output to a specific +hierarchy. The path should be one or more names of containers or +lists. + +For example, if the "list-items" application generates other lists, +the user can give "path=top/data/item" as a path:: + + % list-items --libxo encoder=csv:path=top/data/item + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +Paths are "relative", meaning they need not be a complete set +of names to the list. This means that "path=item" may be sufficient +for the above example. + +.. _csv_leafs: + +The `leafs` Option +~~~~~~~~~~~~~~~~~~ + +The CSV encoding requires that all lines of output have the same +number of fields with the same order. In contrast, XML and JSON allow +any order (though libxo forces key leafs to appear before other +leafs). + +To maintain a consistent set of fields inside the CSV file, the same +set of leafs must be selected from each list item. By default, the +CSV encoder records the set of leafs that appear in the first list +instance it processes, and extract only those leafs from future +instances. If the first instance is missing a leaf that is desired by +the consumer, the "leaf" option can be used to ensure that an empty +value is recorded for instances that lack a particular leaf. + +The "leafs" option can also be used to exclude leafs, limiting the +output to only those leafs provided. + +In addition, the order of the output fields follows the order in which +the leafs are listed. "leafs=one.two" and "leafs=two.one" give +distinct output. + +So the "leafs" option can be used to expand, limit, and order the set +of leafs. + +The value of the leafs option should be one or more leaf names, +separated by a period ("."):: + + % list-items --libxo encoder=csv:leafs=sku.on-order + sku,on-order + GRO-000-415,10 + HRD-000-212,2 + HRD-000-517,1 + % list-items -libxo encoder=csv:leafs=on-order.sku + on-order,sku + 10,GRO-000-415 + 2,HRD-000-212 + 1,HRD-000-517 + +Note that since libxo uses terminology from YANG (:RFC:`7950`), the +data modeling language for NETCONF (:RFC:`6241`), which uses "leafs" +as the plural form of "leaf". libxo follows that convention. + +.. _csv_no_header: + +The `no-header` Option +~~~~~~~~~~~~~~~~~~~~~~ + +CSV files typical begin with a line that defines the fields included +in that file, in an attempt to make the contents self-defining:: + + sku,name,sold,in-stock,on-order + GRO-000-415,gum,1412,54,10 + HRD-000-212,rope,85,4,2 + HRD-000-517,ladder,0,2,1 + +There is no reliable mechanism for determining whether this header +line is included, so the consumer must make an assumption. + +The csv encoder defaults to producing the header line, but the +"no-header" option can be included to avoid the header line. + +.. _csv_no_quotes: + +The `no-quotes` Option +~~~~~~~~~~~~~~~~~~~~~~ + +:RFC:`4180` specifies that fields containing spaces should be quoted, but +many CSV consumers do not handle quotes. The "no-quotes" option +instruct the CSV encoder to avoid the use of quotes. + +.. _csv_dos: + +The `dos` Option +~~~~~~~~~~~~~~~~ + +:RFC:`4180` defines the end-of-line marker as a carriage return +followed by a newline. This `CRLF` convention dates from the distant +past, but its use was anchored in the 1980s by the `DOS` operating +system. + +The CSV encoder defaults to using the standard Unix end-of-line +marker, a simple newline. Use the "dos" option to use the `CRLF` +convention. + +The Encoder API +--------------- + +The encoder API consists of three distinct phases: + +- loading the encoder +- initializing the encoder +- feeding operations to the encoder + +To load the encoder, libxo will open a shared library named: + + ${prefix}/lib/libxo/encoder/${name}.enc + +This file is typically a symbolic link to a dynamic library, suitable +for `dlopen`(). libxo looks for a symbol called +`xo_encoder_library_init` inside that library and calls it with the +arguments defined in the header file "xo_encoder.h". This function +should look as follows:: + + int + xo_encoder_library_init (XO_ENCODER_INIT_ARGS) + { + arg->xei_version = XO_ENCODER_VERSION; + arg->xei_handler = test_handler; + + return 0; + } + +Several features here allow for future compatibility: the macro +XO_ENCODER_INIT_ARGS allows the arguments to this function change over +time, and the XO_ENCODER_VERSION allows the library to tell libxo +which version of the API it was compiled with. + +The function places in xei_handler should be have the signature:: + + static int + test_handler (XO_ENCODER_HANDLER_ARGS) + { + ... + +This function will be called with the "op" codes defined in +"xo_encoder.h". Each op code represents a distinct event in the libxo +processing model. For example OP_OPEN_CONTAINER tells the encoder +that a new container has been opened, and the encoder can behave in an +appropriate manner. + + Modified: head/contrib/libxo/doc/faq.rst ============================================================================== --- head/contrib/libxo/doc/faq.rst Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/faq.rst Thu Nov 7 03:57:04 2019 (r354427) @@ -202,8 +202,7 @@ will lead users to ask the difference between the two there is no difference, use only one of the field names. If there is a difference, change the names to make that difference more obvious. -.. ignore for now, since we want can't have generated content - What does this message mean? - ---------------------------- +What does this message mean? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!include-file xolint.txt +.. include:: xolint.rst Modified: head/contrib/libxo/doc/field-formatting.rst ============================================================================== --- head/contrib/libxo/doc/field-formatting.rst Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/field-formatting.rst Thu Nov 7 03:57:04 2019 (r354427) @@ -53,48 +53,48 @@ removed eventually. The format character is described in the following table: -===== ================= ====================== - Ltr Argument Type Format -===== ================= ====================== - d int base 10 (decimal) - i int base 10 (decimal) - o int base 8 (octal) - u unsigned base 10 (decimal) - x unsigned base 16 (hex) - X unsigned long base 16 (hex) - D long base 10 (decimal) - O unsigned long base 8 (octal) - U unsigned long base 10 (decimal) - e double [-]d.ddde+-dd - E double [-]d.dddE+-dd - f double [-]ddd.ddd - F double [-]ddd.ddd - g double as 'e' or 'f' - G double as 'E' or 'F' - a double [-]0xh.hhhp[+-]d - A double [-]0Xh.hhhp[+-]d - c unsigned char a character - C wint_t a character - s char \* a UTF-8 string - S wchar_t \* a unicode/WCS string - p void \* '%#lx' -===== ================= ====================== + ===== ================= ====================== + Ltr Argument Type Format + ===== ================= ====================== + d int base 10 (decimal) + i int base 10 (decimal) + o int base 8 (octal) + u unsigned base 10 (decimal) + x unsigned base 16 (hex) + X unsigned long base 16 (hex) + D long base 10 (decimal) + O unsigned long base 8 (octal) + U unsigned long base 10 (decimal) + e double [-]d.ddde+-dd + E double [-]d.dddE+-dd + f double [-]ddd.ddd + F double [-]ddd.ddd + g double as 'e' or 'f' + G double as 'E' or 'F' + a double [-]0xh.hhhp[+-]d + A double [-]0Xh.hhhp[+-]d + c unsigned char a character + C wint_t a character + s char \* a UTF-8 string + S wchar_t \* a unicode/WCS string + p void \* '%#lx' + ===== ================= ====================== The 'h' and 'l' modifiers affect the size and treatment of the argument: -===== ============= ==================== - Mod d, i o, u, x, X -===== ============= ==================== - hh signed char unsigned char - h short unsigned short - l long unsigned long - ll long long unsigned long long - j intmax_t uintmax_t - t ptrdiff_t ptrdiff_t - z size_t size_t - q quad_t u_quad_t -===== ============= ==================== + ===== ============= ==================== + Mod d, i o, u, x, X + ===== ============= ==================== + hh signed char unsigned char + h short unsigned short + l long unsigned long + ll long long unsigned long long + j intmax_t uintmax_t + t ptrdiff_t ptrdiff_t + z size_t size_t + q quad_t u_quad_t + ===== ============= ==================== .. index:: UTF-8 .. index:: Locale @@ -122,14 +122,14 @@ style:: xo_emit("All strings are utf-8 content {:tag/%ls}", L"except for wide strings"); -======== ================== =============================== - Format Argument Type Argument Contents -======== ================== =============================== - %s const char \* UTF-8 string - %S const char \* UTF-8 string (alias for '%ls') - %ls const wchar_t \* Wide character UNICODE string - %hs const char * locale-based string -======== ================== =============================== + ======== ================== =============================== + Format Argument Type Argument Contents + ======== ================== =============================== + %s const char \* UTF-8 string + %S const char \* UTF-8 string (alias for '%ls') + %ls const wchar_t \* Wide character UNICODE string + %hs const char * locale-based string + ======== ================== =============================== .. admonition:: "Long", not "locale" @@ -266,21 +266,21 @@ incompatible with printf-like testing: If none of these features are in use by your code, then using the "_p" variants might be wise: -================== ======================== - Function printf-like Equivalent -================== ======================== - xo_emit_hv xo_emit_hvp - xo_emit_h xo_emit_hp - xo_emit xo_emit_p - xo_emit_warn_hcv xo_emit_warn_hcvp - xo_emit_warn_hc xo_emit_warn_hcp - xo_emit_warn_c xo_emit_warn_cp - xo_emit_warn xo_emit_warn_p - xo_emit_warnx xo_emit_warnx_p - xo_emit_err xo_emit_err_p - xo_emit_errx xo_emit_errx_p - xo_emit_errc xo_emit_errc_p -================== ======================== + ================== ======================== + Function printf-like Equivalent + ================== ======================== + xo_emit_hv xo_emit_hvp + xo_emit_h xo_emit_hp + xo_emit xo_emit_p + xo_emit_warn_hcv xo_emit_warn_hcvp + xo_emit_warn_hc xo_emit_warn_hcp + xo_emit_warn_c xo_emit_warn_cp + xo_emit_warn xo_emit_warn_p + xo_emit_warnx xo_emit_warnx_p + xo_emit_err xo_emit_err_p + xo_emit_errx xo_emit_errx_p + xo_emit_errc xo_emit_errc_p + ================== ======================== .. index:: performance .. index:: XOEF_RETAIN @@ -305,16 +305,16 @@ xo_emit_f() function. A complete set of xo_emit_f fun match all the xo_emit function signatures (with handles, varadic argument, and printf-like flags): -================== ======================== - Function Flags Equivalent -================== ======================== - xo_emit_hv xo_emit_hvf - xo_emit_h xo_emit_hf - xo_emit xo_emit_f - xo_emit_hvp xo_emit_hvfp - xo_emit_hp xo_emit_hfp - xo_emit_p xo_emit_fp -================== ======================== + ================== ======================== + Function Flags Equivalent + ================== ======================== + xo_emit_hv xo_emit_hvf + xo_emit_h xo_emit_hf + xo_emit xo_emit_f + xo_emit_hvp xo_emit_hvfp + xo_emit_hp xo_emit_hfp + xo_emit_p xo_emit_fp + ================== ======================== The format string must be immutable across multiple calls to xo_emit_f(), since the library retains the string. Typically this is done by using Modified: head/contrib/libxo/doc/field-modifiers.rst ============================================================================== --- head/contrib/libxo/doc/field-modifiers.rst Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/field-modifiers.rst Thu Nov 7 03:57:04 2019 (r354427) @@ -8,26 +8,26 @@ Field Modifiers Field modifiers are flags which modify the way content emitted for particular output styles: -=== =============== =================================================== - M Name Description -=== =============== =================================================== - a argument The content appears as a 'const char \*' argument - c colon A colon (":") is appended after the label - d display Only emit field for display styles (text/HTML) - e encoding Only emit for encoding styles (XML/JSON) - g gettext Call gettext on field's render content - h humanize (hn) Format large numbers in human-readable style -\ hn-space Humanize: Place space between numeric and unit -\ hn-decimal Humanize: Add a decimal digit, if number < 10 -\ hn-1000 Humanize: Use 1000 as divisor instead of 1024 - k key Field is a key, suitable for XPath predicates - l leaf-list Field is a leaf-list - n no-quotes Do not quote the field when using JSON style - p plural Gettext: Use comma-separated plural form - q quotes Quote the field when using JSON style - t trim Trim leading and trailing whitespace - w white A blank (" ") is appended after the label -=== =============== =================================================== + === =============== =================================================== + M Name Description + === =============== =================================================== + a argument The content appears as a 'const char \*' argument + c colon A colon (":") is appended after the label + d display Only emit field for display styles (text/HTML) + e encoding Only emit for encoding styles (XML/JSON) + g gettext Call gettext on field's render content + h humanize (hn) Format large numbers in human-readable style + \ hn-space Humanize: Place space between numeric and unit + \ hn-decimal Humanize: Add a decimal digit, if number < 10 + \ hn-1000 Humanize: Use 1000 as divisor instead of 1024 + k key Field is a key, suitable for XPath predicates + l leaf-list Field is a leaf-list + n no-quotes Do not quote the field when using JSON style + p plural Gettext: Use comma-separated plural form + q quotes Quote the field when using JSON style + t trim Trim leading and trailing whitespace + w white A blank (" ") is appended after the label + === =============== =================================================== Roles and modifiers can also use more verbose names, when preceded by a comma. For example, the modifier string "Lwc" (or "L,white,colon") Modified: head/contrib/libxo/doc/field-roles.rst ============================================================================== --- head/contrib/libxo/doc/field-roles.rst Thu Nov 7 03:47:13 2019 (r354426) +++ head/contrib/libxo/doc/field-roles.rst Thu Nov 7 03:57:04 2019 (r354427) @@ -8,24 +8,26 @@ Field Roles Field roles are optional, and indicate the role and formatting of the content. The roles are listed below; only one role is permitted: -=== ============== ================================================= -R Name Description -=== ============== ================================================= -C color Field has color and effect controls -D decoration Field is non-text (e.g., colon, comma) -E error Field is an error message -G gettext Call gettext(3) on the format string -L label Field is text that prefixes a value -N note Field is text that follows a value -P padding Field is spaces needed for vertical alignment -T title Field is a title value for headings -U units Field is the units for the previous value field -V value Field is the name of field (the default) -W warning Field is a warning message -[ start-anchor Begin a section of anchored variable-width text -] stop-anchor End a section of anchored variable-width text -=== ============== ================================================= + === ============== ================================================= + R Name Description + === ============== ================================================= + C color Field has color and effect controls + D decoration Field is non-text (e.g., colon, comma) + E error Field is an error message + G gettext Call gettext(3) on the format string + L label Field is text that prefixes a value + N note Field is text that follows a value + P padding Field is spaces needed for vertical alignment *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Nov 7 04:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0BC51A6502; Thu, 7 Nov 2019 04:04:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477qXR408tz44KB; Thu, 7 Nov 2019 04:04:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DD0C7F7F; Thu, 7 Nov 2019 04:04:07 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7447FY054427; Thu, 7 Nov 2019 04:04:07 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7447Qc054426; Thu, 7 Nov 2019 04:04:07 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911070404.xA7447Qc054426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 7 Nov 2019 04:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354428 - head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/contrib/netbsd-tests/lib/libexecinfo X-SVN-Commit-Revision: 354428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 04:04:07 -0000 Author: lwhsu Date: Thu Nov 7 04:04:06 2019 New Revision: 354428 URL: https://svnweb.freebsd.org/changeset/base/354428 Log: Revert r354238 as the issue has been fixed in r354418 PR: 241562 Sponsored by: The FreeBSD Foundation Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Modified: head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c ============================================================================== --- head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Thu Nov 7 03:57:04 2019 (r354427) +++ head/contrib/netbsd-tests/lib/libexecinfo/t_backtrace.c Thu Nov 7 04:04:06 2019 (r354428) @@ -151,11 +151,6 @@ ATF_TC_HEAD(backtrace_fmt_basic, tc) ATF_TC_BODY(backtrace_fmt_basic, tc) { -#if defined(__i386__) - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/241562"); -#endif - myfunc(12); if (prevent_inline) From owner-svn-src-all@freebsd.org Thu Nov 7 05:30:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F8D11A7920; Thu, 7 Nov 2019 05:30:33 +0000 (UTC) (envelope-from phil@juniper.net) Received: from mx0b-00273201.pphosted.com (mx0b-00273201.pphosted.com [67.231.152.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477sS74bcQz473r; Thu, 7 Nov 2019 05:30:31 +0000 (UTC) (envelope-from phil@juniper.net) Received: from pps.filterd (m0108162.ppops.net [127.0.0.1]) by mx0b-00273201.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA75Rjie011252; Wed, 6 Nov 2019 21:30:28 -0800 Received: from nam04-sn1-obe.outbound.protection.outlook.com (mail-sn1nam04lp2057.outbound.protection.outlook.com [104.47.44.57]) by mx0b-00273201.pphosted.com with ESMTP id 2w41vhh4u2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 21:30:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYxINuj8CKiCxoWvtYXT5LnbgbUfado/IssmXP1boCrGjkQP3jpr+A6gjytmr4uFOtdhXikhShU9YR7rKvO7dW7ZDCOeNxd65qURf6nRwIxMmPRWMR5rB2lzyITL0yNbXd4oSU1xdgEyhjv+i87DcibouMBsudcgADMqWbApDeW63P+5vz7nzao/X8v96YwH5ZdBwZ/01X2Ekl8pronryE7Ii0sy3/WGFLYkssFh2QMRNLiOPgjdVxtyYJasp7v7v68HSKk55IcywEe7z447mm3KKtFl+au4/hSDqypjTFUgAF/XbqIigaNrdpz/hrDhUXc+WTe8+ReLeO/debMCCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SD4icQgiSHdvGq2OetGwHWXSht761f77yIMOlC2nzCk=; b=VZ+8mipmDxcZaT22O6AEvwOGApCYhPvwReJxMgs6fN5/JXfo4FGAakyDNAJEcr1rjPQMe6DuczLlSFhxOOQGNeVrdsWL+oa91ULDxPcPERT3Ux9UVaH5+KsRF3+99Bz6QpLG9VLKhhvy1t8dW20aDCFAHMjcY40Hk4qiOffLZi11OVwk7wISylEhxx04LHjTTCsMEKlawIxeumuYZHYNstmQV4S6F3yOfcCFoI4+tMK5vPLRRbyi7SgVPD4ilKNLZB89Uc4/lagzPj3ubFvDepidVuRNc8wkpnMc64UowZbGfiPt0ZU9IGTN9X0TgQS9Kp4Rd9eBzuvoHQ1+6nIsBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.13) smtp.rcpttodomain=freebsd.org smtp.mailfrom=juniper.net; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=juniper.net; dkim=none (message not signed); arc=none Received: from SN4PR0501CA0120.namprd05.prod.outlook.com (2603:10b6:803:42::37) by MWHPR05MB3166.namprd05.prod.outlook.com (2603:10b6:300:b4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.16; Thu, 7 Nov 2019 05:30:26 +0000 Received: from CO1NAM05FT012.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::209) by SN4PR0501CA0120.outlook.office365.com (2603:10b6:803:42::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.16 via Frontend Transport; Thu, 7 Nov 2019 05:30:25 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.13 as permitted sender) Received: from P-EXFEND-EQX-02.jnpr.net (66.129.239.13) by CO1NAM05FT012.mail.protection.outlook.com (10.152.96.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.15 via Frontend Transport; Thu, 7 Nov 2019 05:30:25 +0000 Received: from P-EXBEND-EQX-03.jnpr.net (10.104.8.56) by P-EXFEND-EQX-02.jnpr.net (10.104.8.55) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 21:30:24 -0800 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXBEND-EQX-03.jnpr.net (10.104.8.56) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 21:30:24 -0800 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 21:30:24 -0800 Received: from idle.juniper.net (idleski.juniper.net [172.25.5.10]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id xA75UL09010675; Wed, 6 Nov 2019 21:30:23 -0800 (envelope-from phil@juniper.net) Received: from [10.0.8.3] (localhost [127.0.0.1]) by idle.juniper.net (8.15.2/8.15.2) with ESMTP id xA75RTRw063400; Thu, 7 Nov 2019 00:27:29 -0500 (EST) (envelope-from phil@juniper.net) From: Phil Shafer To: Phil Shafer CC: , , Subject: Re: svn commit: r354427 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/csv contrib/libxo/encoder/test contrib/libxo/libxo contrib/libx... Date: Thu, 7 Nov 2019 00:32:45 -0500 X-Mailer: MailMate (1.13r5655) Message-ID: <0FE9B7F1-990A-428B-842A-6261563FC7A2@juniper.net> In-Reply-To: <201911070357.xA73v41Y048836@repo.freebsd.org> References: <201911070357.xA73v41Y048836@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.13; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(346002)(376002)(39860400002)(396003)(136003)(199004)(189003)(76176011)(2906002)(478600001)(51416003)(36756003)(8676002)(305945005)(81166006)(4744005)(81156014)(4326008)(53546011)(6916009)(5660300002)(6246003)(47776003)(486006)(450100002)(76506006)(229853002)(476003)(126002)(186003)(50226002)(8936002)(2616005)(26005)(7126003)(33656002)(54906003)(11346002)(16586007)(446003)(316002)(70586007)(70206006)(86362001)(426003)(6666004)(356004)(48376002)(336012)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR05MB3166; H:P-EXFEND-EQX-02.jnpr.net; FPR:; SPF:SoftFail; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7898b0a-9c69-4af0-1fde-08d7634397be X-MS-TrafficTypeDiagnostic: MWHPR05MB3166: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JQIXI5JLJqxdzL+WR0FgQ7vMosIjGAKbmmJ0kkPyo77EMAudeaQ9M2N0prsud9+AxuwNiIqLDsj/oG+EsfUx5mzqju/9iXckBqbolCkaTDEjlZPcuNXLzV4jx05F5/XnTyy4gUP6ruTOcFXeOhFox+1t8EAcCXINOLIzjahTddWL3agBvF8sNM7SevewKC797/1Q4NlhsidHQPWZoWFKXqhX2go7eprz5JxQ6CuLSTrSsoeJy1ksOJWyJ/h6WVfn78m5JC2fxrGA4dLq8R5L48HMjU3RjNLqB2ML2EGXPRVJ+CEcjZ3j3h0p8CBLQl8eUvHUgA0HUNG1BR4yqQ2x5ktmA+cbzYQe2w6yvOapJ8Q3yw4GilMYhI2IQ5XWwtKgLlipAs6ehiLQCxYHKQmFzHMW8kYsO94k19h9SC6ETDgz4P1CJSci1j2iQ9zn7Kr+ X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 05:30:25.4921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7898b0a-9c69-4af0-1fde-08d7634397be X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.13]; Helo=[P-EXFEND-EQX-02.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR05MB3166 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_09:2019-11-06,2019-11-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 malwarescore=0 phishscore=0 clxscore=1011 spamscore=0 bulkscore=0 mlxlogscore=608 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911070056 X-Rspamd-Queue-Id: 477sS74bcQz473r X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.17 / 15.00]; RCVD_COUNT_SEVEN(0.00)[11]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[juniper.net:s=PPS1017,juniper.net:s=selector1]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:67.231.152.164]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE(-1.07)[ip: (-2.52), ipnet: 67.231.152.0/24(-1.12), asn: 22843(-1.68), country: US(-0.05)]; DKIM_TRACE(0.00)[juniper.net:+]; DMARC_POLICY_ALLOW(-0.50)[juniper.net,reject]; RCVD_IN_DNSWL_LOW(-0.10)[164.152.231.67.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22843, ipnet:67.231.152.0/24, country:US]; ARC_ALLOW(-1.00)[i=1]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 05:30:33 -0000 On 6 Nov 2019, at 22:57, Phil Shafer wrote: > Import libxo-1.3.0: > - move from "oxtradoc" to RST/Sphinx documentation > - new "csv" encoder, which allows path and leaf lists > - address warnings from PVS-Stdio tool > - add "xolint" detected errors to the documentation Apologies; this commit has broken HEAD with: --- all_subdir_lib/libxo --- /usr/obj/usr/src/mips.mips64/tmp/usr/bin/ld: cannot find -lxo *** [libenc_csv.so.0.full] Error code 1 I'm investigating now. Thanks, Phil From owner-svn-src-all@freebsd.org Thu Nov 7 06:16:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4CE81A8865; Thu, 7 Nov 2019 06:16:02 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477tSd4cJCz493J; Thu, 7 Nov 2019 06:16:01 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f65.google.com with SMTP id y18so253794ywk.1; Wed, 06 Nov 2019 22:16:01 -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=isNXEhzDpo2uBK9M0klQFpHAbIKtboxijyAJazEDOfU=; b=p4x7cevOtlqxTxGR8zuNL+pkWjdogC+iC+0zM7OSl15h8oidPnoF+un86NKK5Ke+NN KqwfhxQLIzazlEuy7IjYBgxN5e5Vr45T87icU9c4DdxU9JBCewJReHfP/gTG/zkvkHQe /3DDiLUO7FQE8KGwJYYu8cFo3JHwhzEXClf/y1CQyRRM4zOMeVm/OIHUJ3O6os4IZzxt oJRqQOqtvN+fu50Dq1YnUjjBRyR9zpvwrkQUCyV6F3pJMtGNH82Kn6CJv+Onh4qKByvM 5IoOk4creBltXHDG+gL1MZC2rbgXN+w7n2dgRhzcVLBhC6B2HaM9hluIgXa+6cI3hB+L JpeA== X-Gm-Message-State: APjAAAWD9yWEBP8/DDKmFBMzEeQNmAigor++QssIftWKReGovMO13pOu V0thf/9hrsHPfd75KdB6/hPIbuvNxV7HFe1/N6wEDw== X-Google-Smtp-Source: APXvYqx4PnLH7FTEsRXyWq6f5hjgQFADfDj9idWqeTdurlca+hFYklIpURgpv9t75ayDkqa5IkASNqgbsI41fAyVn8k= X-Received: by 2002:a81:c24c:: with SMTP id t12mr994972ywg.360.1573107360424; Wed, 06 Nov 2019 22:16:00 -0800 (PST) MIME-Version: 1.0 References: <201911070357.xA73v41Y048836@repo.freebsd.org> <0FE9B7F1-990A-428B-842A-6261563FC7A2@juniper.net> In-Reply-To: <0FE9B7F1-990A-428B-842A-6261563FC7A2@juniper.net> From: Li-Wen Hsu Date: Thu, 7 Nov 2019 14:15:49 +0800 Message-ID: Subject: Re: svn commit: r354427 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/csv contrib/libxo/encoder/test contrib/libxo/libxo contrib/libx... To: Phil Shafer Cc: Phil Shafer , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 477tSd4cJCz493J X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of lwhsufreebsd@gmail.com designates 209.85.161.65 as permitted sender) smtp.mailfrom=lwhsufreebsd@gmail.com X-Spamd-Result: default: False [-3.16 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[65.161.85.209.rep.mailspike.net : 127.0.0.18]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[65.161.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.16)[ip: (-0.55), ipnet: 209.85.128.0/17(-3.21), asn: 15169(-2.01), country: US(-0.05)]; FORGED_SENDER(0.30)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 06:16:02 -0000 On Thu, Nov 7, 2019 at 1:30 PM Phil Shafer wrote: > > On 6 Nov 2019, at 22:57, Phil Shafer wrote: > > Import libxo-1.3.0: > > - move from "oxtradoc" to RST/Sphinx documentation > > - new "csv" encoder, which allows path and leaf lists > > - address warnings from PVS-Stdio tool > > - add "xolint" detected errors to the documentation > > Apologies; this commit has broken HEAD with: > > --- all_subdir_lib/libxo --- > /usr/obj/usr/src/mips.mips64/tmp/usr/bin/ld: cannot find -lxo > *** [libenc_csv.so.0.full] Error code 1 > > I'm investigating now. I'm not sure if this helps, but I found this error only happens in a clean build. It might have something to do with the dependency setting. Best, Li-Wen From owner-svn-src-all@freebsd.org Thu Nov 7 06:28:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FC8F1A8C22; Thu, 7 Nov 2019 06:28:17 +0000 (UTC) (envelope-from phil@juniper.net) Received: from mx0b-00273201.pphosted.com (mx0b-00273201.pphosted.com [67.231.152.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477tkm3kb5z49X6; Thu, 7 Nov 2019 06:28:16 +0000 (UTC) (envelope-from phil@juniper.net) Received: from pps.filterd (m0108160.ppops.net [127.0.0.1]) by mx0b-00273201.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA76RM6n022652; Wed, 6 Nov 2019 22:28:14 -0800 Received: from nam01-bn3-obe.outbound.protection.outlook.com (mail-bn3nam01lp2059.outbound.protection.outlook.com [104.47.33.59]) by mx0b-00273201.pphosted.com with ESMTP id 2w41vjh7aq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2019 22:28:14 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GIGkNQg15BpMFqOBtsn+vuipGPe3jMCqkta25OpXLOxP1GvXe4QRKAfHxpX0+/o3GFDairtXfyXIn/ofdT2DZLmKr/6odExlmk0ZJbzQ34nAvd7Ve0f/A7aRyLlNQpWgDPcAU8i6JeVt+PKRnQ8QZKtexsSY/1LxdoI02NtHznNNEz5D5pYelY54RlnbhCm2Wc9bx1ul0gD5IJk0RYaJWV+4mfiNGkwN4oXTsSBRw4U+eGgxYQraUOtz5ESD2FPxUX57mxd7+DODabJVxqyThOZvNxepq8updEEoWkYybU3n+HCrfJL2zLwGIFZ/sqKTXGl+JpHZWP2wjnorM5tHvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Fk1N0u/JSkHOZeJfcPHJtfnBEQAZdAI5IEiCAS82w4=; b=cdJyZ1cWYgKdtRkgGXFBZRN5JTbj//ejpmivG5oPPal0PUmuj4WPPTLG5Se/VlXl2e9xBiuK7Wm08Yp5u1YGX+lHm6mBdTy0z7S0hWgUV6ElSE1Vraw8SrcKeCR58XV6bmN2kqwLokOO/VukR8gRocQ0ftXTi0QbcTWh3y8frcKTqNPiG039h3gWa21bZT9mBXupM9V/aBb2Y30g5D9zFtrVdI1CaL9QnamH1nmS1nCGmkQ/8sf+JeXngyKZ21SQfxKkg2cec0M1CgY8Z7XMlYJSSrWn2zgPV9gNldsZwzGwAVkQ3GNjCFmE8O/ynJD2tEMZbQFqHiU5LAruQlk+eA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.13) smtp.rcpttodomain=freebsd.org smtp.mailfrom=juniper.net; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=juniper.net; dkim=none (message not signed); arc=none Received: from BYAPR05CA0024.namprd05.prod.outlook.com (2603:10b6:a03:c0::37) by DM5PR05MB2985.namprd05.prod.outlook.com (2603:10b6:3:54::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.15; Thu, 7 Nov 2019 06:28:12 +0000 Received: from CO1NAM05FT060.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::206) by BYAPR05CA0024.outlook.office365.com (2603:10b6:a03:c0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.16 via Frontend Transport; Thu, 7 Nov 2019 06:28:12 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.13 as permitted sender) Received: from P-EXFEND-EQX-02.jnpr.net (66.129.239.13) by CO1NAM05FT060.mail.protection.outlook.com (10.152.96.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.15 via Frontend Transport; Thu, 7 Nov 2019 06:28:11 +0000 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXFEND-EQX-02.jnpr.net (10.104.8.55) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Nov 2019 22:28:11 -0800 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 6 Nov 2019 22:28:11 -0800 Received: from idle.juniper.net (idleski.juniper.net [172.25.5.10]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id xA76S7XE005278; Wed, 6 Nov 2019 22:28:10 -0800 (envelope-from phil@juniper.net) Received: from [10.0.8.3] (localhost [127.0.0.1]) by idle.juniper.net (8.15.2/8.15.2) with ESMTP id xA76PGCD021987; Thu, 7 Nov 2019 01:25:16 -0500 (EST) (envelope-from phil@juniper.net) From: Phil Shafer To: Li-Wen Hsu CC: Phil Shafer , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r354427 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/csv contrib/libxo/encoder/test contrib/libxo/libxo contrib/libx... Date: Thu, 7 Nov 2019 01:30:32 -0500 X-Mailer: MailMate (1.13r5655) Message-ID: In-Reply-To: References: <201911070357.xA73v41Y048836@repo.freebsd.org> <0FE9B7F1-990A-428B-842A-6261563FC7A2@juniper.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.129.239.13; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(376002)(346002)(136003)(39860400002)(396003)(199004)(189003)(53546011)(70586007)(33656002)(305945005)(478600001)(81166006)(81156014)(8676002)(446003)(76176011)(11346002)(126002)(6916009)(476003)(2906002)(50226002)(2616005)(70206006)(8936002)(47776003)(316002)(7126003)(51416003)(486006)(76506006)(229853002)(4744005)(26005)(14444005)(426003)(54906003)(36756003)(50466002)(186003)(6246003)(6666004)(356004)(5660300002)(4326008)(450100002)(336012)(86362001)(16586007); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR05MB2985; H:P-EXFEND-EQX-02.jnpr.net; FPR:; SPF:SoftFail; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9a11152-87ce-4efd-c74c-08d7634ba9c0 X-MS-TrafficTypeDiagnostic: DM5PR05MB2985: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0214EB3F68 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nioehrIK6QtHxQEC/kA9J6tr567FH5AijMy9bMnSa5PpOedn+EU5msfxahKtoKxa/hUJRtiSxfM/RKd7rPtr1krEJFkoLkAH/PvuIxP+2HpAUQifVXklsLtoF6ZKx6EOpGcPY6gFYdbIxt/waPoRGqtwZ13jpp5XAhcTMCEdf/E/SIlWRL90+/MBntNdXWbFnR4VTjWnZ1/zO3xsHGzLXw6rUDadK45hwW3c1C98N+pFpj1wCtvB7ZXtBLHfwCC2A4NyNE6Z2FX0SwlNbf3IcwLgI3YS3LGgBxaP8FypwvRE6po1qa12i/0T6ak6hGvQHbxBA4Nbtg0bX5T3hoSuqT3dCBl7ewDXI9iQuSfcAuy03/FUrNYdOiCtYtyOVBLUgkBFs150DNSh+ui5gLJrU1g8RDl9RgfSV8gKw1zk4bZoayS4URD2YlTxQ+8s0Bfx X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2019 06:28:11.6804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9a11152-87ce-4efd-c74c-08d7634ba9c0 X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.13]; Helo=[P-EXFEND-EQX-02.jnpr.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB2985 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-06_09:2019-11-06,2019-11-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 clxscore=1011 priorityscore=1501 spamscore=0 mlxlogscore=592 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911070065 X-Rspamd-Queue-Id: 477tkm3kb5z49X6 X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.18 / 15.00]; RCVD_COUNT_SEVEN(0.00)[10]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[juniper.net:s=PPS1017,juniper.net:s=selector1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:67.231.152.164]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE(-1.08)[ip: (-2.53), ipnet: 67.231.152.0/24(-1.12), asn: 22843(-1.68), country: US(-0.05)]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[juniper.net:+]; DMARC_POLICY_ALLOW(-0.50)[juniper.net,reject]; RCVD_IN_DNSWL_LOW(-0.10)[164.152.231.67.list.dnswl.org : 127.0.3.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22843, ipnet:67.231.152.0/24, country:US]; ARC_ALLOW(-1.00)[i=1]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 06:28:17 -0000 On 7 Nov 2019, at 1:15, Li-Wen Hsu wrote: > I'm not sure if this helps, but I found this error only happens in a > clean build. It might have something to do with the dependency > setting. Well at least that may explain why it snuck in: My import script does an "svn update", followed by a full build of the fresh tree, and then does a build with the incoming source, but I add a -DNO_CLEAN since I'm WITH_META_MODE. The old bit it was it seemed to fail for all builds except amd64 (the one I build against). I've got a fix building now..... slowly.... Thanks, Phil From owner-svn-src-all@freebsd.org Thu Nov 7 06:59:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF3AE1A9641; Thu, 7 Nov 2019 06:59:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vQQ4dzlz4Bnc; Thu, 7 Nov 2019 06:59:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 833719D8B; Thu, 7 Nov 2019 06:59:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA76xAcF054043; Thu, 7 Nov 2019 06:59:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA76xAqR054042; Thu, 7 Nov 2019 06:59:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911070659.xA76xAqR054042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 7 Nov 2019 06:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354429 - head/contrib/llvm/lib/Target/X86 X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/X86 X-SVN-Commit-Revision: 354429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 06:59:10 -0000 Author: dim Date: Thu Nov 7 06:59:09 2019 New Revision: 354429 URL: https://svnweb.freebsd.org/changeset/base/354429 Log: Merge commit 8e34dd941 from llvm git (by Sanjay Patel): [x86] avoid crashing when splitting AVX stores with non-simple type (PR43916) The store splitting transform was assuming a simple type (MVT), but that's not necessarily the case as shown in the test. This should fix 'Assertion failed: (isSimple() && "Expected a SimpleValueType!")' when building the security/openssl111 port targeting a CPU that supports AVX, but not AVX2, such as sandybridge. PR: 241747 MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 7 04:04:06 2019 (r354428) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 7 06:59:09 2019 (r354429) @@ -21182,12 +21182,14 @@ static SDValue splitVectorStore(StoreSDNode *Store, Se "Expecting 256/512-bit op"); // Splitting volatile memory ops is not allowed unless the operation was not - // legal to begin with. We are assuming the input op is legal (this transform - // is only used for targets with AVX). + // legal to begin with. Assume the input store is legal (this transform is + // only used for targets with AVX). Note: It is possible that we have an + // illegal type like v2i128, and so we could allow splitting a volatile store + // in that case if that is important. if (Store->isVolatile()) return SDValue(); - MVT StoreVT = StoredVal.getSimpleValueType(); + EVT StoreVT = StoredVal.getValueType(); unsigned NumElems = StoreVT.getVectorNumElements(); unsigned HalfSize = StoredVal.getValueSizeInBits() / 2; unsigned HalfAlign = (128 == HalfSize ? 16 : 32); From owner-svn-src-all@freebsd.org Thu Nov 7 07:09:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 931971A9B76; Thu, 7 Nov 2019 07:09:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vdz3JmCz4CLv; Thu, 7 Nov 2019 07:09:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C1279F71; Thu, 7 Nov 2019 07:09:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA779BYd059979; Thu, 7 Nov 2019 07:09:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA779BC2059978; Thu, 7 Nov 2019 07:09:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911070709.xA779BC2059978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 07:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354430 - stable/12/sys/dev/nctgpio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/nctgpio X-SVN-Commit-Revision: 354430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:09:11 -0000 Author: avg Date: Thu Nov 7 07:09:10 2019 New Revision: 354430 URL: https://svnweb.freebsd.org/changeset/base/354430 Log: MFC r353643: move nctgpio to superio(4) bus Modified: stable/12/sys/dev/nctgpio/nctgpio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nctgpio/nctgpio.c ============================================================================== --- stable/12/sys/dev/nctgpio/nctgpio.c Thu Nov 7 06:59:09 2019 (r354429) +++ stable/12/sys/dev/nctgpio/nctgpio.c Thu Nov 7 07:09:10 2019 (r354430) @@ -42,34 +42,20 @@ #include #include -#include #include -#include - #include -#include #include +#include #include "gpio_if.h" -/* - * Global configuration registers (CR). - */ -#define NCT_CR_LDN 0x07 /* Logical Device Number */ -#define NCT_CR_CHIP_ID 0x20 /* Chip ID */ -#define NCT_CR_CHIP_ID_H 0x20 /* Chip ID (high byte) */ -#define NCT_CR_CHIP_ID_L 0x21 /* Chip ID (low byte) */ -#define NCT_CR_OPT_1 0x26 /* Global Options (1) */ - /* Logical Device Numbers. */ #define NCT_LDN_GPIO 0x07 -#define NCT_LDN_GPIO_CFG 0x08 #define NCT_LDN_GPIO_MODE 0x0f /* Logical Device 7 */ -#define NCT_LD7_GPIO_ENABLE 0x30 #define NCT_LD7_GPIO0_IOR 0xe0 #define NCT_LD7_GPIO0_DAT 0xe1 #define NCT_LD7_GPIO0_INV 0xe2 @@ -83,8 +69,6 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 -#define NCT_EXTFUNC_ENTER 0x87 -#define NCT_EXTFUNC_EXIT 0xaa #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) @@ -97,10 +81,9 @@ struct nct_softc { device_t dev; + device_t dev_f; device_t busdev; struct mtx mtx; - struct resource *portres; - int rid; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -112,22 +95,6 @@ struct nct_softc { #define GPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED) #define GPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_NOTOWNED) -#define NCT_BARRIER_WRITE(_sc) \ - bus_barrier((_sc)->portres, 0, 2, BUS_SPACE_BARRIER_WRITE) - -#define NCT_BARRIER_READ_WRITE(_sc) \ - bus_barrier((_sc)->portres, 0, 2, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE) - -static void ext_cfg_enter(struct nct_softc *); -static void ext_cfg_exit(struct nct_softc *); - -/* - * Potential Extended Function Enable Register addresses. - * Same address as EFIR. - */ -uint8_t probe_addrs[] = {0x2e, 0x4e}; - struct nuvoton_vendor_device_id { uint16_t chip_id; const char * descr; @@ -146,77 +113,7 @@ struct nuvoton_vendor_device_id { }, }; -static void -write_cfg_reg_1(struct nct_softc *sc, uint8_t reg, uint8_t value) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, reg); - NCT_BARRIER_WRITE(sc); - bus_write_1(sc->portres, 1, value); - NCT_BARRIER_WRITE(sc); -} - -static uint8_t -read_cfg_reg_1(struct nct_softc *sc, uint8_t reg) -{ - uint8_t value; - - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, reg); - NCT_BARRIER_READ_WRITE(sc); - value = bus_read_1(sc->portres, 1); - NCT_BARRIER_READ_WRITE(sc); - - return (value); -} - -static uint16_t -read_cfg_reg_2(struct nct_softc *sc, uint8_t reg) -{ - uint16_t value; - - value = read_cfg_reg_1(sc, reg) << 8; - value |= read_cfg_reg_1(sc, reg + 1); - - return (value); -} - /* - * Enable extended function mode. - * - */ -static void -ext_cfg_enter(struct nct_softc *sc) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_ENTER); - NCT_BARRIER_WRITE(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_ENTER); - NCT_BARRIER_WRITE(sc); -} - -/* - * Disable extended function mode. - * - */ -static void -ext_cfg_exit(struct nct_softc *sc) -{ - GPIO_ASSERT_LOCKED(sc); - bus_write_1(sc->portres, 0, NCT_EXTFUNC_EXIT); - NCT_BARRIER_WRITE(sc); -} - -/* - * Select a Logical Device. - */ -static void -select_ldn(struct nct_softc *sc, uint8_t ldn) -{ - write_cfg_reg_1(sc, NCT_CR_LDN, ldn); -} - -/* * Get the GPIO Input/Output register address * for a pin. */ @@ -289,10 +186,9 @@ nct_set_pin_is_output(struct nct_softc *sc, uint32_t p uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); ior &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, ior); + superio_write(sc->dev, reg, ior); } /* @@ -305,10 +201,9 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); ior |= NCT_PIN_BIT(pin_num); - write_cfg_reg_1(sc, reg, ior); + superio_write(sc->dev, reg, ior); } /* @@ -321,8 +216,7 @@ nct_pin_is_input(struct nct_softc *sc, uint32_t pin_nu uint8_t ior; reg = nct_ior_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - ior = read_cfg_reg_1(sc, reg); + ior = superio_read(sc->dev, reg); return (ior & NCT_PIN_BIT(pin_num)); } @@ -337,14 +231,13 @@ nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t value; reg = nct_dat_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - value = read_cfg_reg_1(sc, reg); + value = superio_read(sc->dev, reg); if (data) value |= NCT_PIN_BIT(pin_num); else value &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, value); + superio_write(sc->dev, reg, value); } static bool @@ -353,9 +246,8 @@ nct_read_pin(struct nct_softc *sc, uint32_t pin_num) uint8_t reg; reg = nct_dat_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - return (read_cfg_reg_1(sc, reg) & NCT_PIN_BIT(pin_num)); + return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); } static void @@ -365,10 +257,9 @@ nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); inv |= (NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, inv); + superio_write(sc->dev, reg, inv); } static void @@ -378,10 +269,9 @@ nct_set_pin_not_inverted(struct nct_softc *sc, uint32_ uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); inv &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, inv); + superio_write(sc->dev, reg, inv); } static bool @@ -391,8 +281,7 @@ nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin uint8_t inv; reg = nct_inv_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO); - inv = read_cfg_reg_1(sc, reg); + inv = superio_read(sc->dev, reg); return (inv & NCT_PIN_BIT(pin_num)); } @@ -404,10 +293,9 @@ nct_set_pin_opendrain(struct nct_softc *sc, uint32_t p uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - outcfg |= (NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, outcfg); + outcfg = superio_read(sc->dev_f, reg); + outcfg |= NCT_PIN_BIT(pin_num); + superio_write(sc->dev_f, reg, outcfg); } static void @@ -417,10 +305,9 @@ nct_set_pin_pushpull(struct nct_softc *sc, uint32_t pi uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - outcfg &= ~(NCT_PIN_BIT(pin_num)); - write_cfg_reg_1(sc, reg, outcfg); + outcfg = superio_read(sc->dev_f, reg); + outcfg &= ~NCT_PIN_BIT(pin_num); + superio_write(sc->dev_f, reg, outcfg); } static bool @@ -430,66 +317,33 @@ nct_pin_is_opendrain(struct nct_softc *sc, uint32_t pi uint8_t outcfg; reg = nct_outcfg_addr(pin_num); - select_ldn(sc, NCT_LDN_GPIO_MODE); - outcfg = read_cfg_reg_1(sc, reg); - + outcfg = superio_read(sc->dev_f, reg); return (outcfg & NCT_PIN_BIT(pin_num)); } -static void -nct_identify(driver_t *driver, device_t parent) -{ - if (device_find_child(parent, driver->name, 0) != NULL) - return; - - BUS_ADD_CHILD(parent, 0, driver->name, 0); -} - static int nct_probe(device_t dev) { - int i, j; - int rc; - struct nct_softc *sc; + int j; uint16_t chipid; - /* Make sure we do not claim some ISA PNP device. */ - if (isa_get_logicalid(dev) != 0) + if (superio_vendor(dev) != SUPERIO_VENDOR_NUVOTON) return (ENXIO); + if (superio_get_type(dev) != SUPERIO_DEV_GPIO) + return (ENXIO); - sc = device_get_softc(dev); + /* + * There are several GPIO devices, we attach only to one of them + * and use the rest without attaching. + */ + if (superio_get_ldn(dev) != NCT_LDN_GPIO) + return (ENXIO); - for (i = 0; i < nitems(probe_addrs); i++) { - sc->rid = 0; - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - probe_addrs[i], probe_addrs[i] + 1, 2, RF_ACTIVE); - if (sc->portres == NULL) - continue; - - GPIO_LOCK_INIT(sc); - - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_enter(sc); - chipid = read_cfg_reg_2(sc, NCT_CR_CHIP_ID); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - - GPIO_LOCK_DESTROY(sc); - - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - bus_delete_resource(dev, SYS_RES_IOPORT, sc->rid); - - for (j = 0; j < nitems(nct_devs); j++) { - if (chipid == nct_devs[j].chip_id) { - rc = bus_set_resource(dev, SYS_RES_IOPORT, 0, probe_addrs[i], 2); - if (rc != 0) { - device_printf(dev, "bus_set_resource failed for address 0x%02X\n", probe_addrs[i]); - continue; - } - device_set_desc(dev, nct_devs[j].descr); - return (BUS_PROBE_DEFAULT); - } + chipid = superio_devid(dev); + for (j = 0; j < nitems(nct_devs); j++) { + if (chipid == nct_devs[j].chip_id) { + device_set_desc(dev, "Nuvoton GPIO controller"); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -502,24 +356,19 @@ nct_attach(device_t dev) int i; sc = device_get_softc(dev); - - sc->rid = 0; - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - 0ul, ~0ul, 2, RF_ACTIVE); - if (sc->portres == NULL) { - device_printf(dev, "cannot allocate ioport\n"); + sc->dev = dev; + sc->dev_f = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_GPIO, + NCT_LDN_GPIO_MODE); + if (sc->dev_f == NULL) { + device_printf(dev, "failed to find LDN F\n"); return (ENXIO); } - GPIO_LOCK_INIT(sc); + /* Enable gpio0 and gpio1. */ + superio_dev_enable(dev, 0x03); - GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); - ext_cfg_enter(sc); - select_ldn(sc, NCT_LDN_GPIO); - /* Enable gpio0 and gpio1. */ - write_cfg_reg_1(sc, NCT_LD7_GPIO_ENABLE, - read_cfg_reg_1(sc, NCT_LD7_GPIO_ENABLE) | 0x03); for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -550,12 +399,7 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); GPIO_LOCK_DESTROY(sc); - return (ENXIO); } @@ -571,13 +415,6 @@ nct_detach(device_t dev) gpiobus_detach_bus(dev); GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - ext_cfg_exit(sc); - GPIO_UNLOCK(sc); - - /* Cleanup resources. */ - bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - GPIO_LOCK_DESTROY(sc); return (0); @@ -775,26 +612,25 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, static device_method_t nct_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, nct_identify), DEVMETHOD(device_probe, nct_probe), DEVMETHOD(device_attach, nct_attach), DEVMETHOD(device_detach, nct_detach), /* GPIO */ - DEVMETHOD(gpio_get_bus, nct_gpio_get_bus), - DEVMETHOD(gpio_pin_max, nct_gpio_pin_max), - DEVMETHOD(gpio_pin_get, nct_gpio_pin_get), - DEVMETHOD(gpio_pin_set, nct_gpio_pin_set), - DEVMETHOD(gpio_pin_toggle, nct_gpio_pin_toggle), - DEVMETHOD(gpio_pin_getname, nct_gpio_pin_getname), - DEVMETHOD(gpio_pin_getcaps, nct_gpio_pin_getcaps), + DEVMETHOD(gpio_get_bus, nct_gpio_get_bus), + DEVMETHOD(gpio_pin_max, nct_gpio_pin_max), + DEVMETHOD(gpio_pin_get, nct_gpio_pin_get), + DEVMETHOD(gpio_pin_set, nct_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, nct_gpio_pin_toggle), + DEVMETHOD(gpio_pin_getname, nct_gpio_pin_getname), + DEVMETHOD(gpio_pin_getcaps, nct_gpio_pin_getcaps), DEVMETHOD(gpio_pin_getflags, nct_gpio_pin_getflags), DEVMETHOD(gpio_pin_setflags, nct_gpio_pin_setflags), DEVMETHOD_END }; -static driver_t nct_isa_driver = { +static driver_t nct_driver = { "gpio", nct_methods, sizeof(struct nct_softc) @@ -802,5 +638,8 @@ static driver_t nct_isa_driver = { static devclass_t nct_devclass; -DRIVER_MODULE(nctgpio, isa, nct_isa_driver, nct_devclass, NULL, NULL); +DRIVER_MODULE(nctgpio, superio, nct_driver, nct_devclass, NULL, NULL); MODULE_DEPEND(nctgpio, gpiobus, 1, 1, 1); +MODULE_DEPEND(nctgpio, superio, 1, 1, 1); +MODULE_VERSION(nctgpio, 1); + From owner-svn-src-all@freebsd.org Thu Nov 7 07:09:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71DE01A9BD1; Thu, 7 Nov 2019 07:09:29 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vfK2Twfz4CT8; Thu, 7 Nov 2019 07:09:29 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 388959F72; Thu, 7 Nov 2019 07:09:29 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA779TVZ060041; Thu, 7 Nov 2019 07:09:29 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA779TmL060040; Thu, 7 Nov 2019 07:09:29 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911070709.xA779TmL060040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 07:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354431 - head/lib/libxo X-SVN-Group: head X-SVN-Commit-Author: phil X-SVN-Commit-Paths: head/lib/libxo X-SVN-Commit-Revision: 354431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:09:29 -0000 Author: phil Date: Thu Nov 7 07:09:28 2019 New Revision: 354431 URL: https://svnweb.freebsd.org/changeset/base/354431 Log: Back out encoder compilation to unbreak HEAD. Modified: head/lib/libxo/Makefile Modified: head/lib/libxo/Makefile ============================================================================== --- head/lib/libxo/Makefile Thu Nov 7 07:09:10 2019 (r354430) +++ head/lib/libxo/Makefile Thu Nov 7 07:09:28 2019 (r354431) @@ -114,6 +114,6 @@ MLINKS= xo_attr.3 xo_attr_h.3 \ HAS_TESTS= SUBDIR.${MK_TESTS}+= tests -SUBDIR = encoder +#SUBDIR = encoder .include From owner-svn-src-all@freebsd.org Thu Nov 7 07:15:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B61481A9ED6; Thu, 7 Nov 2019 07:15:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vmk55t5z4Cxy; Thu, 7 Nov 2019 07:15:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 783F1A145; Thu, 7 Nov 2019 07:15:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA77F2hP066149; Thu, 7 Nov 2019 07:15:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA77F2Uo066148; Thu, 7 Nov 2019 07:15:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911070715.xA77F2Uo066148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 07:15:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354432 - in stable/12: share/man/man4 sys/dev/wbwd X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/wbwd X-SVN-Commit-Revision: 354432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:15:02 -0000 Author: avg Date: Thu Nov 7 07:15:01 2019 New Revision: 354432 URL: https://svnweb.freebsd.org/changeset/base/354432 Log: MFC r353645,r353677: wbwd: move to superio(4) bus Plus related small clean-ups and improvements. Modified: stable/12/share/man/man4/wbwd.4 stable/12/sys/dev/wbwd/wbwd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/wbwd.4 ============================================================================== --- stable/12/share/man/man4/wbwd.4 Thu Nov 7 07:09:28 2019 (r354431) +++ stable/12/share/man/man4/wbwd.4 Thu Nov 7 07:15:01 2019 (r354432) @@ -25,16 +25,17 @@ .\" .\" $FreeBSD$ .\" -.Dd March 24, 2016 +.Dd October 16, 2019 .Dt WBWD 4 .Os .Sh NAME .Nm wbwd .Nd device driver for Winbond/Nuvoton Super I/O chips watchdog timer .Sh SYNOPSIS -To compile this driver into the kernel, place the following line in your +To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent +.Cd "device superio" .Cd "device wbwd" .Ed .Pp @@ -91,10 +92,6 @@ Nuvoton NCT6791 .It Nuvoton NCT6792 .El -.Pp -Driver may be forced to attach to unknown chips by adding to -.Pa /boot/device.hints : -.Cd hint.wbwd.0.at="isa" .Sh SYSCTL VARIABLES The .Nm @@ -130,6 +127,7 @@ The driver also provides further sysctl options that are hidden by default. See the source code for more information. .Sh SEE ALSO +.Xr superio 4 .Xr watchdog 4 , .Xr device.hints 5 , .Xr watchdog 8 , Modified: stable/12/sys/dev/wbwd/wbwd.c ============================================================================== --- stable/12/sys/dev/wbwd/wbwd.c Thu Nov 7 07:09:28 2019 (r354431) +++ stable/12/sys/dev/wbwd/wbwd.c Thu Nov 7 07:15:01 2019 (r354432) @@ -47,14 +47,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include -#include +#include #include #include @@ -101,13 +99,7 @@ enum chips { w83627hf, w83627s, w83697hf, w83697ug, w8 struct wb_softc { device_t dev; - struct resource *portres; - bus_space_tag_t bst; - bus_space_handle_t bsh; - int rid; eventhandler_tag ev_tag; - int (*ext_cfg_enter_f)(struct wb_softc *, u_short); - void (*ext_cfg_exit_f)(struct wb_softc *, u_short); enum chips chip; uint8_t ctl_reg; uint8_t time_reg; @@ -132,26 +124,6 @@ struct wb_softc { uint8_t reg_2; }; -static int ext_cfg_enter_0x87_0x87(struct wb_softc *, u_short); -static void ext_cfg_exit_0xaa(struct wb_softc *, u_short); - -struct winbond_superio_cfg { - uint8_t efer; /* and efir */ - int (*ext_cfg_enter_f)(struct wb_softc *, u_short); - void (*ext_cfg_exit_f)(struct wb_softc *, u_short); -} probe_addrs[] = { - { - .efer = 0x2e, - .ext_cfg_enter_f = ext_cfg_enter_0x87_0x87, - .ext_cfg_exit_f = ext_cfg_exit_0xaa, - }, - { - .efer = 0x4e, - .ext_cfg_enter_f = ext_cfg_enter_0x87_0x87, - .ext_cfg_exit_f = ext_cfg_exit_0xaa, - }, -}; - struct winbond_vendor_device_id { uint8_t device_id; enum chips chip; @@ -264,66 +236,7 @@ struct winbond_vendor_device_id { }, }; -static void -write_efir_1(struct wb_softc *sc, u_short baseport, uint8_t value) -{ - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - bus_space_write_1((sc)->bst, (sc)->bsh, 0, (value)); - else - outb(baseport, value); -} - -static uint8_t __unused -read_efir_1(struct wb_softc *sc, u_short baseport) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - return (bus_space_read_1((sc)->bst, (sc)->bsh, 0)); - else - return (inb(baseport)); -} - -static void -write_efdr_1(struct wb_softc *sc, u_short baseport, uint8_t value) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - bus_space_write_1((sc)->bst, (sc)->bsh, 1, (value)); - else - outb(baseport + 1, value); -} - -static uint8_t -read_efdr_1(struct wb_softc *sc, u_short baseport) -{ - - MPASS(sc != NULL || baseport != 0); - if (sc != NULL) - return (bus_space_read_1((sc)->bst, (sc)->bsh, 1)); - else - return (inb(baseport + 1)); -} - -static void -write_reg(struct wb_softc *sc, uint8_t reg, uint8_t value) -{ - - write_efir_1(sc, 0, reg); - write_efdr_1(sc, 0, value); -} - -static uint8_t -read_reg(struct wb_softc *sc, uint8_t reg) -{ - - write_efir_1(sc, 0, reg); - return (read_efdr_1(sc, 0)); -} - /* * Return the watchdog related registers as we last read them. This will * usually not give the current timeout or state on whether the watchdog @@ -362,18 +275,10 @@ sysctl_wb_debug_current(SYSCTL_HANDLER_ARGS) sc = arg1; - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); + sc->reg_1 = superio_read(sc->dev, sc->ctl_reg); + sc->reg_timeout = superio_read(sc->dev, sc->time_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - - sc->reg_1 = read_reg(sc, sc->ctl_reg); - sc->reg_timeout = read_reg(sc, sc->time_reg); - sc->reg_2 = read_reg(sc, sc->csr_reg); - - (*sc->ext_cfg_exit_f)(sc, 0); - return (sysctl_wb_debug(oidp, arg1, arg2, req)); } @@ -411,12 +316,7 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) sc->test_nmi = 0; return (0); } -#endif - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); - -#ifdef notyet /* * If we are testing the NMI functionality, set the flag before * forcing the timeout. @@ -425,16 +325,11 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) sc->test_nmi = 1; #endif - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - /* Force watchdog to fire. */ - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); sc->reg_2 |= WB_LDN8_CRF7_FORCE; - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(sc->dev, sc->csr_reg, sc->reg_2); - (*sc->ext_cfg_exit_f)(sc, 0); - return (0); } @@ -450,7 +345,7 @@ wb_print_state(struct wb_softc *sc, const char *msg) device_printf(sc->dev, "%s%sWatchdog %sabled. %s" "Scaling by %ds, timer at %d (%s=%ds%s). " - "CRF5 0x%02x CRF7 0x%02x\n", + "CR%02X 0x%02x CR%02X 0x%02x\n", (msg != NULL) ? msg : "", (msg != NULL) ? ": " : "", (sc->reg_timeout > 0x00) ? "en" : "dis", (sc->reg_2 & WB_LDN8_CRF7_TS) ? "Watchdog fired. " : "", @@ -459,35 +354,10 @@ wb_print_state(struct wb_softc *sc, const char *msg) (sc->reg_timeout > 0x00) ? "<" : "", sc->reg_timeout * ((sc->reg_1 & WB_LDN8_CRF5_SCALE) ? 60 : 1), (sc->reg_timeout > 0x00) ? " left" : "", - sc->reg_1, sc->reg_2); + sc->ctl_reg, sc->reg_1, sc->csr_reg, sc->reg_2); } /* - * Functions to enter and exit extended function mode. Possibly shared - * between different chips. - */ -static int -ext_cfg_enter_0x87_0x87(struct wb_softc *sc, u_short baseport) -{ - - /* - * Enable extended function mode. - * Winbond does not allow us to validate so always return success. - */ - write_efir_1(sc, baseport, 0x87); - write_efir_1(sc, baseport, 0x87); - - return (0); -} - -static void -ext_cfg_exit_0xaa(struct wb_softc *sc, u_short baseport) -{ - - write_efir_1(sc, baseport, 0xaa); -} - -/* * (Re)load the watchdog counter depending on timeout. A timeout of 0 will * disable the watchdog. */ @@ -511,20 +381,14 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int time if (sc->debug_verbose) wb_print_state(sc, "Before watchdog counter (re)load"); - if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) - return (ENXIO); - - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog) */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - if (timeout == 0) { /* Disable watchdog. */ sc->reg_timeout = 0; - write_reg(sc, sc->time_reg, sc->reg_timeout); + superio_write(sc->dev, sc->time_reg, sc->reg_timeout); } else { /* Read current scaling factor. */ - sc->reg_1 = read_reg(sc, sc->ctl_reg); + sc->reg_1 = superio_read(sc->dev, sc->ctl_reg); if (timeout > 255) { /* Set scaling factor to 60s. */ @@ -539,21 +403,19 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int time } /* In case we fired before we need to clear to fire again. */ - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_2 = superio_read(sc->dev, sc->csr_reg); if (sc->reg_2 & WB_LDN8_CRF7_TS) { sc->reg_2 &= ~WB_LDN8_CRF7_TS; - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(sc->dev, sc->csr_reg, sc->reg_2); } /* Write back scaling factor. */ - write_reg(sc, sc->ctl_reg, sc->reg_1); + superio_write(sc->dev, sc->ctl_reg, sc->reg_1); /* Set timer and arm/reset the watchdog. */ - write_reg(sc, sc->time_reg, sc->reg_timeout); + superio_write(sc->dev, sc->time_reg, sc->reg_timeout); } - (*sc->ext_cfg_exit_f)(sc, 0); - if (sc->debug_verbose) wb_print_state(sc, "After watchdog counter (re)load"); return (0); @@ -599,217 +461,110 @@ wb_watchdog_fn(void *private, u_int cmd, int *error) } } -/* - * Probe/attach the Winbond Super I/O chip. - * - * Initial abstraction to possibly support more chips: - * - Iterate over the well known base ports, try to enable extended function - * mode and read and match the device ID and device revision. Unfortunately - * the Vendor ID is in the hardware monitoring section accessible by different - * base ports only. - * - Also HEFRAS, which would tell use the base port, is only accessible after - * entering extended function mode, for which the base port is needed. - * At least check HEFRAS to match the current base port we are probing. - * - On match set the description, remember functions to enter/exit extended - * function mode as well as the base port. - */ static int -wb_probe_enable(device_t dev, int probe) +wb_probe(device_t dev) { - struct wb_softc *sc; - int error, found, i, j; - uint8_t dev_id, dev_rev, cr26; char buf[128]; + struct wb_softc *sc; + int j; + uint8_t devid; + uint8_t revid; - if (dev == NULL) - sc = NULL; - else { - sc = device_get_softc(dev); - bzero(sc, sizeof(*sc)); - sc->dev = dev; - } + if (superio_vendor(dev) != SUPERIO_VENDOR_NUVOTON) + return (ENXIO); + if (superio_get_type(dev) != SUPERIO_DEV_WDT) + return (ENXIO); - error = ENXIO; - found = 0; - for (i = 0; i < nitems(probe_addrs); i++) { - - if (sc != NULL) { - /* Allocate bus resources for IO index/data register access. */ - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - probe_addrs[i].efer, probe_addrs[i].efer + 1, 2, RF_ACTIVE); - if (sc->portres == NULL) - continue; - sc->bst = rman_get_bustag(sc->portres); - sc->bsh = rman_get_bushandle(sc->portres); - } - - error = (*probe_addrs[i].ext_cfg_enter_f)(sc, probe_addrs[i].efer); - if (error != 0) - goto cleanup; - - /* Identify the SuperIO chip. */ - write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_ID_REG); - dev_id = read_efdr_1(sc, probe_addrs[i].efer); - write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_REV_REG); - dev_rev = read_efdr_1(sc, probe_addrs[i].efer); - write_efir_1(sc, probe_addrs[i].efer, WB_CR26); - cr26 = read_efdr_1(sc, probe_addrs[i].efer); - - if (dev_id == 0xff && dev_rev == 0xff) - goto cleanup; - - /* HEFRAS of 0 means EFER at 0x2e, 1 means EFER at 0x4e. */ - if (((cr26 & 0x40) == 0x00 && probe_addrs[i].efer != 0x2e) || - ((cr26 & 0x40) == 0x40 && probe_addrs[i].efer != 0x4e)) { - if (dev != NULL) - device_printf(dev, "HEFRAS and EFER do not " - "align: EFER 0x%02x DevID 0x%02x DevRev " - "0x%02x CR26 0x%02x\n", - probe_addrs[i].efer, dev_id, dev_rev, cr26); - goto cleanup; - } - - for (j = 0; j < nitems(wb_devs); j++) { - if (wb_devs[j].device_id == dev_id) { - found = 1; - break; - } - } - - if (probe && dev != NULL) { + sc = device_get_softc(dev); + devid = superio_devid(dev) >> 8; + revid = superio_revid(dev); + for (j = 0; j < nitems(wb_devs); j++) { + if (wb_devs[j].device_id == devid) { + sc->chip = wb_devs[j].chip; snprintf(buf, sizeof(buf), "%s (0x%02x/0x%02x) Watchdog Timer", - found ? wb_devs[j].descr : - "Unknown Winbond/Nuvoton", dev_id, dev_rev); + wb_devs[j].descr, devid, revid); device_set_desc_copy(dev, buf); - } - - /* If this is hinted attach, try to guess the model. */ - if (dev != NULL && !found) { - found = 1; - j = 0; - } - -cleanup: - if (probe || !found) { - (*probe_addrs[i].ext_cfg_exit_f)(sc, probe_addrs[i].efer); - if (sc != NULL) - (void) bus_release_resource(dev, SYS_RES_IOPORT, - sc->rid, sc->portres); - } - - /* - * Stop probing if have successfully identified the SuperIO. - * Remember the extended function mode enter/exit functions - * for operations. - */ - if (found) { - if (sc != NULL) { - sc->ext_cfg_enter_f = probe_addrs[i].ext_cfg_enter_f; - sc->ext_cfg_exit_f = probe_addrs[i].ext_cfg_exit_f; - sc->chip = wb_devs[j].chip; - sc->ctl_reg = 0xf5; - sc->time_reg = 0xf6; - sc->csr_reg = 0xf7; - if (sc->chip == w83697hf || - sc->chip == w83697ug) { - sc->ctl_reg = 0xf3; - sc->time_reg = 0xf4; - } else if (sc->chip == nct6102) { - sc->ctl_reg = 0xf0; - sc->time_reg = 0xf1; - sc->csr_reg = 0xf2; - } - } return (BUS_PROBE_SPECIFIC); - } else - error = ENXIO; + } } - - return (error); -} - -static void -wb_identify(driver_t *driver, device_t parent) -{ - - if (device_find_child(parent, driver->name, 0) == NULL) { - if (wb_probe_enable(NULL, 1) <= 0) - BUS_ADD_CHILD(parent, 0, driver->name, 0); + if (bootverbose) { + device_printf(dev, + "unrecognized chip: devid 0x%02x, revid 0x%02x\n", + devid, revid); } + return (ENXIO); } static int -wb_probe(device_t dev) -{ - - /* Make sure we do not claim some ISA PNP device. */ - if (isa_get_logicalid(dev) != 0) - return (ENXIO); - - return (wb_probe_enable(dev, 1)); -} - -static int wb_attach(device_t dev) { struct wb_softc *sc; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; unsigned long timeout; - int error; uint8_t t; - error = wb_probe_enable(dev, 0); - if (error > 0) - return (ENXIO); - sc = device_get_softc(dev); - KASSERT(sc->ext_cfg_enter_f != NULL && sc->ext_cfg_exit_f != NULL, - ("%s: successful probe result but not setup correctly", __func__)); + sc->dev = dev; - /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8); - /* Make sure WDT is enabled. */ - write_reg(sc, WB_LDN8_CR30, - read_reg(sc, WB_LDN8_CR30) | WB_LDN8_CR30_ACTIVE); + superio_dev_enable(dev, WB_LDN8_CR30_ACTIVE); switch (sc->chip) { + case w83697hf: + case w83697ug: + sc->ctl_reg = 0xf3; + sc->time_reg = 0xf4; + sc->csr_reg = 0xf7; + break; + case nct6102: + sc->ctl_reg = 0xf0; + sc->time_reg = 0xf1; + sc->csr_reg = 0xf2; + break; + default: + sc->ctl_reg = 0xf5; + sc->time_reg = 0xf6; + sc->csr_reg = 0xf7; + break; + } + + switch (sc->chip) { case w83627hf: case w83627s: - t = read_reg(sc, 0x2B) & ~0x10; - write_reg(sc, 0x2B, t); /* set GPIO24 to WDT0 */ + t = superio_read(dev, 0x2B) & ~0x10; + superio_write(dev, 0x2B, t); /* set GPIO24 to WDT0 */ break; case w83697hf: /* Set pin 119 to WDTO# mode (= CR29, WDT0) */ - t = read_reg(sc, 0x29) & ~0x60; + t = superio_read(dev, 0x29) & ~0x60; t |= 0x20; - write_reg(sc, 0x29, t); + superio_write(dev, 0x29, t); break; case w83697ug: /* Set pin 118 to WDTO# mode */ - t = read_reg(sc, 0x2b) & ~0x04; - write_reg(sc, 0x2b, t); + t = superio_read(dev, 0x2b) & ~0x04; + superio_write(dev, 0x2b, t); break; case w83627thf: - t = (read_reg(sc, 0x2B) & ~0x08) | 0x04; - write_reg(sc, 0x2B, t); /* set GPIO3 to WDT0 */ + t = (superio_read(dev, 0x2B) & ~0x08) | 0x04; + superio_write(dev, 0x2B, t); /* set GPIO3 to WDT0 */ break; case w83627dhg: case w83627dhg_p: - t = read_reg(sc, 0x2D) & ~0x01; /* PIN77 -> WDT0# */ - write_reg(sc, 0x2D, t); /* set GPIO5 to WDT0 */ - t = read_reg(sc, sc->ctl_reg); + t = superio_read(dev, 0x2D) & ~0x01; /* PIN77 -> WDT0# */ + superio_write(dev, 0x2D, t); /* set GPIO5 to WDT0 */ + t = superio_read(dev, sc->ctl_reg); t |= 0x02; /* enable the WDTO# output low pulse * to the KBRST# pin */ - write_reg(sc, sc->ctl_reg, t); + superio_write(dev, sc->ctl_reg, t); break; case w83637hf: break; case w83687thf: - t = read_reg(sc, 0x2C) & ~0x80; /* PIN47 -> WDT0# */ - write_reg(sc, 0x2C, t); + t = superio_read(dev, 0x2C) & ~0x80; /* PIN47 -> WDT0# */ + superio_write(dev, 0x2C, t); break; case w83627ehf: case w83627uhg: @@ -829,19 +584,19 @@ wb_attach(device_t dev) * Don't touch its configuration, and hope the BIOS * does the right thing. */ - t = read_reg(sc, sc->ctl_reg); + t = superio_read(dev, sc->ctl_reg); t |= 0x02; /* enable the WDTO# output low pulse * to the KBRST# pin */ - write_reg(sc, sc->ctl_reg, t); + superio_write(dev, sc->ctl_reg, t); break; default: break; } /* Read the current watchdog configuration. */ - sc->reg_1 = read_reg(sc, sc->ctl_reg); - sc->reg_timeout = read_reg(sc, sc->time_reg); - sc->reg_2 = read_reg(sc, sc->csr_reg); + sc->reg_1 = superio_read(dev, sc->ctl_reg); + sc->reg_timeout = superio_read(dev, sc->time_reg); + sc->reg_2 = superio_read(dev, sc->csr_reg); /* Print current state if bootverbose or watchdog already enabled. */ if (bootverbose || (sc->reg_timeout > 0x00)) @@ -849,7 +604,7 @@ wb_attach(device_t dev) sc->reg_1 &= ~WB_LDN8_CRF5_KEYB_P20; sc->reg_1 |= WB_LDN8_CRF5_KBRST; - write_reg(sc, sc->ctl_reg, sc->reg_1); + superio_write(dev, sc->ctl_reg, sc->reg_1); /* * Clear a previous watchdog timeout event (if still set). @@ -857,10 +612,8 @@ wb_attach(device_t dev) * since one of my boards is getting stuck in reboot without it. */ sc->reg_2 &= ~(WB_LDN8_CRF7_MOUSE|WB_LDN8_CRF7_TS); - write_reg(sc, sc->csr_reg, sc->reg_2); + superio_write(dev, sc->csr_reg, sc->reg_2); - (*sc->ext_cfg_exit_f)(sc, 0); - /* Read global timeout override tunable, Add per device sysctls. */ if (TUNABLE_ULONG_FETCH("hw.wbwd.timeout_override", &timeout)) { if (timeout > 0) @@ -907,12 +660,6 @@ wb_detach(device_t dev) EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); wb_set_watchdog(sc, 0); - /* Disable extended function mode. */ - (*sc->ext_cfg_exit_f)(sc, 0); - - /* Cleanup resources. */ - (void) bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); - /* Bus subroutines take care of sysctls already. */ return (0); @@ -920,7 +667,6 @@ wb_detach(device_t dev) static device_method_t wb_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, wb_identify), DEVMETHOD(device_probe, wb_probe), DEVMETHOD(device_attach, wb_attach), DEVMETHOD(device_detach, wb_detach), @@ -928,7 +674,7 @@ static device_method_t wb_methods[] = { DEVMETHOD_END }; -static driver_t wb_isa_driver = { +static driver_t wb_driver = { "wbwd", wb_methods, sizeof(struct wb_softc) @@ -936,4 +682,6 @@ static driver_t wb_isa_driver = { static devclass_t wb_devclass; -DRIVER_MODULE(wb, isa, wb_isa_driver, wb_devclass, NULL, NULL); +DRIVER_MODULE(wb, superio, wb_driver, wb_devclass, NULL, NULL); +MODULE_DEPEND(wb, superio, 1, 1, 1); +MODULE_VERSION(wb, 1); From owner-svn-src-all@freebsd.org Thu Nov 7 07:21:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0FEC1AA041; Thu, 7 Nov 2019 07:21:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vw43Vr0z4DWk; Thu, 7 Nov 2019 07:21:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AC00A2A0; Thu, 7 Nov 2019 07:21:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA77LOhv068772; Thu, 7 Nov 2019 07:21:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA77LOhK068771; Thu, 7 Nov 2019 07:21:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911070721.xA77LOhK068771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 07:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354433 - head X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:21:24 -0000 Author: avg Date: Thu Nov 7 07:21:23 2019 New Revision: 354433 URL: https://svnweb.freebsd.org/changeset/base/354433 Log: add a note about nctgpio and wbwd move to superio Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Nov 7 07:15:01 2019 (r354432) +++ head/UPDATING Thu Nov 7 07:21:23 2019 (r354433) @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191107: + The nctgpio and wbwd drivers have been moved to the superio bus. + If you have one of these drivers in a kernel configuration, then + you should add device superio to it. If you use one of these drivers + as a module and you compile a custom set of modules, then you should + add superio to the set. + 20191021: KPIs for network drivers to access interface addresses have changed. Users need to recompile NIC driver modules together with kernel. From owner-svn-src-all@freebsd.org Thu Nov 7 07:21:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 402A71AA0AB; Thu, 7 Nov 2019 07:21:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 477vwV0wglz4Dgl; Thu, 7 Nov 2019 07:21:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 039F0A2CA; Thu, 7 Nov 2019 07:21:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA77Ljxk068836; Thu, 7 Nov 2019 07:21:45 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA77LjoB068835; Thu, 7 Nov 2019 07:21:45 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911070721.xA77LjoB068835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 07:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354434 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 354434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 07:21:46 -0000 Author: avg Date: Thu Nov 7 07:21:45 2019 New Revision: 354434 URL: https://svnweb.freebsd.org/changeset/base/354434 Log: add a note about nctgpio and wbwd move to superio Modified: stable/12/UPDATING Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Thu Nov 7 07:21:23 2019 (r354433) +++ stable/12/UPDATING Thu Nov 7 07:21:45 2019 (r354434) @@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20191107: + The nctgpio and wbwd drivers have been moved to the superio bus. + If you have one of these drivers in a kernel configuration, then + you should add device superio to it. If you use one of these drivers + as a module and you compile a custom set of modules, then you should + add superio to the set. + 20191024: The tap(4) driver has been folded into tun(4), and the module has been renamed to tuntap. You should update any kld_list="if_tap" or From owner-svn-src-all@freebsd.org Thu Nov 7 11:17:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB56B1B0487; Thu, 7 Nov 2019 11:17:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47817z5yHwz4VdP; Thu, 7 Nov 2019 11:17:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1348CE27; Thu, 7 Nov 2019 11:17:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7BH3PI010874; Thu, 7 Nov 2019 11:17:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7BH390010873; Thu, 7 Nov 2019 11:17:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911071117.xA7BH390010873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 7 Nov 2019 11:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354435 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 354435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 11:17:04 -0000 Author: tsoome Date: Thu Nov 7 11:17:03 2019 New Revision: 354435 URL: https://svnweb.freebsd.org/changeset/base/354435 Log: loader: implement fallback efi_devpath_to_name() UEFI 1.10 on macs does not seem to provide devpath to name translation, provide our own (limited) version, so we can get information about commmon devices. MFC after: 1 week Modified: head/stand/efi/libefi/devpath.c Modified: head/stand/efi/libefi/devpath.c ============================================================================== --- head/stand/efi/libefi/devpath.c Thu Nov 7 07:21:45 2019 (r354434) +++ head/stand/efi/libefi/devpath.c Thu Nov 7 11:17:03 2019 (r354435) @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include static EFI_GUID ImageDevicePathGUID = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID DevicePathToTextGUID = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol; -static EFI_GUID DevicePathFromTextGUID = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; +static EFI_GUID DevicePathFromTextGUID = + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol; EFI_DEVICE_PATH * @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle) return (devpath); } +static char * +efi_make_tail(char *suffix) +{ + char *tail; + + tail = NULL; + if (suffix != NULL) + (void)asprintf(&tail, "/%s", suffix); + else + tail = strdup(""); + return (tail); +} + +typedef struct { + EFI_DEVICE_PATH Header; + EFI_GUID Guid; + UINT8 VendorDefinedData[1]; +} __packed VENDOR_DEVICE_PATH_WITH_DATA; + +static char * +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffix) +{ + uint32_t size = DevicePathNodeLength(&node->Header) - sizeof(*node); + VENDOR_DEVICE_PATH_WITH_DATA *dp = (VENDOR_DEVICE_PATH_WITH_DATA *)node; + char *name, *tail, *head; + char *uuid; + int rv; + + uuid_to_string((const uuid_t *)(void *)&node->Guid, &uuid, &rv); + if (rv != uuid_s_ok) + return (NULL); + + tail = efi_make_tail(suffix); + rv = asprintf(&head, "%sVendor(%s)[%x:", type, uuid, size); + free(uuid); + if (rv < 0) + return (NULL); + + if (DevicePathNodeLength(&node->Header) > sizeof(*node)) { + for (uint32_t i = 0; i < size; i++) { + rv = asprintf(&name, "%s%02x", head, + dp->VendorDefinedData[i]); + if (rv < 0) { + free(tail); + free(head); + return (NULL); + } + free(head); + head = name; + } + } + + if (asprintf(&name, "%s]%s", head, tail) < 0) + name = NULL; + free(head); + free(tail); + return (name); +} + +static char * +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix) +{ + uint8_t subtype = DevicePathSubType(node); + char *name, *tail; + + tail = efi_make_tail(suffix); + switch (subtype) { + case HW_PCI_DP: + if (asprintf(&name, "Pci(%x,%x)%s", + ((PCI_DEVICE_PATH *)node)->Function, + ((PCI_DEVICE_PATH *)node)->Device, tail) < 0) + name = NULL; + break; + case HW_PCCARD_DP: + if (asprintf(&name, "PCCARD(%x)%s", + ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, tail) < 0) + name = NULL; + break; + case HW_MEMMAP_DP: + if (asprintf(&name, "MMap(%x,%" PRIx64 ",%" PRIx64 ")%s", + ((MEMMAP_DEVICE_PATH *)node)->MemoryType, + ((MEMMAP_DEVICE_PATH *)node)->StartingAddress, + ((MEMMAP_DEVICE_PATH *)node)->EndingAddress, tail) < 0) + name = NULL; + break; + case HW_VENDOR_DP: + name = efi_vendor_path("Hardware", + (VENDOR_DEVICE_PATH *)node, tail); + break; + case HW_CONTROLLER_DP: + if (asprintf(&name, "Ctrl(%x)%s", + ((CONTROLLER_DEVICE_PATH *)node)->Controller, tail) < 0) + name = NULL; + break; + default: + if (asprintf(&name, "UnknownHW(%x)%s", subtype, tail) < 0) + name = NULL; + break; + } + free(tail); + return (name); +} + +static char * +efi_acpi_dev_path(EFI_DEVICE_PATH *node, char *suffix) +{ + uint8_t subtype = DevicePathSubType(node); + ACPI_HID_DEVICE_PATH *acpi = (ACPI_HID_DEVICE_PATH *)node; + char *name, *tail; + + tail = efi_make_tail(suffix); + switch (subtype) { + case ACPI_DP: + if ((acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { + switch (EISA_ID_TO_NUM (acpi->HID)) { + case 0x0a03: + if (asprintf(&name, "PciRoot(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + case 0x0a08: + if (asprintf(&name, "PcieRoot(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + case 0x0604: + if (asprintf(&name, "Floppy(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + case 0x0301: + if (asprintf(&name, "Keyboard(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + case 0x0501: + if (asprintf(&name, "Serial(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + case 0x0401: + if (asprintf(&name, "ParallelPort(%x)%s", + acpi->UID, tail) < 0) + name = NULL; + break; + default: + if (asprintf(&name, "Acpi(PNP%04x,%x)%s", + EISA_ID_TO_NUM(acpi->HID), + acpi->UID, tail) < 0) + name = NULL; + break; + } + } else { + if (asprintf(&name, "Acpi(%08x,%x)%s", + acpi->HID, acpi->UID, tail) < 0) + name = NULL; + } + break; + case ACPI_EXTENDED_DP: + default: + if (asprintf(&name, "UnknownACPI(%x)%s", subtype, tail) < 0) + name = NULL; + break; + } + free(tail); + return (name); +} + +static char * +efi_messaging_dev_path(EFI_DEVICE_PATH *node, char *suffix) +{ + uint8_t subtype = DevicePathSubType(node); + char *name; + char *tail; + + tail = efi_make_tail(suffix); + switch (subtype) { + case MSG_ATAPI_DP: + if (asprintf(&name, "ATA(%s,%s,%x)%s", + ((ATAPI_DEVICE_PATH *)node)->PrimarySecondary == 1 ? + "Secondary" : "Primary", + ((ATAPI_DEVICE_PATH *)node)->SlaveMaster == 1 ? + "Slave" : "Master", + ((ATAPI_DEVICE_PATH *)node)->Lun, tail) < 0) + name = NULL; + break; + case MSG_SCSI_DP: + if (asprintf(&name, "SCSI(%x,%x)%s", + ((SCSI_DEVICE_PATH *)node)->Pun, + ((SCSI_DEVICE_PATH *)node)->Lun, tail) < 0) + name = NULL; + break; + case MSG_FIBRECHANNEL_DP: + if (asprintf(&name, "Fibre(%" PRIx64 ",%" PRIx64 ")%s", + ((FIBRECHANNEL_DEVICE_PATH *)node)->WWN, + ((FIBRECHANNEL_DEVICE_PATH *)node)->Lun, tail) < 0) + name = NULL; + break; + case MSG_1394_DP: + if (asprintf(&name, "I1394(%016" PRIx64 ")%s", + ((F1394_DEVICE_PATH *)node)->Guid, tail) < 0) + name = NULL; + break; + case MSG_USB_DP: + if (asprintf(&name, "USB(%x,%x)%s", + ((USB_DEVICE_PATH *)node)->ParentPortNumber, + ((USB_DEVICE_PATH *)node)->InterfaceNumber, tail) < 0) + name = NULL; + break; + case MSG_USB_CLASS_DP: + if (asprintf(&name, "UsbClass(%x,%x,%x,%x,%x)%s", + ((USB_CLASS_DEVICE_PATH *)node)->VendorId, + ((USB_CLASS_DEVICE_PATH *)node)->ProductId, + ((USB_CLASS_DEVICE_PATH *)node)->DeviceClass, + ((USB_CLASS_DEVICE_PATH *)node)->DeviceSubClass, + ((USB_CLASS_DEVICE_PATH *)node)->DeviceProtocol, tail) < 0) + name = NULL; + break; + case MSG_MAC_ADDR_DP: + if (asprintf(&name, "MAC(%02x:%02x:%02x:%02x:%02x:%02x,%x)%s", + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[0], + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[1], + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[2], + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[3], + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[4], + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[5], + ((MAC_ADDR_DEVICE_PATH *)node)->IfType, tail) < 0) + name = NULL; + break; + case MSG_VENDOR_DP: + name = efi_vendor_path("Messaging", + (VENDOR_DEVICE_PATH *)node, tail); + break; + case MSG_UART_DP: + if (asprintf(&name, "UART(%" PRIu64 ",%u,%x,%x)%s", + ((UART_DEVICE_PATH *)node)->BaudRate, + ((UART_DEVICE_PATH *)node)->DataBits, + ((UART_DEVICE_PATH *)node)->Parity, + ((UART_DEVICE_PATH *)node)->StopBits, tail) < 0) + name = NULL; + break; + case MSG_SATA_DP: + if (asprintf(&name, "Sata(%x,%x,%x)%s", + ((SATA_DEVICE_PATH *)node)->HBAPortNumber, + ((SATA_DEVICE_PATH *)node)->PortMultiplierPortNumber, + ((SATA_DEVICE_PATH *)node)->Lun, tail) < 0) + name = NULL; + break; + default: + if (asprintf(&name, "UnknownMessaging(%x)%s", + subtype, tail) < 0) + name = NULL; + break; + } + free(tail); + return (name); +} + +static char * +efi_media_dev_path(EFI_DEVICE_PATH *node, char *suffix) +{ + uint8_t subtype = DevicePathSubType(node); + HARDDRIVE_DEVICE_PATH *hd; + char *name; + char *str; + char *tail; + int rv; + + tail = efi_make_tail(suffix); + name = NULL; + switch (subtype) { + case MEDIA_HARDDRIVE_DP: + hd = (HARDDRIVE_DEVICE_PATH *)node; + switch (hd->SignatureType) { + case SIGNATURE_TYPE_MBR: + if (asprintf(&name, "HD(%d,MBR,%08x,%" PRIx64 + ",%" PRIx64 ")%s", + hd->PartitionNumber, + *((uint32_t *)(uintptr_t)&hd->Signature[0]), + hd->PartitionStart, + hd->PartitionSize, tail) < 0) + name = NULL; + break; + case SIGNATURE_TYPE_GUID: + name = NULL; + uuid_to_string((const uuid_t *)(void *) + &hd->Signature[0], &str, &rv); + if (rv != uuid_s_ok) + break; + rv = asprintf(&name, "HD(%d,GPT,%s,%" PRIx64 ",%" + PRIx64 ")%s", + hd->PartitionNumber, str, + hd->PartitionStart, hd->PartitionSize, tail); + free(str); + break; + default: + if (asprintf(&name, "HD(%d,%d,0)%s", + hd->PartitionNumber, + hd->SignatureType, tail) < 0) { + name = NULL; + } + break; + } + break; + case MEDIA_CDROM_DP: + if (asprintf(&name, "CD(%x,%" PRIx64 ",%" PRIx64 ")%s", + ((CDROM_DEVICE_PATH *)node)->BootEntry, + ((CDROM_DEVICE_PATH *)node)->PartitionStart, + ((CDROM_DEVICE_PATH *)node)->PartitionSize, tail) < 0) { + name = NULL; + } + break; + case MEDIA_VENDOR_DP: + name = efi_vendor_path("Media", + (VENDOR_DEVICE_PATH *)node, tail); + break; + case MEDIA_FILEPATH_DP: + name = NULL; + str = NULL; + if (ucs2_to_utf8(((FILEPATH_DEVICE_PATH *)node)->PathName, + &str) == 0) { + (void)asprintf(&name, "%s%s", str, tail); + free(str); + } + break; + case MEDIA_PROTOCOL_DP: + name = NULL; + uuid_to_string((const uuid_t *)(void *) + &((MEDIA_PROTOCOL_DEVICE_PATH *)node)->Protocol, + &str, &rv); + if (rv != uuid_s_ok) + break; + rv = asprintf(&name, "Protocol(%s)%s", str, tail); + free(str); + break; + default: + if (asprintf(&name, "UnknownMedia(%x)%s", + subtype, tail) < 0) + name = NULL; + } + free(tail); + return (name); +} + +static char * +efi_translate_devpath(EFI_DEVICE_PATH *devpath) +{ + EFI_DEVICE_PATH *dp = NextDevicePathNode(devpath); + char *name, *ptr; + uint8_t type; + + if (!IsDevicePathEnd(devpath)) + name = efi_translate_devpath(dp); + else + return (NULL); + + ptr = NULL; + type = DevicePathType(devpath); + switch (type) { + case HARDWARE_DEVICE_PATH: + ptr = efi_hw_dev_path(devpath, name); + break; + case ACPI_DEVICE_PATH: + ptr = efi_acpi_dev_path(devpath, name); + break; + case MESSAGING_DEVICE_PATH: + ptr = efi_messaging_dev_path(devpath, name); + break; + case MEDIA_DEVICE_PATH: + ptr = efi_media_dev_path(devpath, name); + break; + case BBS_DEVICE_PATH: + default: + if (asprintf(&ptr, "UnknownPath(%x)%s", type, + name? name : "") < 0) + ptr = NULL; + break; + } + + if (ptr != NULL) { + free(name); + name = ptr; + } + return (name); +} + +static CHAR16 * +efi_devpath_to_name(EFI_DEVICE_PATH *devpath) +{ + char *name = NULL; + CHAR16 *ptr = NULL; + size_t len; + int rv; + + name = efi_translate_devpath(devpath); + if (name == NULL) + return (NULL); + + /* + * We need to return memory from AllocatePool, so it can be freed + * with FreePool() in efi_free_devpath_name(). + */ + rv = utf8_to_ucs2(name, &ptr, &len); + free(name); + if (rv == 0) { + CHAR16 *out = NULL; + EFI_STATUS status; + + status = BS->AllocatePool(EfiLoaderData, len, (void **)&out); + if (EFI_ERROR(status)) { + free(ptr); + return (out); + } + memcpy(out, ptr, len); + free(ptr); + ptr = out; + } + + return (ptr); +} + CHAR16 * efi_devpath_name(EFI_DEVICE_PATH *devpath) { @@ -78,7 +502,7 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) toTextProtocol = NULL; } if (toTextProtocol == NULL) - return (NULL); + return (efi_devpath_to_name(devpath)); return (toTextProtocol->ConvertDevicePathToText(devpath, TRUE, TRUE)); } @@ -86,8 +510,8 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) void efi_free_devpath_name(CHAR16 *text) { - - BS->FreePool(text); + if (text != NULL) + BS->FreePool(text); } EFI_DEVICE_PATH * From owner-svn-src-all@freebsd.org Thu Nov 7 11:18:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD1F01B0520; Thu, 7 Nov 2019 11:18:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47819f4bnkz4Vn3; Thu, 7 Nov 2019 11:18:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67DD5CE2F; Thu, 7 Nov 2019 11:18:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7BIUQU011014; Thu, 7 Nov 2019 11:18:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7BIS4O011006; Thu, 7 Nov 2019 11:18:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911071118.xA7BIS4O011006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 11:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354436 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/o... X-SVN-Commit-Revision: 354436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 11:18:30 -0000 Author: avg Date: Thu Nov 7 11:18:28 2019 New Revision: 354436 URL: https://svnweb.freebsd.org/changeset/base/354436 Log: MFV r354377: 10554 Implemented zpool sync command illumos/illumos-gate@9c2acf00e275b6b2125a306f33cdddcc58393220 https://github.com/illumos/illumos-gate/commit/9c2acf00e275b6b2125a306f33cdddcc58393220 https://www.illumos.org/issues/10554 During the port of MMP (illumos bug 10499) from ZoL, I found this earlier ZoL project is a prerequisite. Here is the original description. This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to 'sync(2)' but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the 'sync(2)' cmd. Portions contributed by: Jerry Jelinek Author: Alek Pinchuk MFC after: 3 weeks Relnotes: possibly Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 7 11:18:28 2019 (r354436) @@ -193,6 +193,9 @@ .Ar ... .Op Ar interval Op Ar count .Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Nm .Cm upgrade .Op Fl v .Nm @@ -1913,6 +1916,19 @@ unavailable. Warnings about pools not using the latest on-disk format, having non-native block size or disabled features will not be included. .El +.It Xo +.Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Xc +Forces all in-core dirty data to be written to the primary pool storage and +not the ZIL. +It will also update administrative information including quota reporting. +Without arguments, +.Nm zpool Cm sync +will sync all pools on the system. +Otherwise, it will only sync the specified +.Ar pool . .It Xo .Nm .Cm upgrade Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Nov 7 11:18:28 2019 (r354436) @@ -100,6 +100,8 @@ static int zpool_do_history(int, char **); static int zpool_do_get(int, char **); static int zpool_do_set(int, char **); +static int zpool_do_sync(int, char **); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -144,6 +146,7 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, + HELP_SYNC, HELP_REGUID, HELP_REOPEN } zpool_help_t; @@ -200,6 +203,7 @@ static zpool_command_t command_table[] = { { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, { "set", zpool_do_set, HELP_SET }, + { "sync", zpool_do_sync, HELP_SYNC }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -285,6 +289,8 @@ get_usage(zpool_help_t idx) "[ ...]\n")); case HELP_REGUID: return (gettext("\treguid \n")); + case HELP_SYNC: + return (gettext("\tsync [pool] ...\n")); } abort(); @@ -2646,6 +2652,45 @@ error: free(searchdirs); return (err ? 1 : 0); +} + +/* + * zpool sync [-f] [pool] ... + * + * -f (undocumented) force uberblock (and config including zpool cache file) + * update. + * + * Sync the specified pool(s). + * Without arguments "zpool sync" will sync all pools. + * This command initiates TXG sync(s) and will return after the TXG(s) commit. + * + */ +static int +zpool_do_sync(int argc, char **argv) +{ + int ret; + boolean_t force = B_FALSE; + + /* check options */ + while ((ret = getopt(argc, argv, "f")) != -1) { + switch (ret) { + case 'f': + force = B_TRUE; + break; + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* if argc == 0 we will execute zpool_sync_one on all pools */ + ret = for_each_pool(argc, argv, B_FALSE, NULL, zpool_sync_one, &force); + + return (ret); } typedef struct iostat_cbdata { Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Nov 7 11:18:28 2019 (r354436) @@ -271,6 +271,8 @@ extern int zpool_clear(zpool_handle_t *, const char *, extern int zpool_reguid(zpool_handle_t *); extern int zpool_reopen(zpool_handle_t *); +extern int zpool_sync_one(zpool_handle_t *, void *); + extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Nov 7 11:18:28 2019 (r354436) @@ -3515,6 +3515,27 @@ zpool_reopen(zpool_handle_t *zhp) return (zpool_standard_error(hdl, errno, msg)); } +/* call into libzfs_core to execute the sync IOCTL per pool */ +int +zpool_sync_one(zpool_handle_t *zhp, void *data) +{ + int ret; + libzfs_handle_t *hdl = zpool_get_handle(zhp); + const char *pool_name = zpool_get_name(zhp); + boolean_t *force = data; + nvlist_t *innvl = fnvlist_alloc(); + + fnvlist_add_boolean_value(innvl, "force", *force); + if ((ret = lzc_sync(pool_name, innvl, NULL)) != 0) { + nvlist_free(innvl); + return (zpool_standard_error_fmt(hdl, ret, + dgettext(TEXT_DOMAIN, "sync '%s' failed"), pool_name)); + } + nvlist_free(innvl); + + return (0); +} + /* * Convert from a devid string to a path. */ Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Thu Nov 7 11:18:28 2019 (r354436) @@ -24,6 +24,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ /* @@ -137,16 +138,17 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, { zfs_cmd_t zc = { 0 }; int error = 0; - char *packed; + char *packed = NULL; #ifdef __FreeBSD__ nvlist_t *oldsource; #endif - size_t size; + size_t size = 0; ASSERT3S(g_refcount, >, 0); VERIFY3S(g_fd, !=, -1); - (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); + if (name != NULL) + (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); #ifdef __FreeBSD__ if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) @@ -160,9 +162,11 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, } #endif - packed = fnvlist_pack(source, &size); - zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; - zc.zc_nvlist_src_size = size; + if (source != NULL) { + packed = fnvlist_pack(source, &size); + zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; + zc.zc_nvlist_src_size = size; + } if (resultp != NULL) { *resultp = NULL; @@ -463,6 +467,18 @@ lzc_exists(const char *dataset) } /* + * outnvl is unused. + * It was added to preserve the function signature in case it is + * needed in the future. + */ +/*ARGSUSED*/ +int +lzc_sync(const char *pool_name, nvlist_t *innvl, nvlist_t **outnvl) +{ + return (lzc_ioctl(ZFS_IOC_POOL_SYNC, pool_name, innvl, NULL)); +} + +/* * Create "user holds" on snapshots. If there is a hold on a snapshot, * the snapshot can not be destroyed. (However, it can be marked for deletion * by lzc_destroy_snaps(defer=B_TRUE).) @@ -562,11 +578,7 @@ lzc_release(nvlist_t *holds, nvlist_t **errlist) int lzc_get_holds(const char *snapname, nvlist_t **holdsp) { - int error; - nvlist_t *innvl = fnvlist_alloc(); - error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp); - fnvlist_free(innvl); - return (error); + return (lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, NULL, holdsp)); } /* Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Thu Nov 7 11:17:03 2019 (r354435) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Thu Nov 7 11:18:28 2019 (r354436) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Martin Matuska . All rights reserved. * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_CORE_H @@ -90,6 +91,8 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); + +int lzc_sync(const char *, nvlist_t *, nvlist_t **); int lzc_rename(const char *, const char *); int lzc_destroy(const char *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Nov 7 11:17:03 2019 (r354435) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Nov 7 11:18:28 2019 (r354436) @@ -5836,6 +5836,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_ static int zfs_ioc_get_holds(const char *snapname, nvlist_t *args, nvlist_t *outnvl) { + ASSERT3P(args, ==, NULL); return (dsl_dataset_get_holds(snapname, outnvl)); } @@ -6134,6 +6135,44 @@ out: return (error); } +/* + * Sync the currently open TXG to disk for the specified pool. + * This is somewhat similar to 'zfs_sync()'. + * For cases that do not result in error this ioctl will wait for + * the currently open TXG to commit before returning back to the caller. + * + * innvl: { + * "force" -> when true, force uberblock update even if there is no dirty data. + * In addition this will cause the vdev configuration to be written + * out including updating the zpool cache file. (boolean_t) + * } + * + * onvl is unused + */ +/* ARGSUSED */ +static int +zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl) +{ + int err; + boolean_t force; + spa_t *spa; + + if ((err = spa_open(pool, &spa, FTAG)) != 0) + return (err); + + force = fnvlist_lookup_boolean_value(innvl, "force"); + if (force) { + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER); + vdev_config_dirty(spa->spa_root_vdev); + spa_config_exit(spa, SCL_CONFIG, FTAG); + } + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_close(spa, FTAG); + + return (err); +} + static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST]; static void @@ -6323,6 +6362,10 @@ zfs_ioctl_init(void) zfs_ioctl_register("initialize", ZFS_IOC_POOL_INITIALIZE, zfs_ioc_pool_initialize, zfs_secpolicy_config, POOL_NAME, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_TRUE, B_TRUE); + + zfs_ioctl_register("sync", ZFS_IOC_POOL_SYNC, + zfs_ioc_pool_sync, zfs_secpolicy_none, POOL_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_FALSE); /* IOCTLS that use the legacy function signature */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Nov 7 11:17:03 2019 (r354435) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Nov 7 11:18:28 2019 (r354436) @@ -1016,6 +1016,7 @@ typedef enum zfs_ioc { ZFS_IOC_POOL_CHECKPOINT, ZFS_IOC_POOL_DISCARD_CHECKPOINT, ZFS_IOC_POOL_INITIALIZE, + ZFS_IOC_POOL_SYNC, ZFS_IOC_LAST } zfs_ioc_t; From owner-svn-src-all@freebsd.org Thu Nov 7 11:50:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A73FF1B1116; Thu, 7 Nov 2019 11:50:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4781v23p4xz4XPy; Thu, 7 Nov 2019 11:50:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 669DED3A7; Thu, 7 Nov 2019 11:50:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7BosCm030762; Thu, 7 Nov 2019 11:50:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Bos6t030761; Thu, 7 Nov 2019 11:50:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911071150.xA7Bos6t030761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 11:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354437 - head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 354437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 11:50:54 -0000 Author: avg Date: Thu Nov 7 11:50:53 2019 New Revision: 354437 URL: https://svnweb.freebsd.org/changeset/base/354437 Log: fix zpool list property names This change is based on r354380 8899 zpool list property documentation doesn't match actual behaviour There is no "used" pool property, "alloc" is actually spelled "allocated". MFC after: 5 days Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 7 11:18:28 2019 (r354436) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Nov 7 11:50:53 2019 (r354437) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 20, 2019 +.Dd November 7, 2019 .Dt ZPOOL 8 .Os .Sh NAME @@ -602,8 +602,8 @@ Each pool has several properties associated with it. S read-only statistics while others are configurable and change the behavior of the pool. The following are read-only properties: .Bl -tag -width "dedupratio" -.It Sy alloc -Amount of storage space within the pool that has been physically allocated. +.It Sy allocated +Amount of storage space used within the pool. .It Sy capacity Percentage of pool space used. This property can also be referred to by its shortened column name, "cap". @@ -653,8 +653,6 @@ Information about unsupported features that are enable See .Xr zpool-features 7 for details. -.It Sy used -Amount of storage space used within the pool. .El .Pp The space usage properties report actual physical space available to the @@ -1576,8 +1574,8 @@ Comma-separated list of properties to display. See the section for a list of valid properties. The default list is .Sy name , .Sy size , -.Sy used , -.Sy available , +.Sy allocated , +.Sy free , .Sy checkpoint , .Sy expandsize , .Sy fragmentation , From owner-svn-src-all@freebsd.org Thu Nov 7 12:58:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EF891B3412; Thu, 7 Nov 2019 12:58:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4783Nm0FgHz4c2K; Thu, 7 Nov 2019 12:58:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFDF2E028; Thu, 7 Nov 2019 12:58:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7CwFRs071655; Thu, 7 Nov 2019 12:58:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7CwFRW071651; Thu, 7 Nov 2019 12:58:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911071258.xA7CwFRW071651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Nov 2019 12:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354438 - in stable/12/sys: amd64/conf netinet netinet6 sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: amd64/conf netinet netinet6 sys X-SVN-Commit-Revision: 354438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 12:58:16 -0000 Author: hselasky Date: Thu Nov 7 12:58:14 2019 New Revision: 354438 URL: https://svnweb.freebsd.org/changeset/base/354438 Log: Partial MFC of CSUM_SND_TAG flag from r348254. Add CSUM_SND_TAG flag and set this flag for outgoing ratelimited mbufs. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/12/sys/amd64/conf/GENERIC stable/12/sys/netinet/ip_output.c stable/12/sys/netinet6/ip6_output.c stable/12/sys/sys/mbuf.h Modified: stable/12/sys/amd64/conf/GENERIC ============================================================================== --- stable/12/sys/amd64/conf/GENERIC Thu Nov 7 11:50:53 2019 (r354437) +++ stable/12/sys/amd64/conf/GENERIC Thu Nov 7 12:58:14 2019 (r354438) @@ -366,3 +366,5 @@ device netmap # netmap(4) support options EVDEV_SUPPORT # evdev support in legacy drivers device evdev # input event device support device uinput # install /dev/uinput cdev + +options RATELIMIT Modified: stable/12/sys/netinet/ip_output.c ============================================================================== --- stable/12/sys/netinet/ip_output.c Thu Nov 7 11:50:53 2019 (r354437) +++ stable/12/sys/netinet/ip_output.c Thu Nov 7 12:58:14 2019 (r354438) @@ -653,6 +653,7 @@ sendit: in_pcboutput_txrtlmt(inp, ifp, m); /* stamp send tag on mbuf */ m->m_pkthdr.snd_tag = inp->inp_snd_tag; + m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } else { m->m_pkthdr.snd_tag = NULL; } @@ -705,6 +706,7 @@ sendit: in_pcboutput_txrtlmt(inp, ifp, m); /* stamp send tag on mbuf */ m->m_pkthdr.snd_tag = inp->inp_snd_tag; + m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } else { m->m_pkthdr.snd_tag = NULL; } Modified: stable/12/sys/netinet6/ip6_output.c ============================================================================== --- stable/12/sys/netinet6/ip6_output.c Thu Nov 7 11:50:53 2019 (r354437) +++ stable/12/sys/netinet6/ip6_output.c Thu Nov 7 12:58:14 2019 (r354438) @@ -966,6 +966,7 @@ passout: in_pcboutput_txrtlmt(inp, ifp, m); /* stamp send tag on mbuf */ m->m_pkthdr.snd_tag = inp->inp_snd_tag; + m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } else { m->m_pkthdr.snd_tag = NULL; } @@ -1081,6 +1082,7 @@ sendorfree: in_pcboutput_txrtlmt(inp, ifp, m); /* stamp send tag on mbuf */ m->m_pkthdr.snd_tag = inp->inp_snd_tag; + m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } else { m->m_pkthdr.snd_tag = NULL; } Modified: stable/12/sys/sys/mbuf.h ============================================================================== --- stable/12/sys/sys/mbuf.h Thu Nov 7 11:50:53 2019 (r354437) +++ stable/12/sys/sys/mbuf.h Thu Nov 7 12:58:14 2019 (r354438) @@ -519,6 +519,8 @@ struct mbuf { #define CSUM_L5_VALID 0x20000000 /* checksum is correct */ #define CSUM_COALESCED 0x40000000 /* contains merged segments */ +#define CSUM_SND_TAG 0x80000000 /* Packet header has send tag */ + /* * CSUM flag description for use with printf(9) %b identifier. */ @@ -528,7 +530,7 @@ struct mbuf { "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \ "\16CSUM_IP6_ISCSI" \ "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \ - "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESCED" + "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESCED\40CSUM_SND_TAG" /* CSUM flags compatibility mappings. */ #define CSUM_IP_CHECKED CSUM_L3_CALC From owner-svn-src-all@freebsd.org Thu Nov 7 13:01:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E5381B3547; Thu, 7 Nov 2019 13:01:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4783S63G77z4cKR; Thu, 7 Nov 2019 13:01:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 535DAE067; Thu, 7 Nov 2019 13:01:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7D1ALM073943; Thu, 7 Nov 2019 13:01:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7D1AOA073942; Thu, 7 Nov 2019 13:01:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911071301.xA7D1AOA073942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Nov 2019 13:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354439 - stable/12/sys/amd64/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/amd64/conf X-SVN-Commit-Revision: 354439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 13:01:10 -0000 Author: hselasky Date: Thu Nov 7 13:01:09 2019 New Revision: 354439 URL: https://svnweb.freebsd.org/changeset/base/354439 Log: Revert accidential chunk added to GENERIC from previous commit. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/12/sys/amd64/conf/GENERIC Modified: stable/12/sys/amd64/conf/GENERIC ============================================================================== --- stable/12/sys/amd64/conf/GENERIC Thu Nov 7 12:58:14 2019 (r354438) +++ stable/12/sys/amd64/conf/GENERIC Thu Nov 7 13:01:09 2019 (r354439) @@ -366,5 +366,3 @@ device netmap # netmap(4) support options EVDEV_SUPPORT # evdev support in legacy drivers device evdev # input event device support device uinput # install /dev/uinput cdev - -options RATELIMIT From owner-svn-src-all@freebsd.org Thu Nov 7 13:12:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F5B91B3A21; Thu, 7 Nov 2019 13:12:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4783jM0s1Tz4d1Y; Thu, 7 Nov 2019 13:12:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00948E3B9; Thu, 7 Nov 2019 13:12:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7DCcOi086236; Thu, 7 Nov 2019 13:12:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7DCcRw086235; Thu, 7 Nov 2019 13:12:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911071312.xA7DCcRw086235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 7 Nov 2019 13:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354440 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 354440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 13:12:39 -0000 Author: hselasky Date: Thu Nov 7 13:12:38 2019 New Revision: 354440 URL: https://svnweb.freebsd.org/changeset/base/354440 Log: Check CSUM_SND_TAG flag before classifying packet has having a send tag in mlx5en(4). This fixes an issue with packets being dropped when doing packet forwarding, because the rcvif field is still set. The send tag pointer and rcvif field share the same memory location. This is a direct commit. Reported by: olivier@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Nov 7 13:01:09 2019 (r354439) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Nov 7 13:12:38 2019 (r354440) @@ -609,7 +609,8 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - if (mb->m_pkthdr.snd_tag != NULL) { + if ((mb->m_pkthdr.csum_flags & CSUM_SND_TAG) != 0 && + (mb->m_pkthdr.snd_tag != NULL)) { sq = mlx5e_select_queue_by_send_tag(ifp, mb); if (unlikely(sq == NULL)) { /* Check for route change */ From owner-svn-src-all@freebsd.org Thu Nov 7 14:14:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBA2D1B5A5C; Thu, 7 Nov 2019 14:14:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4785575SYNz3FCh; Thu, 7 Nov 2019 14:14:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A893EEE4; Thu, 7 Nov 2019 14:14:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7EEpjb021755; Thu, 7 Nov 2019 14:14:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7EEpKW021754; Thu, 7 Nov 2019 14:14:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071414.xA7EEpKW021754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 14:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354441 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 354441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 14:14:51 -0000 Author: emaste Date: Thu Nov 7 14:14:51 2019 New Revision: 354441 URL: https://svnweb.freebsd.org/changeset/base/354441 Log: arch.7: armv6 uses lld by default as of r354289 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Nov 7 13:12:38 2019 (r354440) +++ head/share/man/man7/arch.7 Thu Nov 7 14:14:51 2019 (r354441) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 11, 2019 +.Dd November 7, 2019 .Dt ARCH 7 .Os .Sh NAME @@ -316,7 +316,7 @@ This table shows the default tool chain for each archi .It aarch64 Ta Clang Ta lld .It amd64 Ta Clang Ta lld .It arm Ta Clang Ta GNU ld 2.17.50 -.It armv6 Ta Clang Ta GNU ld 2.17.50 +.It armv6 Ta Clang Ta lld .It armv7 Ta Clang Ta lld .It i386 Ta Clang Ta lld .It mips Ta GCC 4.2.1 Ta GNU ld 2.17.50 From owner-svn-src-all@freebsd.org Thu Nov 7 15:00:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF6A81B6A1F; Thu, 7 Nov 2019 15:00:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47865y4C4tz3HlZ; Thu, 7 Nov 2019 15:00:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73526F681; Thu, 7 Nov 2019 15:00:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7F0cSi045627; Thu, 7 Nov 2019 15:00:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7F0cFa045626; Thu, 7 Nov 2019 15:00:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201911071500.xA7F0cFa045626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 7 Nov 2019 15:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354443 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:00:38 -0000 Author: ae Date: Thu Nov 7 15:00:37 2019 New Revision: 354443 URL: https://svnweb.freebsd.org/changeset/base/354443 Log: Enqueue lladdr_task to update link level address of vlan, when its parent interface has changed. During vlan reconfiguration without destroying interface, it is possible, that parent interface will be changed. This usually means, that link layer address of vlan will be different. Therefore we need to update all associated with vlan's addresses permanent llentries - NDP for IPv6 addresses, and ARP for IPv4 addresses. This is done via lladdr_task execution. To avoid extra work, before execution do the check, that L2 address is different. No objection from: #network Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D22243 Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Nov 7 14:16:55 2019 (r354442) +++ head/sys/net/if_vlan.c Thu Nov 7 15:00:37 2019 (r354443) @@ -1459,11 +1459,19 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 * Set up our interface address to reflect the underlying * physical interface's. */ - bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen); + TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); ((struct sockaddr_dl *)ifp->if_addr->ifa_addr)->sdl_alen = p->if_addrlen; - TASK_INIT(&ifv->lladdr_task, 0, vlan_lladdr_fn, ifv); + /* + * Do not schedule link address update if it was the same + * as previous parent's. This helps avoid updating for each + * associated llentry. + */ + if (memcmp(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen) != 0) { + bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen); + taskqueue_enqueue(taskqueue_thread, &ifv->lladdr_task); + } /* We are ready for operation now. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; From owner-svn-src-all@freebsd.org Thu Nov 7 15:12:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 345DC1B71A7; Thu, 7 Nov 2019 15:12:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4786MP73dnz3Jtn; Thu, 7 Nov 2019 15:12:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f193.google.com with SMTP id p6so2124619ilp.1; Thu, 07 Nov 2019 07:12:17 -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=bwB2+6pgOeKc78JUWzZRgPJPkBqTW3gXRe3kFkJMa7w=; b=f0dAS4fmO9p9Mk8RQXDZOTM/VW8IheX++ajc0mr/rqR1MtTTw8VgJEwe1gchX+syJ4 ofzhMdwPcMd4//Yq4sY41fdUFjVoaFMhupHrkHkqouwX8QhB86a7TY2oyGIFuk3cD/j4 38N3tXjCcnl8wkYoowgFRMenD0Pqx6cccKLcTcQI+0mdJf2GO4xTMHMQ4p0+NRSa04tu r6n7PDoEAEy322pnYxQ3t0Yg0y+3HQTgTuxvXMJ3J/YEneicdngbutB2HEkpfV9Lp028 j2w6raFZRMXm2/qwknQ9g5d2ph7IL6B/uxeWDYP2TrDnB8nOue777ZAa8NJHniXesK9U szaQ== X-Gm-Message-State: APjAAAViszQRk3gsOGpw1yTzr50BMFYFB9KIW0hsO+xOlTmkyzPVG7Pp RtLYbuhuQUqGztaRWJsoSS2vQ8FWaV+/J3738sWgeA== X-Google-Smtp-Source: APXvYqwqjP2vEo7Nzj2NpncI+1i2VjAStLQNBFsRlBUGwzuQs8iE+1pZ8R//r5bqCqi9jO8xliVxhlivqjlvTJrvF20= X-Received: by 2002:a92:5f06:: with SMTP id t6mr4920187ilb.17.1573139536370; Thu, 07 Nov 2019 07:12:16 -0800 (PST) MIME-Version: 1.0 References: <201911031745.xA3HjVeV051369@repo.freebsd.org> In-Reply-To: <201911031745.xA3HjVeV051369@repo.freebsd.org> From: Ed Maste Date: Thu, 7 Nov 2019 06:25:33 -0500 Message-ID: Subject: Re: svn commit: r354286 - in head/sys/arm64: arm64 include To: Alan Cox Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4786MP73dnz3Jtn X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.193 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.18 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.18)[ip: (-0.61), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.01), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.166.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.166.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:12:19 -0000 On Sun, 3 Nov 2019 at 16:39, Alan Cox wrote: > > Author: alc > Date: Sun Nov 3 17:45:30 2019 > New Revision: 354286 > URL: https://svnweb.freebsd.org/changeset/base/354286 > > Log: > Utilize ASIDs to reduce both the direct and indirect costs of context I built a full pkg set on an Ampere eMAG on 2019-09-11, and again on 2019-11-04 after this change went in. The second build included TRYBROKEN so tried to build more ports and took slightly more time overall, but comparing the overall build duration (wall clock) of various ports is illustrative. llvm90 took the longest to build; it was 21:15:58 in the first run and 19:54:32 in the second. qt5-webkit went from 12:13:21 to 11:39:21. rust went from 15:14:46 to 13:49:50. firefox from 7:24:21 to 7:08:35. From owner-svn-src-all@freebsd.org Thu Nov 7 15:29:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AB321B7A4A for ; Thu, 7 Nov 2019 15:29:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4786l74XJ1z3LFy for ; Thu, 7 Nov 2019 15:29:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id h15so2282124qka.13 for ; Thu, 07 Nov 2019 07:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wiX8v9nQhkIlvUUuS82CIMZgJytlgvb0ik9T18UGfcE=; b=Ruegy6NRxysEgneu1s0IHkfkWHDkgy6Nd09SFOha28dOeBelPiGStaKJxRVSWLXRdF fjwK5JBRdwTkp504NssCHshuGT0aoYFUYUD//NMQcQ+yMMLLzrVBw5u8xW6tW+QJi/JO wvLYzhkAmrTrRFsP6Po9uSZtuHN7YTtB4EB8xf7PyXd6qa4aBXEo4YIjk3SAzt70IElB Y3G75bTRS/fqi0PD9gXaZZ7rT/tYJWRRi/t+0w0TsKbzb5f+5LeNXh439zSufcmayCr8 CjJF3z9AVv7UUZxZYkCnou2lrS8UG8KDfCzt3eVWHZDtP+9qXw4P0LtcoqF6yNis14Ad LlcQ== 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=wiX8v9nQhkIlvUUuS82CIMZgJytlgvb0ik9T18UGfcE=; b=RLnxFuTwhRiRxbfBJaTDwhG/RNOxAYWO37RJ2eS6A7tyMEs+ZlvoAnhwuk2k4etYi7 ZHswaAxEVGJnFIZpk4fDM6Dtr7K4A+pkFq+wTaTdhpV7pKRQt872U/lIV9HpLix7n6jR HaUb47PPEijFgVupFCaPo4dc5heZABF7pdAGDxCL+eWs1PQNjA1ilFX07JSQOkGdEZJq oaQyutZ8yZMQ9yCxVtCFCTch/OokWRsKIl2dRk8NhlvhVDQIWly3vFVp26Zam4ZkyYVw oSN+kLtEMeF7oLgn0xrKXlPOxFpn9zOph/qcJxBLlrKEPED1OmVypXSMZgcJqCelmWqy sAjA== X-Gm-Message-State: APjAAAVb5yhRCkoQDUQWswiq8zu/Vr6KxdjkPeUaIPGD16Vj/hkxvIVU TC95zFlxOzyP8Gv0BS0QoLzZVJAxSRFraFXQb3achA== X-Google-Smtp-Source: APXvYqySocZTYpehXC6vziFOzd6K5V+tdYaDF/5Zgtwn65LgAFfLiAtDH7TzaokwFqeRywUHY3uBpS7qfxCkx8IBmto= X-Received: by 2002:a37:4716:: with SMTP id u22mr3354678qka.495.1573140561903; Thu, 07 Nov 2019 07:29:21 -0800 (PST) MIME-Version: 1.0 References: <201911071117.xA7BH390010873@repo.freebsd.org> In-Reply-To: <201911071117.xA7BH390010873@repo.freebsd.org> From: Warner Losh Date: Thu, 7 Nov 2019 08:29:10 -0700 Message-ID: Subject: Re: svn commit: r354435 - head/stand/efi/libefi To: Toomas Soome Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4786l74XJ1z3LFy X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Ruegy6NR; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.63 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MIME_BASE64_TEXT(0.10)[]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.73)[ip: (-9.24), ipnet: 2607:f8b0::/32(-2.35), asn: 15169(-2.01), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:29:24 -0000 On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome wrote: > Author: tsoome > Date: Thu Nov 7 11:17:03 2019 > New Revision: 354435 > URL: https://svnweb.freebsd.org/changeset/base/354435 > > Log: > loader: implement fallback efi_devpath_to_name() > > UEFI 1.10 on macs does not seem to provide devpath to name translation, > provide our own (limited) version, so we can get information about > commmon > devices. > We specifically deleted our own version of this function (it was wrong in many ways too) because we thought we could require a minimum UEFI 2.0 for full functionality... This sort of function is a total pain to maintain. I'd prefer the fallback was "you don't get this" rather than bloating the code, especially for devices that we don't care about and will never care about for booting... Warner > MFC after: 1 week > > Modified: > head/stand/efi/libefi/devpath.c > > Modified: head/stand/efi/libefi/devpath.c > > ============================================================================== > --- head/stand/efi/libefi/devpath.c Thu Nov 7 07:21:45 2019 > (r354434) > +++ head/stand/efi/libefi/devpath.c Thu Nov 7 11:17:03 2019 > (r354435) > @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include > > static EFI_GUID ImageDevicePathGUID = > EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; > static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; > static EFI_GUID DevicePathToTextGUID = > EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; > static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol; > -static EFI_GUID DevicePathFromTextGUID = > EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; > +static EFI_GUID DevicePathFromTextGUID = > + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; > static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol; > > EFI_DEVICE_PATH * > @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle) > return (devpath); > } > > +static char * > +efi_make_tail(char *suffix) > +{ > + char *tail; > + > + tail = NULL; > + if (suffix != NULL) > + (void)asprintf(&tail, "/%s", suffix); > + else > + tail = strdup(""); > + return (tail); > +} > + > +typedef struct { > + EFI_DEVICE_PATH Header; > + EFI_GUID Guid; > + UINT8 VendorDefinedData[1]; > +} __packed VENDOR_DEVICE_PATH_WITH_DATA; > + > +static char * > +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffix) > +{ > + uint32_t size = DevicePathNodeLength(&node->Header) - > sizeof(*node); > + VENDOR_DEVICE_PATH_WITH_DATA *dp = (VENDOR_DEVICE_PATH_WITH_DATA > *)node; > + char *name, *tail, *head; > + char *uuid; > + int rv; > + > + uuid_to_string((const uuid_t *)(void *)&node->Guid, &uuid, &rv); > + if (rv != uuid_s_ok) > + return (NULL); > + > + tail = efi_make_tail(suffix); > + rv = asprintf(&head, "%sVendor(%s)[%x:", type, uuid, size); > + free(uuid); > + if (rv < 0) > + return (NULL); > + > + if (DevicePathNodeLength(&node->Header) > sizeof(*node)) { > + for (uint32_t i = 0; i < size; i++) { > + rv = asprintf(&name, "%s%02x", head, > + dp->VendorDefinedData[i]); > + if (rv < 0) { > + free(tail); > + free(head); > + return (NULL); > + } > + free(head); > + head = name; > + } > + } > + > + if (asprintf(&name, "%s]%s", head, tail) < 0) > + name = NULL; > + free(head); > + free(tail); > + return (name); > +} > + > +static char * > +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype = DevicePathSubType(node); > + char *name, *tail; > + > + tail = efi_make_tail(suffix); > + switch (subtype) { > + case HW_PCI_DP: > + if (asprintf(&name, "Pci(%x,%x)%s", > + ((PCI_DEVICE_PATH *)node)->Function, > + ((PCI_DEVICE_PATH *)node)->Device, tail) < 0) > + name = NULL; > + break; > + case HW_PCCARD_DP: > + if (asprintf(&name, "PCCARD(%x)%s", > + ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, tail) < > 0) > + name = NULL; > + break; > + case HW_MEMMAP_DP: > + if (asprintf(&name, "MMap(%x,%" PRIx64 ",%" PRIx64 ")%s", > + ((MEMMAP_DEVICE_PATH *)node)->MemoryType, > + ((MEMMAP_DEVICE_PATH *)node)->StartingAddress, > + ((MEMMAP_DEVICE_PATH *)node)->EndingAddress, tail) < 0) > + name = NULL; > + break; > + case HW_VENDOR_DP: > + name = efi_vendor_path("Hardware", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case HW_CONTROLLER_DP: > + if (asprintf(&name, "Ctrl(%x)%s", > + ((CONTROLLER_DEVICE_PATH *)node)->Controller, tail) < > 0) > + name = NULL; > + break; > + default: > + if (asprintf(&name, "UnknownHW(%x)%s", subtype, tail) < 0) > + name = NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_acpi_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype = DevicePathSubType(node); > + ACPI_HID_DEVICE_PATH *acpi = (ACPI_HID_DEVICE_PATH *)node; > + char *name, *tail; > + > + tail = efi_make_tail(suffix); > + switch (subtype) { > + case ACPI_DP: > + if ((acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { > + switch (EISA_ID_TO_NUM (acpi->HID)) { > + case 0x0a03: > + if (asprintf(&name, "PciRoot(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + case 0x0a08: > + if (asprintf(&name, "PcieRoot(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + case 0x0604: > + if (asprintf(&name, "Floppy(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + case 0x0301: > + if (asprintf(&name, "Keyboard(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + case 0x0501: > + if (asprintf(&name, "Serial(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + case 0x0401: > + if (asprintf(&name, "ParallelPort(%x)%s", > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + default: > + if (asprintf(&name, "Acpi(PNP%04x,%x)%s", > + EISA_ID_TO_NUM(acpi->HID), > + acpi->UID, tail) < 0) > + name = NULL; > + break; > + } > + } else { > + if (asprintf(&name, "Acpi(%08x,%x)%s", > + acpi->HID, acpi->UID, tail) < 0) > + name = NULL; > + } > + break; > + case ACPI_EXTENDED_DP: > + default: > + if (asprintf(&name, "UnknownACPI(%x)%s", subtype, tail) < > 0) > + name = NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_messaging_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype = DevicePathSubType(node); > + char *name; > + char *tail; > + > + tail = efi_make_tail(suffix); > + switch (subtype) { > + case MSG_ATAPI_DP: > + if (asprintf(&name, "ATA(%s,%s,%x)%s", > + ((ATAPI_DEVICE_PATH *)node)->PrimarySecondary == 1 ? > + "Secondary" : "Primary", > + ((ATAPI_DEVICE_PATH *)node)->SlaveMaster == 1 ? > + "Slave" : "Master", > + ((ATAPI_DEVICE_PATH *)node)->Lun, tail) < 0) > + name = NULL; > + break; > + case MSG_SCSI_DP: > + if (asprintf(&name, "SCSI(%x,%x)%s", > + ((SCSI_DEVICE_PATH *)node)->Pun, > + ((SCSI_DEVICE_PATH *)node)->Lun, tail) < 0) > + name = NULL; > + break; > + case MSG_FIBRECHANNEL_DP: > + if (asprintf(&name, "Fibre(%" PRIx64 ",%" PRIx64 ")%s", > + ((FIBRECHANNEL_DEVICE_PATH *)node)->WWN, > + ((FIBRECHANNEL_DEVICE_PATH *)node)->Lun, tail) < 0) > + name = NULL; > + break; > + case MSG_1394_DP: > + if (asprintf(&name, "I1394(%016" PRIx64 ")%s", > + ((F1394_DEVICE_PATH *)node)->Guid, tail) < 0) > + name = NULL; > + break; > + case MSG_USB_DP: > + if (asprintf(&name, "USB(%x,%x)%s", > + ((USB_DEVICE_PATH *)node)->ParentPortNumber, > + ((USB_DEVICE_PATH *)node)->InterfaceNumber, tail) < 0) > + name = NULL; > + break; > + case MSG_USB_CLASS_DP: > + if (asprintf(&name, "UsbClass(%x,%x,%x,%x,%x)%s", > + ((USB_CLASS_DEVICE_PATH *)node)->VendorId, > + ((USB_CLASS_DEVICE_PATH *)node)->ProductId, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceClass, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceSubClass, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceProtocol, tail) > < 0) > + name = NULL; > + break; > + case MSG_MAC_ADDR_DP: > + if (asprintf(&name, > "MAC(%02x:%02x:%02x:%02x:%02x:%02x,%x)%s", > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[0], > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[1], > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[2], > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[3], > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[4], > + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[5], > + ((MAC_ADDR_DEVICE_PATH *)node)->IfType, tail) < 0) > + name = NULL; > + break; > + case MSG_VENDOR_DP: > + name = efi_vendor_path("Messaging", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case MSG_UART_DP: > + if (asprintf(&name, "UART(%" PRIu64 ",%u,%x,%x)%s", > + ((UART_DEVICE_PATH *)node)->BaudRate, > + ((UART_DEVICE_PATH *)node)->DataBits, > + ((UART_DEVICE_PATH *)node)->Parity, > + ((UART_DEVICE_PATH *)node)->StopBits, tail) < 0) > + name = NULL; > + break; > + case MSG_SATA_DP: > + if (asprintf(&name, "Sata(%x,%x,%x)%s", > + ((SATA_DEVICE_PATH *)node)->HBAPortNumber, > + ((SATA_DEVICE_PATH *)node)->PortMultiplierPortNumber, > + ((SATA_DEVICE_PATH *)node)->Lun, tail) < 0) > + name = NULL; > + break; > + default: > + if (asprintf(&name, "UnknownMessaging(%x)%s", > + subtype, tail) < 0) > + name = NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_media_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype = DevicePathSubType(node); > + HARDDRIVE_DEVICE_PATH *hd; > + char *name; > + char *str; > + char *tail; > + int rv; > + > + tail = efi_make_tail(suffix); > + name = NULL; > + switch (subtype) { > + case MEDIA_HARDDRIVE_DP: > + hd = (HARDDRIVE_DEVICE_PATH *)node; > + switch (hd->SignatureType) { > + case SIGNATURE_TYPE_MBR: > + if (asprintf(&name, "HD(%d,MBR,%08x,%" PRIx64 > + ",%" PRIx64 ")%s", > + hd->PartitionNumber, > + *((uint32_t *)(uintptr_t)&hd->Signature[0]), > + hd->PartitionStart, > + hd->PartitionSize, tail) < 0) > + name = NULL; > + break; > + case SIGNATURE_TYPE_GUID: > + name = NULL; > + uuid_to_string((const uuid_t *)(void *) > + &hd->Signature[0], &str, &rv); > + if (rv != uuid_s_ok) > + break; > + rv = asprintf(&name, "HD(%d,GPT,%s,%" PRIx64 ",%" > + PRIx64 ")%s", > + hd->PartitionNumber, str, > + hd->PartitionStart, hd->PartitionSize, tail); > + free(str); > + break; > + default: > + if (asprintf(&name, "HD(%d,%d,0)%s", > + hd->PartitionNumber, > + hd->SignatureType, tail) < 0) { > + name = NULL; > + } > + break; > + } > + break; > + case MEDIA_CDROM_DP: > + if (asprintf(&name, "CD(%x,%" PRIx64 ",%" PRIx64 ")%s", > + ((CDROM_DEVICE_PATH *)node)->BootEntry, > + ((CDROM_DEVICE_PATH *)node)->PartitionStart, > + ((CDROM_DEVICE_PATH *)node)->PartitionSize, tail) < 0) > { > + name = NULL; > + } > + break; > + case MEDIA_VENDOR_DP: > + name = efi_vendor_path("Media", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case MEDIA_FILEPATH_DP: > + name = NULL; > + str = NULL; > + if (ucs2_to_utf8(((FILEPATH_DEVICE_PATH *)node)->PathName, > + &str) == 0) { > + (void)asprintf(&name, "%s%s", str, tail); > + free(str); > + } > + break; > + case MEDIA_PROTOCOL_DP: > + name = NULL; > + uuid_to_string((const uuid_t *)(void *) > + &((MEDIA_PROTOCOL_DEVICE_PATH *)node)->Protocol, > + &str, &rv); > + if (rv != uuid_s_ok) > + break; > + rv = asprintf(&name, "Protocol(%s)%s", str, tail); > + free(str); > + break; > + default: > + if (asprintf(&name, "UnknownMedia(%x)%s", > + subtype, tail) < 0) > + name = NULL; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_translate_devpath(EFI_DEVICE_PATH *devpath) > +{ > + EFI_DEVICE_PATH *dp = NextDevicePathNode(devpath); > + char *name, *ptr; > + uint8_t type; > + > + if (!IsDevicePathEnd(devpath)) > + name = efi_translate_devpath(dp); > + else > + return (NULL); > + > + ptr = NULL; > + type = DevicePathType(devpath); > + switch (type) { > + case HARDWARE_DEVICE_PATH: > + ptr = efi_hw_dev_path(devpath, name); > + break; > + case ACPI_DEVICE_PATH: > + ptr = efi_acpi_dev_path(devpath, name); > + break; > + case MESSAGING_DEVICE_PATH: > + ptr = efi_messaging_dev_path(devpath, name); > + break; > + case MEDIA_DEVICE_PATH: > + ptr = efi_media_dev_path(devpath, name); > + break; > + case BBS_DEVICE_PATH: > + default: > + if (asprintf(&ptr, "UnknownPath(%x)%s", type, > + name? name : "") < 0) > + ptr = NULL; > + break; > + } > + > + if (ptr != NULL) { > + free(name); > + name = ptr; > + } > + return (name); > +} > + > +static CHAR16 * > +efi_devpath_to_name(EFI_DEVICE_PATH *devpath) > +{ > + char *name = NULL; > + CHAR16 *ptr = NULL; > + size_t len; > + int rv; > + > + name = efi_translate_devpath(devpath); > + if (name == NULL) > + return (NULL); > + > + /* > + * We need to return memory from AllocatePool, so it can be freed > + * with FreePool() in efi_free_devpath_name(). > + */ > + rv = utf8_to_ucs2(name, &ptr, &len); > + free(name); > + if (rv == 0) { > + CHAR16 *out = NULL; > + EFI_STATUS status; > + > + status = BS->AllocatePool(EfiLoaderData, len, (void > **)&out); > + if (EFI_ERROR(status)) { > + free(ptr); > + return (out); > + } > + memcpy(out, ptr, len); > + free(ptr); > + ptr = out; > + } > + > + return (ptr); > +} > + > CHAR16 * > efi_devpath_name(EFI_DEVICE_PATH *devpath) > { > @@ -78,7 +502,7 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) > toTextProtocol = NULL; > } > if (toTextProtocol == NULL) > - return (NULL); > + return (efi_devpath_to_name(devpath)); > > return (toTextProtocol->ConvertDevicePathToText(devpath, TRUE, > TRUE)); > } > @@ -86,8 +510,8 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) > void > efi_free_devpath_name(CHAR16 *text) > { > - > - BS->FreePool(text); > + if (text != NULL) > + BS->FreePool(text); > } > > EFI_DEVICE_PATH * > From owner-svn-src-all@freebsd.org Thu Nov 7 15:33:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB13C1B7CA2; Thu, 7 Nov 2019 15:33:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4786qJ5vtXz3Lf5; Thu, 7 Nov 2019 15:33:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE2EBFDEB; Thu, 7 Nov 2019 15:33:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7FX0kD068466; Thu, 7 Nov 2019 15:33:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7FX0cP068464; Thu, 7 Nov 2019 15:33:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911071533.xA7FX0cP068464@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 7 Nov 2019 15:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354444 - in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Commit-Revision: 354444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:33:01 -0000 Author: kib Date: Thu Nov 7 15:32:59 2019 New Revision: 354444 URL: https://svnweb.freebsd.org/changeset/base/354444 Log: MFC r353892: Assert that vnode_pager_setsize() is called with the vnode exclusively locked. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/12/sys/sys/mount.h stable/12/sys/vm/vnode_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Nov 7 15:00:37 2019 (r354443) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Nov 7 15:32:59 2019 (r354444) @@ -1400,6 +1400,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES; vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; vfsp->mnt_kern_flag |= MNTK_NO_IOPF; /* vn_io_fault can be used */ + vfsp->mnt_kern_flag |= MNTK_VMSETSIZE_BUG; /* * The fsid is 64 bits, composed of an 8-bit fs type, which Modified: stable/12/sys/sys/mount.h ============================================================================== --- stable/12/sys/sys/mount.h Thu Nov 7 15:00:37 2019 (r354443) +++ stable/12/sys/sys/mount.h Thu Nov 7 15:32:59 2019 (r354444) @@ -396,6 +396,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ #define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */ +#define MNTK_VMSETSIZE_BUG 0x00010000 #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: stable/12/sys/vm/vnode_pager.c ============================================================================== --- stable/12/sys/vm/vnode_pager.c Thu Nov 7 15:00:37 2019 (r354443) +++ stable/12/sys/vm/vnode_pager.c Thu Nov 7 15:32:59 2019 (r354444) @@ -433,7 +433,16 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsi if ((object = vp->v_object) == NULL) return; -/* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */ +#ifdef DEBUG_VFS_LOCKS + { + struct mount *mp; + + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_VMSETSIZE_BUG) == 0) + assert_vop_elocked(vp, + "vnode_pager_setsize and not locked vnode"); + } +#endif VM_OBJECT_WLOCK(object); if (object->type == OBJT_DEAD) { VM_OBJECT_WUNLOCK(object); From owner-svn-src-all@freebsd.org Thu Nov 7 15:39:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 402721B7E2C for ; Thu, 7 Nov 2019 15:39:29 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztdg10021901.me.com (pv50p00im-ztdg10021901.me.com [17.58.6.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4786ym3Yrhz3M5R for ; Thu, 7 Nov 2019 15:39:28 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztdg10021901.me.com (Postfix) with ESMTPSA id 73DBC880DB7; Thu, 7 Nov 2019 15:39:24 +0000 (UTC) From: Toomas Soome Message-Id: <1AFEA810-CC13-444E-BF28-1C3D07CA0FC2@me.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r354435 - head/stand/efi/libefi Date: Thu, 7 Nov 2019 17:39:21 +0200 In-Reply-To: Cc: Toomas Soome , src-committers , svn-src-all , svn-src-head To: Warner Losh References: <201911071117.xA7BH390010873@repo.freebsd.org> X-Mailer: Apple Mail (2.3601.0.10) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-07_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911070149 X-Rspamd-Queue-Id: 4786ym3Yrhz3M5R X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16:c]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RCVD_IN_DNSWL_LOW(-0.10)[55.6.58.17.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[me.com]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-8.62), ipnet: 17.58.0.0/20(-2.45), asn: 714(-2.52), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:39:29 -0000 > On 7. Nov 2019, at 17:29, Warner Losh wrote: >=20 >=20 >=20 > On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome > wrote: > Author: tsoome > Date: Thu Nov 7 11:17:03 2019 > New Revision: 354435 > URL: https://svnweb.freebsd.org/changeset/base/354435 = >=20 > Log: > loader: implement fallback efi_devpath_to_name() >=20 > UEFI 1.10 on macs does not seem to provide devpath to name = translation, > provide our own (limited) version, so we can get information about = commmon > devices. >=20 > We specifically deleted our own version of this function (it was wrong = in many ways too) because we thought we could require a minimum UEFI 2.0 = for full functionality... This sort of function is a total pain to = maintain. >=20 > I'd prefer the fallback was "you don't get this" rather than bloating = the code, especially for devices that we don't care about and will never = care about for booting... >=20 > Warner I can see why, but then again, try to debug such system=E2=80=A6 btw, = that particular one I debug is MacBookPro11,4 with quad core i7=E2=80=A6. = not even that old hw anyhow. I=E2=80=99d rather keep some bloat than spend 2-3 days to write code = just to get any idea what is going on in the machine=E2=80=A6 rgds, toomas > =20 > MFC after: 1 week >=20 > Modified: > head/stand/efi/libefi/devpath.c >=20 > Modified: head/stand/efi/libefi/devpath.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/stand/efi/libefi/devpath.c Thu Nov 7 07:21:45 2019 = (r354434) > +++ head/stand/efi/libefi/devpath.c Thu Nov 7 11:17:03 2019 = (r354435) > @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > +#include >=20 > static EFI_GUID ImageDevicePathGUID =3D > EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; > static EFI_GUID DevicePathGUID =3D DEVICE_PATH_PROTOCOL; > static EFI_GUID DevicePathToTextGUID =3D = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; > static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol; > -static EFI_GUID DevicePathFromTextGUID =3D = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; > +static EFI_GUID DevicePathFromTextGUID =3D > + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; > static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol; >=20 > EFI_DEVICE_PATH * > @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle) > return (devpath); > } >=20 > +static char * > +efi_make_tail(char *suffix) > +{ > + char *tail; > + > + tail =3D NULL; > + if (suffix !=3D NULL) > + (void)asprintf(&tail, "/%s", suffix); > + else > + tail =3D strdup(""); > + return (tail); > +} > + > +typedef struct { > + EFI_DEVICE_PATH Header; > + EFI_GUID Guid; > + UINT8 VendorDefinedData[1]; > +} __packed VENDOR_DEVICE_PATH_WITH_DATA; > + > +static char * > +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char = *suffix) > +{ > + uint32_t size =3D DevicePathNodeLength(&node->Header) - = sizeof(*node); > + VENDOR_DEVICE_PATH_WITH_DATA *dp =3D = (VENDOR_DEVICE_PATH_WITH_DATA *)node; > + char *name, *tail, *head; > + char *uuid; > + int rv; > + > + uuid_to_string((const uuid_t *)(void *)&node->Guid, &uuid, = &rv); > + if (rv !=3D uuid_s_ok) > + return (NULL); > + > + tail =3D efi_make_tail(suffix); > + rv =3D asprintf(&head, "%sVendor(%s)[%x:", type, uuid, size); > + free(uuid); > + if (rv < 0) > + return (NULL); > + > + if (DevicePathNodeLength(&node->Header) > sizeof(*node)) { > + for (uint32_t i =3D 0; i < size; i++) { > + rv =3D asprintf(&name, "%s%02x", head, > + dp->VendorDefinedData[i]); > + if (rv < 0) { > + free(tail); > + free(head); > + return (NULL); > + } > + free(head); > + head =3D name; > + } > + } > + > + if (asprintf(&name, "%s]%s", head, tail) < 0) > + name =3D NULL; > + free(head); > + free(tail); > + return (name); > +} > + > +static char * > +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype =3D DevicePathSubType(node); > + char *name, *tail; > + > + tail =3D efi_make_tail(suffix); > + switch (subtype) { > + case HW_PCI_DP: > + if (asprintf(&name, "Pci(%x,%x)%s", > + ((PCI_DEVICE_PATH *)node)->Function, > + ((PCI_DEVICE_PATH *)node)->Device, tail) < 0) > + name =3D NULL; > + break; > + case HW_PCCARD_DP: > + if (asprintf(&name, "PCCARD(%x)%s", > + ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, = tail) < 0) > + name =3D NULL; > + break; > + case HW_MEMMAP_DP: > + if (asprintf(&name, "MMap(%x,%" PRIx64 ",%" PRIx64 = ")%s", > + ((MEMMAP_DEVICE_PATH *)node)->MemoryType, > + ((MEMMAP_DEVICE_PATH *)node)->StartingAddress, > + ((MEMMAP_DEVICE_PATH *)node)->EndingAddress, tail) = < 0) > + name =3D NULL; > + break; > + case HW_VENDOR_DP: > + name =3D efi_vendor_path("Hardware", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case HW_CONTROLLER_DP: > + if (asprintf(&name, "Ctrl(%x)%s", > + ((CONTROLLER_DEVICE_PATH *)node)->Controller, = tail) < 0) > + name =3D NULL; > + break; > + default: > + if (asprintf(&name, "UnknownHW(%x)%s", subtype, tail) = < 0) > + name =3D NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_acpi_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype =3D DevicePathSubType(node); > + ACPI_HID_DEVICE_PATH *acpi =3D (ACPI_HID_DEVICE_PATH *)node; > + char *name, *tail; > + > + tail =3D efi_make_tail(suffix); > + switch (subtype) { > + case ACPI_DP: > + if ((acpi->HID & PNP_EISA_ID_MASK) =3D=3D = PNP_EISA_ID_CONST) { > + switch (EISA_ID_TO_NUM (acpi->HID)) { > + case 0x0a03: > + if (asprintf(&name, "PciRoot(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + case 0x0a08: > + if (asprintf(&name, "PcieRoot(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + case 0x0604: > + if (asprintf(&name, "Floppy(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + case 0x0301: > + if (asprintf(&name, "Keyboard(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + case 0x0501: > + if (asprintf(&name, "Serial(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + case 0x0401: > + if (asprintf(&name, = "ParallelPort(%x)%s", > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + default: > + if (asprintf(&name, = "Acpi(PNP%04x,%x)%s", > + EISA_ID_TO_NUM(acpi->HID), > + acpi->UID, tail) < 0) > + name =3D NULL; > + break; > + } > + } else { > + if (asprintf(&name, "Acpi(%08x,%x)%s", > + acpi->HID, acpi->UID, tail) < 0) > + name =3D NULL; > + } > + break; > + case ACPI_EXTENDED_DP: > + default: > + if (asprintf(&name, "UnknownACPI(%x)%s", subtype, = tail) < 0) > + name =3D NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_messaging_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype =3D DevicePathSubType(node); > + char *name; > + char *tail; > + > + tail =3D efi_make_tail(suffix); > + switch (subtype) { > + case MSG_ATAPI_DP: > + if (asprintf(&name, "ATA(%s,%s,%x)%s", > + ((ATAPI_DEVICE_PATH *)node)->PrimarySecondary =3D=3D= 1 ? > + "Secondary" : "Primary", > + ((ATAPI_DEVICE_PATH *)node)->SlaveMaster =3D=3D 1 = ? > + "Slave" : "Master", > + ((ATAPI_DEVICE_PATH *)node)->Lun, tail) < 0) > + name =3D NULL; > + break; > + case MSG_SCSI_DP: > + if (asprintf(&name, "SCSI(%x,%x)%s", > + ((SCSI_DEVICE_PATH *)node)->Pun, > + ((SCSI_DEVICE_PATH *)node)->Lun, tail) < 0) > + name =3D NULL; > + break; > + case MSG_FIBRECHANNEL_DP: > + if (asprintf(&name, "Fibre(%" PRIx64 ",%" PRIx64 = ")%s", > + ((FIBRECHANNEL_DEVICE_PATH *)node)->WWN, > + ((FIBRECHANNEL_DEVICE_PATH *)node)->Lun, tail) < = 0) > + name =3D NULL; > + break; > + case MSG_1394_DP: > + if (asprintf(&name, "I1394(%016" PRIx64 ")%s", > + ((F1394_DEVICE_PATH *)node)->Guid, tail) < 0) > + name =3D NULL; > + break; > + case MSG_USB_DP: > + if (asprintf(&name, "USB(%x,%x)%s", > + ((USB_DEVICE_PATH *)node)->ParentPortNumber, > + ((USB_DEVICE_PATH *)node)->InterfaceNumber, tail) = < 0) > + name =3D NULL; > + break; > + case MSG_USB_CLASS_DP: > + if (asprintf(&name, "UsbClass(%x,%x,%x,%x,%x)%s", > + ((USB_CLASS_DEVICE_PATH *)node)->VendorId, > + ((USB_CLASS_DEVICE_PATH *)node)->ProductId, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceClass, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceSubClass, > + ((USB_CLASS_DEVICE_PATH *)node)->DeviceProtocol, = tail) < 0) > + name =3D NULL; > + break; > + case MSG_MAC_ADDR_DP: > + if (asprintf(&name, = "MAC(%02x:%02x:%02x:%02x:%02x:%02x,%x)%s", > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[0], > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[1], > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[2], > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[3], > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[4], > + ((MAC_ADDR_DEVICE_PATH = *)node)->MacAddress.Addr[5], > + ((MAC_ADDR_DEVICE_PATH *)node)->IfType, tail) < 0) > + name =3D NULL; > + break; > + case MSG_VENDOR_DP: > + name =3D efi_vendor_path("Messaging", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case MSG_UART_DP: > + if (asprintf(&name, "UART(%" PRIu64 ",%u,%x,%x)%s", > + ((UART_DEVICE_PATH *)node)->BaudRate, > + ((UART_DEVICE_PATH *)node)->DataBits, > + ((UART_DEVICE_PATH *)node)->Parity, > + ((UART_DEVICE_PATH *)node)->StopBits, tail) < 0) > + name =3D NULL; > + break; > + case MSG_SATA_DP: > + if (asprintf(&name, "Sata(%x,%x,%x)%s", > + ((SATA_DEVICE_PATH *)node)->HBAPortNumber, > + ((SATA_DEVICE_PATH = *)node)->PortMultiplierPortNumber, > + ((SATA_DEVICE_PATH *)node)->Lun, tail) < 0) > + name =3D NULL; > + break; > + default: > + if (asprintf(&name, "UnknownMessaging(%x)%s", > + subtype, tail) < 0) > + name =3D NULL; > + break; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_media_dev_path(EFI_DEVICE_PATH *node, char *suffix) > +{ > + uint8_t subtype =3D DevicePathSubType(node); > + HARDDRIVE_DEVICE_PATH *hd; > + char *name; > + char *str; > + char *tail; > + int rv; > + > + tail =3D efi_make_tail(suffix); > + name =3D NULL; > + switch (subtype) { > + case MEDIA_HARDDRIVE_DP: > + hd =3D (HARDDRIVE_DEVICE_PATH *)node; > + switch (hd->SignatureType) { > + case SIGNATURE_TYPE_MBR: > + if (asprintf(&name, "HD(%d,MBR,%08x,%" PRIx64 > + ",%" PRIx64 ")%s", > + hd->PartitionNumber, > + *((uint32_t = *)(uintptr_t)&hd->Signature[0]), > + hd->PartitionStart, > + hd->PartitionSize, tail) < 0) > + name =3D NULL; > + break; > + case SIGNATURE_TYPE_GUID: > + name =3D NULL; > + uuid_to_string((const uuid_t *)(void *) > + &hd->Signature[0], &str, &rv); > + if (rv !=3D uuid_s_ok) > + break; > + rv =3D asprintf(&name, "HD(%d,GPT,%s,%" PRIx64 = ",%" > + PRIx64 ")%s", > + hd->PartitionNumber, str, > + hd->PartitionStart, hd->PartitionSize, = tail); > + free(str); > + break; > + default: > + if (asprintf(&name, "HD(%d,%d,0)%s", > + hd->PartitionNumber, > + hd->SignatureType, tail) < 0) { > + name =3D NULL; > + } > + break; > + } > + break; > + case MEDIA_CDROM_DP: > + if (asprintf(&name, "CD(%x,%" PRIx64 ",%" PRIx64 = ")%s", > + ((CDROM_DEVICE_PATH *)node)->BootEntry, > + ((CDROM_DEVICE_PATH *)node)->PartitionStart, > + ((CDROM_DEVICE_PATH *)node)->PartitionSize, tail) = < 0) { > + name =3D NULL; > + } > + break; > + case MEDIA_VENDOR_DP: > + name =3D efi_vendor_path("Media", > + (VENDOR_DEVICE_PATH *)node, tail); > + break; > + case MEDIA_FILEPATH_DP: > + name =3D NULL; > + str =3D NULL; > + if (ucs2_to_utf8(((FILEPATH_DEVICE_PATH = *)node)->PathName, > + &str) =3D=3D 0) { > + (void)asprintf(&name, "%s%s", str, tail); > + free(str); > + } > + break; > + case MEDIA_PROTOCOL_DP: > + name =3D NULL; > + uuid_to_string((const uuid_t *)(void *) > + &((MEDIA_PROTOCOL_DEVICE_PATH *)node)->Protocol, > + &str, &rv); > + if (rv !=3D uuid_s_ok) > + break; > + rv =3D asprintf(&name, "Protocol(%s)%s", str, tail); > + free(str); > + break; > + default: > + if (asprintf(&name, "UnknownMedia(%x)%s", > + subtype, tail) < 0) > + name =3D NULL; > + } > + free(tail); > + return (name); > +} > + > +static char * > +efi_translate_devpath(EFI_DEVICE_PATH *devpath) > +{ > + EFI_DEVICE_PATH *dp =3D NextDevicePathNode(devpath); > + char *name, *ptr; > + uint8_t type; > + > + if (!IsDevicePathEnd(devpath)) > + name =3D efi_translate_devpath(dp); > + else > + return (NULL); > + > + ptr =3D NULL; > + type =3D DevicePathType(devpath); > + switch (type) { > + case HARDWARE_DEVICE_PATH: > + ptr =3D efi_hw_dev_path(devpath, name); > + break; > + case ACPI_DEVICE_PATH: > + ptr =3D efi_acpi_dev_path(devpath, name); > + break; > + case MESSAGING_DEVICE_PATH: > + ptr =3D efi_messaging_dev_path(devpath, name); > + break; > + case MEDIA_DEVICE_PATH: > + ptr =3D efi_media_dev_path(devpath, name); > + break; > + case BBS_DEVICE_PATH: > + default: > + if (asprintf(&ptr, "UnknownPath(%x)%s", type, > + name? name : "") < 0) > + ptr =3D NULL; > + break; > + } > + > + if (ptr !=3D NULL) { > + free(name); > + name =3D ptr; > + } > + return (name); > +} > + > +static CHAR16 * > +efi_devpath_to_name(EFI_DEVICE_PATH *devpath) > +{ > + char *name =3D NULL; > + CHAR16 *ptr =3D NULL; > + size_t len; > + int rv; > + > + name =3D efi_translate_devpath(devpath); > + if (name =3D=3D NULL) > + return (NULL); > + > + /* > + * We need to return memory from AllocatePool, so it can be = freed > + * with FreePool() in efi_free_devpath_name(). > + */ > + rv =3D utf8_to_ucs2(name, &ptr, &len); > + free(name); > + if (rv =3D=3D 0) { > + CHAR16 *out =3D NULL; > + EFI_STATUS status; > + > + status =3D BS->AllocatePool(EfiLoaderData, len, (void = **)&out); > + if (EFI_ERROR(status)) { > + free(ptr); > + return (out); > + } > + memcpy(out, ptr, len); > + free(ptr); > + ptr =3D out; > + } > + =20 > + return (ptr); > +} > + > CHAR16 * > efi_devpath_name(EFI_DEVICE_PATH *devpath) > { > @@ -78,7 +502,7 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) > toTextProtocol =3D NULL; > } > if (toTextProtocol =3D=3D NULL) > - return (NULL); > + return (efi_devpath_to_name(devpath)); >=20 > return (toTextProtocol->ConvertDevicePathToText(devpath, TRUE, = TRUE)); > } > @@ -86,8 +510,8 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) > void > efi_free_devpath_name(CHAR16 *text) > { > - > - BS->FreePool(text); > + if (text !=3D NULL) > + BS->FreePool(text); > } >=20 > EFI_DEVICE_PATH * From owner-svn-src-all@freebsd.org Thu Nov 7 15:47:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6AD61B8153; Thu, 7 Nov 2019 15:47:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47877Z3fvSz3MdP; Thu, 7 Nov 2019 15:47:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D0DFFFD2; Thu, 7 Nov 2019 15:47:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Fl6rq074929; Thu, 7 Nov 2019 15:47:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Fl6qs074928; Thu, 7 Nov 2019 15:47:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071547.xA7Fl6qs074928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 15:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354445 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:47:06 -0000 Author: emaste Date: Thu Nov 7 15:47:05 2019 New Revision: 354445 URL: https://svnweb.freebsd.org/changeset/base/354445 Log: nvdimm.4: small grammar improvements Modified: head/share/man/man4/nvdimm.4 Modified: head/share/man/man4/nvdimm.4 ============================================================================== --- head/share/man/man4/nvdimm.4 Thu Nov 7 15:32:59 2019 (r354444) +++ head/share/man/man4/nvdimm.4 Thu Nov 7 15:47:05 2019 (r354445) @@ -121,12 +121,12 @@ and then updated by .Sh BUGS The .Nm -driver does not utilize the Block Window interface, so if the write to -NVDIMM was interrupted due to a system crash or power outage, -the corresponding page might be left in partially updated state. +driver does not utilize the Block Window interface, so if a write to an +NVDIMM is interrupted due to a system crash or power outage, +the corresponding page might be left in a partially updated state. .Pp There is no support for Device-Specific Methods (DSM), used to report and -control the device health and wearing. +control device health and wearing. .Pp The driver depends on the .Xr pmap_largemap 9 From owner-svn-src-all@freebsd.org Thu Nov 7 15:48:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E3921B81F2; Thu, 7 Nov 2019 15:48:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47879V6fhKz3MmX; Thu, 7 Nov 2019 15:48:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C344FFFD3; Thu, 7 Nov 2019 15:48:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7FmkjZ075044; Thu, 7 Nov 2019 15:48:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Fmklo075043; Thu, 7 Nov 2019 15:48:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071548.xA7Fmklo075043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 15:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354446 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 354446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:48:47 -0000 Author: emaste Date: Thu Nov 7 15:48:46 2019 New Revision: 354446 URL: https://svnweb.freebsd.org/changeset/base/354446 Log: rc.shutdown: print a newline before watchdog timeout message Previously the watchdog timeout message was appended to the last entry in the "Waiting for PIDS" list, resulting in a message like Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout expired. Shutdown terminated. Print a newline to separate the watchdog timeout message. Also perform the kill before logging or echoing the message. PR: 241072 MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/libexec/rc/rc.shutdown Modified: head/libexec/rc/rc.shutdown ============================================================================== --- head/libexec/rc/rc.shutdown Thu Nov 7 15:47:05 2019 (r354445) +++ head/libexec/rc/rc.shutdown Thu Nov 7 15:48:46 2019 (r354446) @@ -69,12 +69,13 @@ _rcshutdown_watchdog= if [ -n "$rcshutdown_timeout" ]; then debug "Initiating watchdog timer." sleep $rcshutdown_timeout && ( + kill -KILL $$ >/dev/null 2>&1 _msg="$rcshutdown_timeout second watchdog" _msg="$_msg timeout expired. Shutdown terminated." logger -t rc.shutdown "$_msg" + echo echo "$_msg" date - kill -KILL $$ >/dev/null 2>&1 ) & _rcshutdown_watchdog=$! fi From owner-svn-src-all@freebsd.org Thu Nov 7 15:51:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC9F51B8306; Thu, 7 Nov 2019 15:51:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4787Dx4882z3NBy; Thu, 7 Nov 2019 15:51:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72A241813F; Thu, 7 Nov 2019 15:51:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7FpjjQ077826; Thu, 7 Nov 2019 15:51:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7FpjML077824; Thu, 7 Nov 2019 15:51:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071551.xA7FpjML077824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 15:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354447 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 354447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 15:51:45 -0000 Author: emaste Date: Thu Nov 7 15:51:44 2019 New Revision: 354447 URL: https://svnweb.freebsd.org/changeset/base/354447 Log: linux_renameat2: improve flag checks In the cases where Linux returns an error (e.g. passing in an undefined flag) there's no need for us to emit a message. (The target of this message is a developer working on the linuxulatorm, not the author of presumably broken Linux software). Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21606 Modified: head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Thu Nov 7 15:48:46 2019 (r354446) +++ head/sys/compat/linux/linux_file.c Thu Nov 7 15:51:44 2019 (r354447) @@ -704,6 +704,13 @@ linux_renameat2(struct thread *td, struct linux_rename int error, olddfd, newdfd; if (args->flags != 0) { + if (args->flags & ~(LINUX_RENAME_EXCHANGE | + LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT)) + return (EINVAL); + if (args->flags & LINUX_RENAME_EXCHANGE && + args->flags & (LINUX_RENAME_NOREPLACE | + LINUX_RENAME_WHITEOUT)) + return (EINVAL); linux_msg(td, "renameat2 unsupported flags 0x%x", args->flags); return (EINVAL); Modified: head/sys/compat/linux/linux_file.h ============================================================================== --- head/sys/compat/linux/linux_file.h Thu Nov 7 15:48:46 2019 (r354446) +++ head/sys/compat/linux/linux_file.h Thu Nov 7 15:51:44 2019 (r354447) @@ -127,4 +127,11 @@ #define LINUX_F_UNLCK 2 #endif +/* + * renameat2 flags + */ +#define LINUX_RENAME_NOREPLACE 0x00000001 +#define LINUX_RENAME_EXCHANGE 0x00000002 +#define LINUX_RENAME_WHITEOUT 0x00000004 + #endif /* !_LINUX_FILE_H_ */ From owner-svn-src-all@freebsd.org Thu Nov 7 16:23:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A25781B92F9 for ; Thu, 7 Nov 2019 16:23:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4787xH3kRVz3Q8y for ; Thu, 7 Nov 2019 16:23:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf29.google.com with SMTP id cg2so1013193qvb.10 for ; Thu, 07 Nov 2019 08:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ly3AIzavJ1t0FKV7pmvPXT8NUWZQjbG7kNJ7hrbLY1c=; b=AMcVXWQESQizTgDpsCYM0zchf5EbB82Y4RL7Zr6MPGwbePSkzyivX7B3PmjJ/Q9qtF 5+vljPL7Y6YE9DRxZG8RLRGOUjX4sOKdBFwV5iI85ffTLt1SegZhXDTs12YgsscyU86P g9CIp37bTXXTM61BtHtTgyA69AUi3abEXs9g9o5bS9ItdVGj98JqnrABdkvtTjIwktLH 5IDqUcBnwXe2piXLJjiryrc0t1pQPvhPq8DmyzUD5M+sdRodRWG8krQlgb6rvbCVVa0P qWFhG0LNhFnrr8XcWXnCdFp7YUZSVtW6JNw7ayh+eLJXABWwzrRHiFwVUbjSq4Ym/CUL smgw== 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=Ly3AIzavJ1t0FKV7pmvPXT8NUWZQjbG7kNJ7hrbLY1c=; b=PyofKC7trrggH2Mu0U1QlIcLdYGU7ppnGy7O4Q/z37v9+9GQPEdYVfU88Xw4GOuqz1 T4BhhOgJXliFYWZPC7WFaoIB5ptUw/tDxjNEagrWyCGd6oOCTLPuroniIkCMBhSa3kHI Qd12V41DLkNmCu6UzNc6x0Uemp8uBLsb1Rx2jwxRoNdh1RfXNFXE1Z7tNXbR54p9yhDY I8AbQpDFYo3U57jLmk2RA5rqMcA7UeqDr08bO91pWtMoHYth3Z1sjndbvxCS72wzbfuj 8a8kXQTgkY+/fVzI8sgF9haBjZXLoNbhsAnRkNRzRHFw5QDFFZvsL0qO5tR8jlETUnD/ orYg== X-Gm-Message-State: APjAAAVWSb6dpQY3VcKl1yukrjSsFUzwbzZ/kyPB62U9ItEwOrOf+cIW LsVcLtZuOQR323g/qjt5IFQwrsQzqBSD+g8z3KxwVQ== X-Google-Smtp-Source: APXvYqwtfSgML5r+96XyxQmUbMWs8SaD8ClmypL/71muyxYCxpCLWEhl3mH/88bTwQgidUS8COY2/j46AYAkJCX/rw0= X-Received: by 2002:a0c:ee49:: with SMTP id m9mr4375898qvs.118.1573143793754; Thu, 07 Nov 2019 08:23:13 -0800 (PST) MIME-Version: 1.0 References: <201911071117.xA7BH390010873@repo.freebsd.org> <1AFEA810-CC13-444E-BF28-1C3D07CA0FC2@me.com> In-Reply-To: <1AFEA810-CC13-444E-BF28-1C3D07CA0FC2@me.com> From: Warner Losh Date: Thu, 7 Nov 2019 09:23:02 -0700 Message-ID: Subject: Re: svn commit: r354435 - head/stand/efi/libefi To: Toomas Soome Cc: Toomas Soome , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4787xH3kRVz3Q8y X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=AMcVXWQE; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f29) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.78 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MIME_BASE64_TEXT(0.10)[]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[me.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.35), asn: 15169(-2.01), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 16:23:16 -0000 On Thu, Nov 7, 2019 at 8:39 AM Toomas Soome wrote: > > > On 7. Nov 2019, at 17:29, Warner Losh wrote: > > > > On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome wrote: > >> Author: tsoome >> Date: Thu Nov 7 11:17:03 2019 >> New Revision: 354435 >> URL: https://svnweb.freebsd.org/changeset/base/354435 >> >> Log: >> loader: implement fallback efi_devpath_to_name() >> >> UEFI 1.10 on macs does not seem to provide devpath to name translation= , >> provide our own (limited) version, so we can get information about >> commmon >> devices. >> > > We specifically deleted our own version of this function (it was wrong in > many ways too) because we thought we could require a minimum UEFI 2.0 for > full functionality... This sort of function is a total pain to maintain. > > I'd prefer the fallback was "you don't get this" rather than bloating the > code, especially for devices that we don't care about and will never care > about for booting... > > Warner > > > > I can see why, but then again, try to debug such system=E2=80=A6 btw, th= at > particular one I debug is MacBookPro11,4 with quad core i7=E2=80=A6. not= even that > old hw anyhow. > > I=E2=80=99d rather keep some bloat than spend 2-3 days to write code just= to get > any idea what is going on in the machine=E2=80=A6 > Yea, that's surprising... The initial reports we'd received were only from super-old macbooks. We'd also been told that newer versions were newer UEFI revisions, so not to worry... Guess there's some disconnect here. If there's modern gear that still use this old revision, that's quite useful to know... we've made other decisions that would exclude 1.2-level implementations as well... Warner > rgds, > toomas > > > > >> MFC after: 1 week >> >> Modified: >> head/stand/efi/libefi/devpath.c >> >> Modified: head/stand/efi/libefi/devpath.c >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/stand/efi/libefi/devpath.c Thu Nov 7 07:21:45 2019 >> (r354434) >> +++ head/stand/efi/libefi/devpath.c Thu Nov 7 11:17:03 2019 >> (r354435) >> @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> +#include >> >> static EFI_GUID ImageDevicePathGUID =3D >> EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; >> static EFI_GUID DevicePathGUID =3D DEVICE_PATH_PROTOCOL; >> static EFI_GUID DevicePathToTextGUID =3D >> EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; >> static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol; >> -static EFI_GUID DevicePathFromTextGUID =3D >> EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; >> +static EFI_GUID DevicePathFromTextGUID =3D >> + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; >> static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol; >> >> EFI_DEVICE_PATH * >> @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle) >> return (devpath); >> } >> >> +static char * >> +efi_make_tail(char *suffix) >> +{ >> + char *tail; >> + >> + tail =3D NULL; >> + if (suffix !=3D NULL) >> + (void)asprintf(&tail, "/%s", suffix); >> + else >> + tail =3D strdup(""); >> + return (tail); >> +} >> + >> +typedef struct { >> + EFI_DEVICE_PATH Header; >> + EFI_GUID Guid; >> + UINT8 VendorDefinedData[1]; >> +} __packed VENDOR_DEVICE_PATH_WITH_DATA; >> + >> +static char * >> +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffi= x) >> +{ >> + uint32_t size =3D DevicePathNodeLength(&node->Header) - >> sizeof(*node); >> + VENDOR_DEVICE_PATH_WITH_DATA *dp =3D (VENDOR_DEVICE_PATH_WITH_DA= TA >> *)node; >> + char *name, *tail, *head; >> + char *uuid; >> + int rv; >> + >> + uuid_to_string((const uuid_t *)(void *)&node->Guid, &uuid, &rv); >> + if (rv !=3D uuid_s_ok) >> + return (NULL); >> + >> + tail =3D efi_make_tail(suffix); >> + rv =3D asprintf(&head, "%sVendor(%s)[%x:", type, uuid, size); >> + free(uuid); >> + if (rv < 0) >> + return (NULL); >> + >> + if (DevicePathNodeLength(&node->Header) > sizeof(*node)) { >> + for (uint32_t i =3D 0; i < size; i++) { >> + rv =3D asprintf(&name, "%s%02x", head, >> + dp->VendorDefinedData[i]); >> + if (rv < 0) { >> + free(tail); >> + free(head); >> + return (NULL); >> + } >> + free(head); >> + head =3D name; >> + } >> + } >> + >> + if (asprintf(&name, "%s]%s", head, tail) < 0) >> + name =3D NULL; >> + free(head); >> + free(tail); >> + return (name); >> +} >> + >> +static char * >> +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix) >> +{ >> + uint8_t subtype =3D DevicePathSubType(node); >> + char *name, *tail; >> + >> + tail =3D efi_make_tail(suffix); >> + switch (subtype) { >> + case HW_PCI_DP: >> + if (asprintf(&name, "Pci(%x,%x)%s", >> + ((PCI_DEVICE_PATH *)node)->Function, >> + ((PCI_DEVICE_PATH *)node)->Device, tail) < 0) >> + name =3D NULL; >> + break; >> + case HW_PCCARD_DP: >> + if (asprintf(&name, "PCCARD(%x)%s", >> + ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, tail) = < >> 0) >> + name =3D NULL; >> + break; >> + case HW_MEMMAP_DP: >> + if (asprintf(&name, "MMap(%x,%" PRIx64 ",%" PRIx64 ")%s"= , >> + ((MEMMAP_DEVICE_PATH *)node)->MemoryType, >> + ((MEMMAP_DEVICE_PATH *)node)->StartingAddress, >> + ((MEMMAP_DEVICE_PATH *)node)->EndingAddress, tail) < >> 0) >> + name =3D NULL; >> + break; >> + case HW_VENDOR_DP: >> + name =3D efi_vendor_path("Hardware", >> + (VENDOR_DEVICE_PATH *)node, tail); >> + break; >> + case HW_CONTROLLER_DP: >> + if (asprintf(&name, "Ctrl(%x)%s", >> + ((CONTROLLER_DEVICE_PATH *)node)->Controller, tail) = < >> 0) >> + name =3D NULL; >> + break; >> + default: >> + if (asprintf(&name, "UnknownHW(%x)%s", subtype, tail) < = 0) >> + name =3D NULL; >> + break; >> + } >> + free(tail); >> + return (name); >> +} >> + >> +static char * >> +efi_acpi_dev_path(EFI_DEVICE_PATH *node, char *suffix) >> +{ >> + uint8_t subtype =3D DevicePathSubType(node); >> + ACPI_HID_DEVICE_PATH *acpi =3D (ACPI_HID_DEVICE_PATH *)node; >> + char *name, *tail; >> + >> + tail =3D efi_make_tail(suffix); >> + switch (subtype) { >> + case ACPI_DP: >> + if ((acpi->HID & PNP_EISA_ID_MASK) =3D=3D PNP_EISA_ID_CO= NST) { >> + switch (EISA_ID_TO_NUM (acpi->HID)) { >> + case 0x0a03: >> + if (asprintf(&name, "PciRoot(%x)%s", >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + case 0x0a08: >> + if (asprintf(&name, "PcieRoot(%x)%s", >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + case 0x0604: >> + if (asprintf(&name, "Floppy(%x)%s", >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + case 0x0301: >> + if (asprintf(&name, "Keyboard(%x)%s", >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + case 0x0501: >> + if (asprintf(&name, "Serial(%x)%s", >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + case 0x0401: >> + if (asprintf(&name, "ParallelPort(%x)%s"= , >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + default: >> + if (asprintf(&name, "Acpi(PNP%04x,%x)%s"= , >> + EISA_ID_TO_NUM(acpi->HID), >> + acpi->UID, tail) < 0) >> + name =3D NULL; >> + break; >> + } >> + } else { >> + if (asprintf(&name, "Acpi(%08x,%x)%s", >> + acpi->HID, acpi->UID, tail) < 0) >> + name =3D NULL; >> + } >> + break; >> + case ACPI_EXTENDED_DP: >> + default: >> + if (asprintf(&name, "UnknownACPI(%x)%s", subtype, tail) = < >> 0) >> + name =3D NULL; >> + break; >> + } >> + free(tail); >> + return (name); >> +} >> + >> +static char * >> +efi_messaging_dev_path(EFI_DEVICE_PATH *node, char *suffix) >> +{ >> + uint8_t subtype =3D DevicePathSubType(node); >> + char *name; >> + char *tail; >> + >> + tail =3D efi_make_tail(suffix); >> + switch (subtype) { >> + case MSG_ATAPI_DP: >> + if (asprintf(&name, "ATA(%s,%s,%x)%s", >> + ((ATAPI_DEVICE_PATH *)node)->PrimarySecondary =3D=3D= 1 ? >> + "Secondary" : "Primary", >> + ((ATAPI_DEVICE_PATH *)node)->SlaveMaster =3D=3D 1 ? >> + "Slave" : "Master", >> + ((ATAPI_DEVICE_PATH *)node)->Lun, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_SCSI_DP: >> + if (asprintf(&name, "SCSI(%x,%x)%s", >> + ((SCSI_DEVICE_PATH *)node)->Pun, >> + ((SCSI_DEVICE_PATH *)node)->Lun, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_FIBRECHANNEL_DP: >> + if (asprintf(&name, "Fibre(%" PRIx64 ",%" PRIx64 ")%s", >> + ((FIBRECHANNEL_DEVICE_PATH *)node)->WWN, >> + ((FIBRECHANNEL_DEVICE_PATH *)node)->Lun, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_1394_DP: >> + if (asprintf(&name, "I1394(%016" PRIx64 ")%s", >> + ((F1394_DEVICE_PATH *)node)->Guid, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_USB_DP: >> + if (asprintf(&name, "USB(%x,%x)%s", >> + ((USB_DEVICE_PATH *)node)->ParentPortNumber, >> + ((USB_DEVICE_PATH *)node)->InterfaceNumber, tail) < = 0) >> + name =3D NULL; >> + break; >> + case MSG_USB_CLASS_DP: >> + if (asprintf(&name, "UsbClass(%x,%x,%x,%x,%x)%s", >> + ((USB_CLASS_DEVICE_PATH *)node)->VendorId, >> + ((USB_CLASS_DEVICE_PATH *)node)->ProductId, >> + ((USB_CLASS_DEVICE_PATH *)node)->DeviceClass, >> + ((USB_CLASS_DEVICE_PATH *)node)->DeviceSubClass, >> + ((USB_CLASS_DEVICE_PATH *)node)->DeviceProtocol, >> tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_MAC_ADDR_DP: >> + if (asprintf(&name, >> "MAC(%02x:%02x:%02x:%02x:%02x:%02x,%x)%s", >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[0], >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[1], >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[2], >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[3], >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[4], >> + ((MAC_ADDR_DEVICE_PATH *)node)->MacAddress.Addr[5], >> + ((MAC_ADDR_DEVICE_PATH *)node)->IfType, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_VENDOR_DP: >> + name =3D efi_vendor_path("Messaging", >> + (VENDOR_DEVICE_PATH *)node, tail); >> + break; >> + case MSG_UART_DP: >> + if (asprintf(&name, "UART(%" PRIu64 ",%u,%x,%x)%s", >> + ((UART_DEVICE_PATH *)node)->BaudRate, >> + ((UART_DEVICE_PATH *)node)->DataBits, >> + ((UART_DEVICE_PATH *)node)->Parity, >> + ((UART_DEVICE_PATH *)node)->StopBits, tail) < 0) >> + name =3D NULL; >> + break; >> + case MSG_SATA_DP: >> + if (asprintf(&name, "Sata(%x,%x,%x)%s", >> + ((SATA_DEVICE_PATH *)node)->HBAPortNumber, >> + ((SATA_DEVICE_PATH *)node)->PortMultiplierPortNumber= , >> + ((SATA_DEVICE_PATH *)node)->Lun, tail) < 0) >> + name =3D NULL; >> + break; >> + default: >> + if (asprintf(&name, "UnknownMessaging(%x)%s", >> + subtype, tail) < 0) >> + name =3D NULL; >> + break; >> + } >> + free(tail); >> + return (name); >> +} >> + >> +static char * >> +efi_media_dev_path(EFI_DEVICE_PATH *node, char *suffix) >> +{ >> + uint8_t subtype =3D DevicePathSubType(node); >> + HARDDRIVE_DEVICE_PATH *hd; >> + char *name; >> + char *str; >> + char *tail; >> + int rv; >> + >> + tail =3D efi_make_tail(suffix); >> + name =3D NULL; >> + switch (subtype) { >> + case MEDIA_HARDDRIVE_DP: >> + hd =3D (HARDDRIVE_DEVICE_PATH *)node; >> + switch (hd->SignatureType) { >> + case SIGNATURE_TYPE_MBR: >> + if (asprintf(&name, "HD(%d,MBR,%08x,%" PRIx64 >> + ",%" PRIx64 ")%s", >> + hd->PartitionNumber, >> + *((uint32_t *)(uintptr_t)&hd->Signature[0]), >> + hd->PartitionStart, >> + hd->PartitionSize, tail) < 0) >> + name =3D NULL; >> + break; >> + case SIGNATURE_TYPE_GUID: >> + name =3D NULL; >> + uuid_to_string((const uuid_t *)(void *) >> + &hd->Signature[0], &str, &rv); >> + if (rv !=3D uuid_s_ok) >> + break; >> + rv =3D asprintf(&name, "HD(%d,GPT,%s,%" PRIx64 "= ,%" >> + PRIx64 ")%s", >> + hd->PartitionNumber, str, >> + hd->PartitionStart, hd->PartitionSize, tail)= ; >> + free(str); >> + break; >> + default: >> + if (asprintf(&name, "HD(%d,%d,0)%s", >> + hd->PartitionNumber, >> + hd->SignatureType, tail) < 0) { >> + name =3D NULL; >> + } >> + break; >> + } >> + break; >> + case MEDIA_CDROM_DP: >> + if (asprintf(&name, "CD(%x,%" PRIx64 ",%" PRIx64 ")%s", >> + ((CDROM_DEVICE_PATH *)node)->BootEntry, >> + ((CDROM_DEVICE_PATH *)node)->PartitionStart, >> + ((CDROM_DEVICE_PATH *)node)->PartitionSize, tail) < >> 0) { >> + name =3D NULL; >> + } >> + break; >> + case MEDIA_VENDOR_DP: >> + name =3D efi_vendor_path("Media", >> + (VENDOR_DEVICE_PATH *)node, tail); >> + break; >> + case MEDIA_FILEPATH_DP: >> + name =3D NULL; >> + str =3D NULL; >> + if (ucs2_to_utf8(((FILEPATH_DEVICE_PATH *)node)->PathNam= e, >> + &str) =3D=3D 0) { >> + (void)asprintf(&name, "%s%s", str, tail); >> + free(str); >> + } >> + break; >> + case MEDIA_PROTOCOL_DP: >> + name =3D NULL; >> + uuid_to_string((const uuid_t *)(void *) >> + &((MEDIA_PROTOCOL_DEVICE_PATH *)node)->Protocol, >> + &str, &rv); >> + if (rv !=3D uuid_s_ok) >> + break; >> + rv =3D asprintf(&name, "Protocol(%s)%s", str, tail); >> + free(str); >> + break; >> + default: >> + if (asprintf(&name, "UnknownMedia(%x)%s", >> + subtype, tail) < 0) >> + name =3D NULL; >> + } >> + free(tail); >> + return (name); >> +} >> + >> +static char * >> +efi_translate_devpath(EFI_DEVICE_PATH *devpath) >> +{ >> + EFI_DEVICE_PATH *dp =3D NextDevicePathNode(devpath); >> + char *name, *ptr; >> + uint8_t type; >> + >> + if (!IsDevicePathEnd(devpath)) >> + name =3D efi_translate_devpath(dp); >> + else >> + return (NULL); >> + >> + ptr =3D NULL; >> + type =3D DevicePathType(devpath); >> + switch (type) { >> + case HARDWARE_DEVICE_PATH: >> + ptr =3D efi_hw_dev_path(devpath, name); >> + break; >> + case ACPI_DEVICE_PATH: >> + ptr =3D efi_acpi_dev_path(devpath, name); >> + break; >> + case MESSAGING_DEVICE_PATH: >> + ptr =3D efi_messaging_dev_path(devpath, name); >> + break; >> + case MEDIA_DEVICE_PATH: >> + ptr =3D efi_media_dev_path(devpath, name); >> + break; >> + case BBS_DEVICE_PATH: >> + default: >> + if (asprintf(&ptr, "UnknownPath(%x)%s", type, >> + name? name : "") < 0) >> + ptr =3D NULL; >> + break; >> + } >> + >> + if (ptr !=3D NULL) { >> + free(name); >> + name =3D ptr; >> + } >> + return (name); >> +} >> + >> +static CHAR16 * >> +efi_devpath_to_name(EFI_DEVICE_PATH *devpath) >> +{ >> + char *name =3D NULL; >> + CHAR16 *ptr =3D NULL; >> + size_t len; >> + int rv; >> + >> + name =3D efi_translate_devpath(devpath); >> + if (name =3D=3D NULL) >> + return (NULL); >> + >> + /* >> + * We need to return memory from AllocatePool, so it can be free= d >> + * with FreePool() in efi_free_devpath_name(). >> + */ >> + rv =3D utf8_to_ucs2(name, &ptr, &len); >> + free(name); >> + if (rv =3D=3D 0) { >> + CHAR16 *out =3D NULL; >> + EFI_STATUS status; >> + >> + status =3D BS->AllocatePool(EfiLoaderData, len, (void >> **)&out); >> + if (EFI_ERROR(status)) { >> + free(ptr); >> + return (out); >> + } >> + memcpy(out, ptr, len); >> + free(ptr); >> + ptr =3D out; >> + } >> + >> + return (ptr); >> +} >> + >> CHAR16 * >> efi_devpath_name(EFI_DEVICE_PATH *devpath) >> { >> @@ -78,7 +502,7 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) >> toTextProtocol =3D NULL; >> } >> if (toTextProtocol =3D=3D NULL) >> - return (NULL); >> + return (efi_devpath_to_name(devpath)); >> >> return (toTextProtocol->ConvertDevicePathToText(devpath, TRUE, >> TRUE)); >> } >> @@ -86,8 +510,8 @@ efi_devpath_name(EFI_DEVICE_PATH *devpath) >> void >> efi_free_devpath_name(CHAR16 *text) >> { >> - >> - BS->FreePool(text); >> + if (text !=3D NULL) >> + BS->FreePool(text); >> } >> >> EFI_DEVICE_PATH * >> > > From owner-svn-src-all@freebsd.org Thu Nov 7 17:00:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C29261B9CA6; Thu, 7 Nov 2019 17:00:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4788m44lNdz3x8F; Thu, 7 Nov 2019 17:00:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8746318D42; Thu, 7 Nov 2019 17:00:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7H0Kih017182; Thu, 7 Nov 2019 17:00:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7H0KS5017181; Thu, 7 Nov 2019 17:00:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911071700.xA7H0KS5017181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 17:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354448 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 17:00:20 -0000 Author: glebius Date: Thu Nov 7 17:00:20 2019 New Revision: 354448 URL: https://svnweb.freebsd.org/changeset/base/354448 Log: Widen network epoch coverage in nd6_prefix_onlink() as in6ifa_ifpforlinklocal() requires the epoch. Reported by: bz Reviewed by: bz Modified: head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Thu Nov 7 15:51:44 2019 (r354447) +++ head/sys/netinet6/nd6_rtr.c Thu Nov 7 17:00:20 2019 (r354448) @@ -1974,6 +1974,7 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru int nd6_prefix_onlink(struct nd_prefix *pr) { + struct epoch_tracker et; struct ifaddr *ifa; struct ifnet *ifp = pr->ndpr_ifp; struct nd_prefix *opr; @@ -2018,22 +2019,20 @@ nd6_prefix_onlink(struct nd_prefix *pr) * We prefer link-local addresses as the associated interface address. */ /* search for a link-local addr */ + NET_EPOCH_ENTER(et); ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp, IN6_IFF_NOTREADY | IN6_IFF_ANYCAST); if (ifa == NULL) { - struct epoch_tracker et; - /* XXX: freebsd does not have ifa_ifwithaf */ - NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET6) { ifa_ref(ifa); break; } } - NET_EPOCH_EXIT(et); /* should we care about ia6_flags? */ } + NET_EPOCH_EXIT(et); if (ifa == NULL) { /* * This can still happen, when, for example, we receive an RA From owner-svn-src-all@freebsd.org Thu Nov 7 17:10:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FD991BA0F3; Thu, 7 Nov 2019 17:10:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4788zw0YsHz3y1V; Thu, 7 Nov 2019 17:10:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EACA718F35; Thu, 7 Nov 2019 17:10:35 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7HAZXO023840; Thu, 7 Nov 2019 17:10:35 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7HAYrU023832; Thu, 7 Nov 2019 17:10:34 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911071710.xA7HAYrU023832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 17:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354449 - in head: . libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Commit-Revision: 354449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 17:10:36 -0000 Author: brooks Date: Thu Nov 7 17:10:33 2019 New Revision: 354449 URL: https://svnweb.freebsd.org/changeset/base/354449 Log: libcompat: build 32-bit rtld and ldd as part of "everything" Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Reviewed by: imp, kib Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251 Added: head/libexec/rtld-elf32/ head/libexec/rtld-elf32/Makefile (contents, props changed) head/usr.bin/ldd32/ head/usr.bin/ldd32/Makefile (contents, props changed) Modified: head/Makefile.inc1 head/Makefile.libcompat head/libexec/Makefile head/libexec/rtld-elf/Makefile head/share/mk/bsd.compat.mk head/share/mk/src.opts.mk head/usr.bin/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 7 17:00:20 2019 (r354448) +++ head/Makefile.inc1 Thu Nov 7 17:10:33 2019 (r354449) @@ -802,11 +802,10 @@ XCFLAGS+= --sysroot=${WORLDTMP} XCFLAGS+= ${BFLAGS} .endif -.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ - ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "") +.if ${MK_LIB32} == "yes" _LIBCOMPAT= 32 .include "Makefile.libcompat" -.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != "" +.elif ${MK_LIBSOFT} == "yes" _LIBCOMPAT= SOFT .include "Makefile.libcompat" .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu Nov 7 17:00:20 2019 (r354448) +++ head/Makefile.libcompat Thu Nov 7 17:10:33 2019 (r354449) @@ -111,28 +111,10 @@ build${libcompat}: .PHONY .endfor ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries -.if ${libcompat} == "32" -.for _t in ${_obj} all -.if !defined(NO_RTLD) - ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ - -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} -.endif - ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ - DIRPRFX=usr.bin/ldd ${_t} -.endfor -.endif distribute${libcompat} install${libcompat}: .PHONY .for _dir in ${_LC_LIBDIRS.yes} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} .endfor -.if ${libcompat} == "32" -.if !defined(NO_RTLD) - ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ - PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} -.endif - ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ - ${.TARGET:S/32$//} -.endif -.endif +.endif # !targets(__<${_this:T}>__) Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Thu Nov 7 17:00:20 2019 (r354448) +++ head/libexec/Makefile Thu Nov 7 17:10:33 2019 (r354449) @@ -74,6 +74,7 @@ _tftp-proxy= tftp-proxy .if !defined(NO_PIC) && !defined(NO_RTLD) _rtld-elf= rtld-elf +SUBDIR.${MK_LIB32}+= rtld-elf32 .endif .if ${MK_RBOOTD} != "no" Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Thu Nov 7 17:00:20 2019 (r354448) +++ head/libexec/rtld-elf/Makefile Thu Nov 7 17:10:33 2019 (r354449) @@ -4,6 +4,8 @@ # linker: # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all +RTLD_ELF_DIR:= ${.PARSEDIR} + .include PACKAGE= clibs MK_PIE= no # Always position independent using local rules @@ -25,16 +27,16 @@ SRCS= \ xmalloc.c \ debug.c \ libmap.c -MAN= rtld.1 +MAN?= rtld.1 CSTD?= gnu99 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding CFLAGS+= -I${SRCTOP}/lib/csu/common -.if exists(${.CURDIR}/${MACHINE_ARCH}) +.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH}) RTLD_ARCH= ${MACHINE_ARCH} .else RTLD_ARCH= ${MACHINE_CPUARCH} .endif -CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} +CFLAGS+= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} .if ${MACHINE_ARCH} == "powerpc64" LDFLAGS+= -nostdlib -e _rtld_start .else @@ -81,16 +83,16 @@ LIBADD+= compiler_rt .if ${MK_SYMVER} == "yes" VERSION_DEF= ${LIBCSRCDIR}/Versions.def -SYMBOL_MAPS= ${.CURDIR}/Symbol.map +SYMBOL_MAPS= ${RTLD_ELF_DIR}/Symbol.map VERSION_MAP= Version.map LDFLAGS+= -Wl,--version-script=${VERSION_MAP} -.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) -SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map +.if exists(${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map) +SYMBOL_MAPS+= ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" +.sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc" # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. @@ -99,10 +101,12 @@ beforeinstall: -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} .endif -.PATH: ${.CURDIR}/${RTLD_ARCH} +.PATH: ${RTLD_ELF_DIR}/${RTLD_ARCH} +.if ${.CURDIR} == ${RTLD_ELF_DIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +.endif .include ${PROG_FULL}: ${VERSION_MAP} Added: head/libexec/rtld-elf32/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/rtld-elf32/Makefile Thu Nov 7 17:10:33 2019 (r354449) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +NEED_COMPAT= 32 +.include + +PROG= ld-elf32.so.1 +MAN= + +.PATH: ${SRCTOP}/libexec/rtld-elf +.include "${SRCTOP}/libexec/rtld-elf/Makefile" Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Thu Nov 7 17:00:20 2019 (r354448) +++ head/share/mk/bsd.compat.mk Thu Nov 7 17:10:33 2019 (r354449) @@ -26,8 +26,9 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" +LIB32_MACHINE= i386 +LIB32_MACHINE_ARCH= i386 +LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2" LIB32WMAKEFLAGS= \ AS="${XAS} --32" \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" @@ -40,7 +41,8 @@ LIB32CPUFLAGS= -mcpu=powerpc LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc +LIB32_MACHINE= powerpc +LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" @@ -61,7 +63,8 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif .endif LIB32CPUFLAGS+= -mabi=32 -LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips +LIB32_MACHINE= mips +LIB32_MACHINE_ARCH= mips .if ${COMPAT_ARCH:Mmips64el*} != "" LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" .else @@ -82,7 +85,9 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${COMPAT_ARCH} +LIBSOFT_MACHINE= arm +LIBSOFT_MACHINE_ARCH= ${COMPAT_ARCH} +LIBSOFTWMAKEENV= CPUTYPE=soft LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif @@ -114,8 +119,8 @@ _LIBCOMPAT:= ${WANT_COMPAT} # Generic code for each type. # Set defaults based on type. libcompat= ${_LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ - WMAKEFLAGS WMAKE +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS \ + _MACHINE _MACHINE_ARCH WMAKEENV WMAKEFLAGS WMAKE .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${_LIBCOMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} @@ -131,6 +136,9 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ --sysroot=${LIBCOMPATTMP} \ ${BFLAGS} +LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE} +LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH} + # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} @@ -139,6 +147,8 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} CFLAGS+= ${LIBCOMPATCFLAGS} +MACHINE= ${LIBCOMPAT_MACHINE} +MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH} .endif .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Nov 7 17:00:20 2019 (r354448) +++ head/share/mk/src.opts.mk Thu Nov 7 17:10:33 2019 (r354449) @@ -126,7 +126,6 @@ __DEFAULT_YES_OPTIONS = \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ - LIB32 \ LIBPTHREAD \ LIBTHR \ LLVM_COV \ @@ -357,6 +356,13 @@ BROKEN_OPTIONS+=LLDB __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC +.endif +# LIB32 is supported on amd64, mips64, and powerpc64 +.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH:Mmips64*} || \ + ${MACHINE_ARCH} == "powerpc64") +__DEFAULT_YES_OPTIONS+=LIB32 +.else +BROKEN_OPTIONS+=LIB32 .endif # Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Nov 7 17:00:20 2019 (r354448) +++ head/usr.bin/Makefile Thu Nov 7 17:10:33 2019 (r354449) @@ -226,6 +226,7 @@ SUBDIR.${MK_KDUMP}+= truss SUBDIR.${MK_KERBEROS_SUPPORT}+= compile_et SUBDIR.${MK_LDNS_UTILS}+= drill SUBDIR.${MK_LDNS_UTILS}+= host +SUBDIR.${MK_LIB32}+= ldd32 SUBDIR.${MK_LOCATE}+= locate # XXX msgs? SUBDIR.${MK_MAIL}+= biff Added: head/usr.bin/ldd32/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ldd32/Makefile Thu Nov 7 17:10:33 2019 (r354449) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +NEED_COMPAT= 32 +.include + +PROG= ldd32 +MAN= + +.PATH: ${SRCTOP}/usr.bin/ldd +.include "${SRCTOP}/usr.bin/ldd/Makefile" From owner-svn-src-all@freebsd.org Thu Nov 7 17:15:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B69F1BA2B3; Thu, 7 Nov 2019 17:15:00 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47894z6zr5z3yQb; Thu, 7 Nov 2019 17:14:59 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3D1119100; Thu, 7 Nov 2019 17:14:59 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7HExFJ029377; Thu, 7 Nov 2019 17:14:59 GMT (envelope-from jrm@FreeBSD.org) Received: (from jrm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7HExbm029375; Thu, 7 Nov 2019 17:14:59 GMT (envelope-from jrm@FreeBSD.org) Message-Id: <201911071714.xA7HExbm029375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrm set sender to jrm@FreeBSD.org using -f From: Joseph Mingrone Date: Thu, 7 Nov 2019 17:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354450 - head/usr.bin/env X-SVN-Group: head X-SVN-Commit-Author: jrm X-SVN-Commit-Paths: head/usr.bin/env X-SVN-Commit-Revision: 354450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 17:15:00 -0000 Author: jrm (ports committer) Date: Thu Nov 7 17:14:59 2019 New Revision: 354450 URL: https://svnweb.freebsd.org/changeset/base/354450 Log: Add -0 option to ENV(1) With the -0 option added to ENV(1), some ports will no longer require genv from sysutils/coreutils. Reviewed by: kevans (prior version), swills Approved by: bcr (manpages), imp Differential Revision: https://reviews.freebsd.org/D22230 Modified: head/usr.bin/env/env.1 head/usr.bin/env/env.c Modified: head/usr.bin/env/env.1 ============================================================================== --- head/usr.bin/env/env.1 Thu Nov 7 17:10:33 2019 (r354449) +++ head/usr.bin/env/env.1 Thu Nov 7 17:14:59 2019 (r354450) @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd April 17, 2008 +.Dd November 7, 2019 .Dt ENV 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd set environment and execute command, or print environment .Sh SYNOPSIS .Nm -.Op Fl iv +.Op Fl 0iv .Op Fl P Ar altpath .Op Fl S Ar string .Op Fl u Ar name @@ -64,6 +64,8 @@ is executed. .Pp The options are as follows: .Bl -tag -width indent +.It Fl 0 +End each output line with NUL, not newline. .It Fl i Execute the .Ar utility @@ -130,8 +132,15 @@ If no .Ar utility is specified, .Nm -prints out the names and values -of the variables in the environment, with one name/value pair per line. +prints out the names and values of the variables in the environment. +Each name/value pair is separated by a new line unless +.Fl 0 +is specified, in which case name/value pairs are separated by NUL. +Both +.Fl 0 +and +.Ar utility +may not be specified together. .\" .Ss Details of Fl S \&Ss (split-string) processing The processing of the Modified: head/usr.bin/env/env.c ============================================================================== --- head/usr.bin/env/env.c Thu Nov 7 17:10:33 2019 (r354449) +++ head/usr.bin/env/env.c Thu Nov 7 17:14:59 2019 (r354450) @@ -59,22 +59,33 @@ int env_verbosity; static void usage(void); +/* + * Exit codes. + */ +#define EXIT_CANCELED 125 /* Internal error prior to exec attempt. */ +#define EXIT_CANNOT_INVOKE 126 /* Program located, but not usable. */ +#define EXIT_ENOENT 127 /* Could not find program to exec. */ + int main(int argc, char **argv) { - char *altpath, **ep, *p, **parg; + char *altpath, **ep, *p, **parg, term; char *cleanenv[1]; int ch, want_clear; int rtrn; altpath = NULL; want_clear = 0; - while ((ch = getopt(argc, argv, "-iP:S:u:v")) != -1) + term = '\n'; + while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1) switch(ch) { case '-': case 'i': want_clear = 1; break; + case '0': + term = '\0'; + break; case 'P': altpath = strdup(optarg); break; @@ -118,6 +129,8 @@ main(int argc, char **argv) err(EXIT_FAILURE, "setenv %s", *argv); } if (*argv) { + if (term == '\0') + errx(EXIT_CANCELED, "cannot specify command with -0"); if (altpath) search_paths(altpath, argv); if (env_verbosity) { @@ -129,10 +142,11 @@ main(int argc, char **argv) sleep(1); } execvp(*argv, argv); - err(errno == ENOENT ? 127 : 126, "%s", *argv); + err(errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE, + "%s", *argv); } for (ep = environ; *ep; ep++) - (void)printf("%s\n", *ep); + (void)printf("%s%c", *ep, term); exit(0); } @@ -140,7 +154,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: env [-iv] [-P utilpath] [-S string] [-u name]\n" + "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n" " [name=value ...] [utility [argument ...]]\n"); exit(1); } From owner-svn-src-all@freebsd.org Thu Nov 7 17:21:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD1201BA5F2; Thu, 7 Nov 2019 17:21:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4789DG3g20z402c; Thu, 7 Nov 2019 17:21:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 622F619192; Thu, 7 Nov 2019 17:21:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7HLIk2035140; Thu, 7 Nov 2019 17:21:18 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7HLIjQ035139; Thu, 7 Nov 2019 17:21:18 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911071721.xA7HLIjQ035139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 7 Nov 2019 17:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354451 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 17:21:18 -0000 Author: andrew Date: Thu Nov 7 17:21:17 2019 New Revision: 354451 URL: https://svnweb.freebsd.org/changeset/base/354451 Log: Add the missing volatile qualifier in atomic_store_ptr MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/sys/atomic_common.h Modified: head/sys/sys/atomic_common.h ============================================================================== --- head/sys/sys/atomic_common.h Thu Nov 7 17:14:59 2019 (r354450) +++ head/sys/sys/atomic_common.h Thu Nov 7 17:21:17 2019 (r354451) @@ -58,7 +58,7 @@ #define atomic_store_long(p, v) \ (*(volatile u_long *)(p) = (u_long)(v)) #define atomic_store_ptr(p, v) \ - (*(uintptr_t *)(p) = (uintptr_t)(v)) + (*(volatile uintptr_t *)(p) = (uintptr_t)(v)) #define atomic_store_8(p, v) \ (*(volatile uint8_t *)(p) = (uint8_t)(v)) #define atomic_store_16(p, v) \ From owner-svn-src-all@freebsd.org Thu Nov 7 17:34:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FC4F1BAC7B; Thu, 7 Nov 2019 17:34:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4789Wn1rwDz416q; Thu, 7 Nov 2019 17:34:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23901194DB; Thu, 7 Nov 2019 17:34:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7HYj41044247; Thu, 7 Nov 2019 17:34:45 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7HYjvM044246; Thu, 7 Nov 2019 17:34:45 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201911071734.xA7HYjvM044246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 7 Nov 2019 17:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354452 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 17:34:45 -0000 Author: andrew Date: Thu Nov 7 17:34:44 2019 New Revision: 354452 URL: https://svnweb.freebsd.org/changeset/base/354452 Log: Add more 8 and 16 bit variants of the the atomic(9) functions on arm64. These are direct copies of the 32 bit functions, adjusted ad needed. While here fix atomic_fcmpset_16 to use the valid load and store exclusive instructions. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Thu Nov 7 17:21:17 2019 (r354451) +++ head/sys/arm64/include/atomic.h Thu Nov 7 17:34:44 2019 (r354452) @@ -57,6 +57,40 @@ #define ATOMIC_OP(op, asm_op, bar, a, l) \ static __inline void \ +atomic_##op##_##bar##8(volatile uint8_t *p, uint8_t val) \ +{ \ + uint8_t tmp; \ + int res; \ + \ + __asm __volatile( \ + "1: ld"#a"xrb %w0, [%2] \n" \ + " "#asm_op" %w0, %w0, %w3 \n" \ + " st"#l"xrb %w1, %w0, [%2] \n" \ + " cbnz %w1, 1b \n" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (val) \ + : "memory" \ + ); \ +} \ + \ +static __inline void \ +atomic_##op##_##bar##16(volatile uint16_t *p, uint16_t val) \ +{ \ + uint16_t tmp; \ + int res; \ + \ + __asm __volatile( \ + "1: ld"#a"xrh %w0, [%2] \n" \ + " "#asm_op" %w0, %w0, %w3 \n" \ + " st"#l"xrh %w1, %w0, [%2] \n" \ + " cbnz %w1, 1b \n" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (val) \ + : "memory" \ + ); \ +} \ + \ +static __inline void \ atomic_##op##_##bar##32(volatile uint32_t *p, uint32_t val) \ { \ uint32_t tmp; \ @@ -135,10 +169,10 @@ atomic_fcmpset_##bar##16(volatile uint16_t *p, uint16_ \ __asm __volatile( \ "1: mov %w1, #1 \n" \ - " ld"#a"xh %w0, [%2] \n" \ + " ld"#a"xrh %w0, [%2] \n" \ " cmp %w0, %w3 \n" \ " b.ne 2f \n" \ - " st"#l"xh %w1, %w4, [%2] \n" \ + " st"#l"xrh %w1, %w4, [%2] \n" \ "2:" \ : "=&r"(tmp), "=&r"(res) \ : "r" (p), "r" (_cmpval), "r" (newval) \ @@ -204,6 +238,52 @@ ATOMIC_FCMPSET(rel_, ,l) #undef ATOMIC_FCMPSET #define ATOMIC_CMPSET(bar, a, l) \ +static __inline int \ +atomic_cmpset_##bar##8(volatile uint8_t *p, uint8_t cmpval, \ + uint8_t newval) \ +{ \ + uint8_t tmp; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xrb %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xrb %w1, %w4, [%2] \n" \ + " cbnz %w1, 1b \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + \ + return (!res); \ +} \ + \ +static __inline int \ +atomic_cmpset_##bar##16(volatile uint16_t *p, uint16_t cmpval, \ + uint16_t newval) \ +{ \ + uint16_t tmp; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xrh %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xrh %w1, %w4, [%2] \n" \ + " cbnz %w1, 1b \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + \ + return (!res); \ +} \ + \ static __inline int \ atomic_cmpset_##bar##32(volatile uint32_t *p, uint32_t cmpval, \ uint32_t newval) \ From owner-svn-src-all@freebsd.org Thu Nov 7 18:05:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C43C1BB600; Thu, 7 Nov 2019 18:05:28 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BCC6Xp5z42yC; Thu, 7 Nov 2019 18:05:27 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C52C119A75; Thu, 7 Nov 2019 18:05:27 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7I5RfR061872; Thu, 7 Nov 2019 18:05:27 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7I5R2t061869; Thu, 7 Nov 2019 18:05:27 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911071805.xA7I5R2t061869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 18:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354453 - in vendor/Juniper/libxo/dist: . libxo tests/core X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in vendor/Juniper/libxo/dist: . libxo tests/core X-SVN-Commit-Revision: 354453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:05:28 -0000 Author: phil Date: Thu Nov 7 18:05:26 2019 New Revision: 354453 URL: https://svnweb.freebsd.org/changeset/base/354453 Log: Import libxo 1.3.1 Modified: vendor/Juniper/libxo/dist/configure.ac vendor/Juniper/libxo/dist/libxo/libxo.c vendor/Juniper/libxo/dist/tests/core/test_01.c Modified: vendor/Juniper/libxo/dist/configure.ac ============================================================================== --- vendor/Juniper/libxo/dist/configure.ac Thu Nov 7 17:34:44 2019 (r354452) +++ vendor/Juniper/libxo/dist/configure.ac Thu Nov 7 18:05:26 2019 (r354453) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [1.3.0], [phil@juniper.net]) +AC_INIT([libxo], [1.3.1], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. Modified: vendor/Juniper/libxo/dist/libxo/libxo.c ============================================================================== --- vendor/Juniper/libxo/dist/libxo/libxo.c Thu Nov 7 17:34:44 2019 (r354452) +++ vendor/Juniper/libxo/dist/libxo/libxo.c Thu Nov 7 18:05:26 2019 (r354453) @@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv) cp = strrchr(xo_program, '/'); if (cp) xo_program = ++cp; + else + cp = argv[0]; /* Reset to front of string */ /* GNU tools add an annoying ".test" as the program extension; remove it */ size_t len = strlen(xo_program); static const char gnu_ext[] = ".test"; if (len >= sizeof(gnu_ext)) { - cp = &cp[len + 1 - sizeof(gnu_ext)]; + cp += len + 1 - sizeof(gnu_ext); if (xo_streq(cp, gnu_ext)) *cp = '\0'; } Modified: vendor/Juniper/libxo/dist/tests/core/test_01.c ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/test_01.c Thu Nov 7 17:34:44 2019 (r354452) +++ vendor/Juniper/libxo/dist/tests/core/test_01.c Thu Nov 7 18:05:26 2019 (r354453) @@ -50,6 +50,9 @@ main (int argc, char **argv) { "sold", "number", "Number of items sold" }, { XO_INFO_NULL }, }; + + char name[] = "test_01.test"; /* test trimming of xo_program */ + argv[0] = name; argc = xo_parse_args(argc, argv); if (argc < 0) From owner-svn-src-all@freebsd.org Thu Nov 7 18:05:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 676261BB62D; Thu, 7 Nov 2019 18:05:39 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BCR2Crlz433v; Thu, 7 Nov 2019 18:05:39 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1737019A76; Thu, 7 Nov 2019 18:05:39 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7I5ckE061922; Thu, 7 Nov 2019 18:05:38 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7I5cHX061921; Thu, 7 Nov 2019 18:05:38 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911071805.xA7I5cHX061921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 18:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354454 - vendor/Juniper/libxo/1.3.1 X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: vendor/Juniper/libxo/1.3.1 X-SVN-Commit-Revision: 354454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:05:39 -0000 Author: phil Date: Thu Nov 7 18:05:38 2019 New Revision: 354454 URL: https://svnweb.freebsd.org/changeset/base/354454 Log: Tag libxo 1.3.1 Added: - copied from r354453, vendor/Juniper/libxo/dist/ Directory Properties: vendor/Juniper/libxo/1.3.1/ (props changed) From owner-svn-src-all@freebsd.org Thu Nov 7 18:06:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 912A41BB70C; Thu, 7 Nov 2019 18:06:46 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BDk3NhCz43JH; Thu, 7 Nov 2019 18:06:46 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58CB419A77; Thu, 7 Nov 2019 18:06:46 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7I6kj8062049; Thu, 7 Nov 2019 18:06:46 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7I6jxE062043; Thu, 7 Nov 2019 18:06:45 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911071806.xA7I6jxE062043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 18:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354455 - in head: contrib/libxo contrib/libxo/libxo contrib/libxo/tests/core lib/libxo lib/libxo/encoder/csv usr.bin/xohtml X-SVN-Group: head X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in head: contrib/libxo contrib/libxo/libxo contrib/libxo/tests/core lib/libxo lib/libxo/encoder/csv usr.bin/xohtml X-SVN-Commit-Revision: 354455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:06:46 -0000 Author: phil Date: Thu Nov 7 18:06:44 2019 New Revision: 354455 URL: https://svnweb.freebsd.org/changeset/base/354455 Log: Import libxo-1.3.1: - handle argv[0] without '/' - add test case for argv[0] without '/' Modified: head/contrib/libxo/configure.ac head/contrib/libxo/libxo/libxo.c head/contrib/libxo/tests/core/test_01.c head/lib/libxo/add.man head/lib/libxo/encoder/csv/Makefile head/lib/libxo/xo_config.h head/usr.bin/xohtml/xohtml.sh Directory Properties: head/contrib/libxo/ (props changed) Modified: head/contrib/libxo/configure.ac ============================================================================== --- head/contrib/libxo/configure.ac Thu Nov 7 18:05:38 2019 (r354454) +++ head/contrib/libxo/configure.ac Thu Nov 7 18:06:44 2019 (r354455) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [1.3.0], [phil@juniper.net]) +AC_INIT([libxo], [1.3.1], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. Modified: head/contrib/libxo/libxo/libxo.c ============================================================================== --- head/contrib/libxo/libxo/libxo.c Thu Nov 7 18:05:38 2019 (r354454) +++ head/contrib/libxo/libxo/libxo.c Thu Nov 7 18:06:44 2019 (r354455) @@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv) cp = strrchr(xo_program, '/'); if (cp) xo_program = ++cp; + else + cp = argv[0]; /* Reset to front of string */ /* GNU tools add an annoying ".test" as the program extension; remove it */ size_t len = strlen(xo_program); static const char gnu_ext[] = ".test"; if (len >= sizeof(gnu_ext)) { - cp = &cp[len + 1 - sizeof(gnu_ext)]; + cp += len + 1 - sizeof(gnu_ext); if (xo_streq(cp, gnu_ext)) *cp = '\0'; } Modified: head/contrib/libxo/tests/core/test_01.c ============================================================================== --- head/contrib/libxo/tests/core/test_01.c Thu Nov 7 18:05:38 2019 (r354454) +++ head/contrib/libxo/tests/core/test_01.c Thu Nov 7 18:06:44 2019 (r354455) @@ -50,6 +50,9 @@ main (int argc, char **argv) { "sold", "number", "Number of items sold" }, { XO_INFO_NULL }, }; + + char name[] = "test_01.test"; /* test trimming of xo_program */ + argv[0] = name; argc = xo_parse_args(argc, argv); if (argc < 0) Modified: head/lib/libxo/add.man ============================================================================== --- head/lib/libxo/add.man Thu Nov 7 18:05:38 2019 (r354454) +++ head/lib/libxo/add.man Thu Nov 7 18:06:44 2019 (r354455) @@ -3,10 +3,10 @@ .Fx uses .Nm libxo -version 1.3.0. +version 1.3.1. Complete documentation can be found on github: .Bd -literal -offset indent -https://juniper.github.io/libxo/1.3.0/html/index.html +https://juniper.github.io/libxo/1.3.1/html/index.html .Ed .Pp .Nm libxo Modified: head/lib/libxo/encoder/csv/Makefile ============================================================================== --- head/lib/libxo/encoder/csv/Makefile Thu Nov 7 18:05:38 2019 (r354454) +++ head/lib/libxo/encoder/csv/Makefile Thu Nov 7 18:06:44 2019 (r354455) @@ -2,7 +2,7 @@ LIBXODIR= ${STAGEDIR}${PREFIX}/usr/lib/libxo/encoder SHLIBDIR?= ${LIBXODIR} -LIBDIR?= ${LIBXODIR} +LIBDIR?= ${LIBXODIR} .include @@ -21,6 +21,7 @@ CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR} CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\" LIBADD= util xo +LDFLAGS += -L${.OBJDIR}/../../wildebeast WARNS?= 5 Modified: head/lib/libxo/xo_config.h ============================================================================== --- head/lib/libxo/xo_config.h Thu Nov 7 18:05:38 2019 (r354454) +++ head/lib/libxo/xo_config.h Thu Nov 7 18:06:44 2019 (r354455) @@ -183,16 +183,16 @@ /* #undef LIBXO_TEXT_ONLY */ /* Version number as dotted value */ -#define LIBXO_VERSION "1.3.0" +#define LIBXO_VERSION "1.3.1" /* Version number extra information */ #define LIBXO_VERSION_EXTRA "" /* Version number as a number */ -#define LIBXO_VERSION_NUMBER 1003000 +#define LIBXO_VERSION_NUMBER 1003001 /* Version number as string */ -#define LIBXO_VERSION_STRING "1003000" +#define LIBXO_VERSION_STRING "1003001" /* Enable local wcwidth implementation */ #define LIBXO_WCWIDTH 1 @@ -210,7 +210,7 @@ #define PACKAGE_NAME "libxo" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libxo 1.3.0" +#define PACKAGE_STRING "libxo 1.3.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libxo" @@ -219,7 +219,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.3.0" +#define PACKAGE_VERSION "1.3.1" /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be @@ -236,7 +236,7 @@ /* #undef USE_INT_RETURN_CODES */ /* Version number of package */ -#define VERSION "1.3.0" +#define VERSION "1.3.1" /* Retain hash bucket size */ /* #undef XO_RETAIN_SIZE */ Modified: head/usr.bin/xohtml/xohtml.sh ============================================================================== --- head/usr.bin/xohtml/xohtml.sh Thu Nov 7 18:05:38 2019 (r354454) +++ head/usr.bin/xohtml/xohtml.sh Thu Nov 7 18:06:44 2019 (r354455) @@ -12,7 +12,7 @@ # BASE=/usr/share/libxo -VERSION=1.3.0 +VERSION=1.3.1 CMD=cat DONE= WEB=http://juniper.github.io/libxo/${VERSION}/xohtml From owner-svn-src-all@freebsd.org Thu Nov 7 18:07:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F5F1BB83F; Thu, 7 Nov 2019 18:07:34 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BFf5ldnz43Xv; Thu, 7 Nov 2019 18:07:34 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1AB019A7E; Thu, 7 Nov 2019 18:07:34 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7I7Yv5063860; Thu, 7 Nov 2019 18:07:34 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7I7Ywq063859; Thu, 7 Nov 2019 18:07:34 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201911071807.xA7I7Ywq063859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Thu, 7 Nov 2019 18:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r354456 - vendor/Juniper/libxo X-SVN-Group: vendor X-SVN-Commit-Author: phil X-SVN-Commit-Paths: vendor/Juniper/libxo X-SVN-Commit-Revision: 354456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:07:35 -0000 Author: phil Date: Thu Nov 7 18:07:34 2019 New Revision: 354456 URL: https://svnweb.freebsd.org/changeset/base/354456 Log: Remove oxtradoc version of documentation; move to RST/Sphinx Modified: vendor/Juniper/libxo/import.sh Modified: vendor/Juniper/libxo/import.sh ============================================================================== --- vendor/Juniper/libxo/import.sh Thu Nov 7 18:06:44 2019 (r354455) +++ vendor/Juniper/libxo/import.sh Thu Nov 7 18:07:34 2019 (r354456) @@ -26,14 +26,19 @@ GMAKE=${GMAKE:-gmake} # For consistency... Error() { - echo ERROR: ${1+"$@"} >&2 - exit 1 + echo ERROR: ${1+"$@"} >&2 + exit 1 } Cd() { - [ $# -eq 1 ] || Error "Cd() takes a single parameter." - cd $1 || Error "cannot \"cd $1\" from $PWD" - info "Directory =" `pwd` + [ $# -eq 1 ] || Error "Cd() takes a single parameter." + cd $1 || Error "cannot \"cd $1\" from $PWD" + info "Directory =" `pwd` + + if [ "$DOC" = doc ]; then + echo " cd $1" + echo " " + fi } siginfo() { @@ -51,8 +56,8 @@ run() { CMD="$2" if [ "$DOC" = doc ]; then - echo " == $desc" - echo " - $cmd" + echo "## $desc" + echo " $cmd" echo " " else echo "====" @@ -66,7 +71,7 @@ run() { } info() { - echo " -- " "$@" + echo "## -- " "$@" } okay() { @@ -182,13 +187,7 @@ fi # We need the release tar ball for the HTML docs, nothing more DOCURL=https://github.com/Juniper/libxo/releases/download/$VERS/libxo-$VERS.tar.gz -DOCBALL=~/tars/doc-$BASEURL -if [ "$FETCH" = "yes" -o ! -f $DOCBALL ]; then - run "fetching doc tarball" "fetch -o $DOCBALL $DOCURL" - test -s ${DOCBALL} || Error need DOCBALL -fi - # BASE should match what the TARBALL contains BASE=`basename $TARBALL .tar.gz` VERSION=`echo $BASE | sed 's/libxo-//'` @@ -196,8 +195,6 @@ VERSION=`echo $BASE | sed 's/libxo-//'` TF=$BASE/info run "untarring source files TARBALL" "tar zxf $TARBALL" -run "untarring html manual" \ - "tar zxf $DOCBALL libxo-$VERS/doc/libxo-manual.html" # List of top-level files we want to ignore TOPJUNKFILES="\ From owner-svn-src-all@freebsd.org Thu Nov 7 18:14:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 004D51BBE7B; Thu, 7 Nov 2019 18:14:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BQB6CJbz44YW; Thu, 7 Nov 2019 18:14:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B987819C8A; Thu, 7 Nov 2019 18:14:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7IEwZT069970; Thu, 7 Nov 2019 18:14:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7IEwF4069969; Thu, 7 Nov 2019 18:14:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071814.xA7IEwF4069969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 18:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354457 - stable/12/lib/libpmc/pmu-events X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/lib/libpmc/pmu-events X-SVN-Commit-Revision: 354457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:14:59 -0000 Author: emaste Date: Thu Nov 7 18:14:58 2019 New Revision: 354457 URL: https://svnweb.freebsd.org/changeset/base/354457 Log: MFC r354342: libpmc: jevents: handle empty description PR: 241258 Reported by: sigsys @ gmail.com Obtained from: github.com/andikleen/pmu-tools commit bb3c77ed61 Modified: stable/12/lib/libpmc/pmu-events/jevents.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libpmc/pmu-events/jevents.c ============================================================================== --- stable/12/lib/libpmc/pmu-events/jevents.c Thu Nov 7 18:07:34 2019 (r354456) +++ stable/12/lib/libpmc/pmu-events/jevents.c Thu Nov 7 18:14:58 2019 (r354457) @@ -122,7 +122,7 @@ static void fixdesc(char *s) --e; while (e >= s && isspace(*e)) --e; - if (*e == '.') + if (e >= s && *e == '.') *e = 0; } From owner-svn-src-all@freebsd.org Thu Nov 7 18:15:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E94A1BBEED; Thu, 7 Nov 2019 18:15:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BQj1ZjPz44gp; Thu, 7 Nov 2019 18:15:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19D5019C8C; Thu, 7 Nov 2019 18:15:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7IFO3Y070067; Thu, 7 Nov 2019 18:15:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7IFOhI070066; Thu, 7 Nov 2019 18:15:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911071815.xA7IFOhI070066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 7 Nov 2019 18:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354458 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 354458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:15:25 -0000 Author: trasz Date: Thu Nov 7 18:15:24 2019 New Revision: 354458 URL: https://svnweb.freebsd.org/changeset/base/354458 Log: Extend the linux rc script to mount the neccessary file systems, set ELF fallback brand, and load pty(4). Reviewed by: emaste (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21874 Modified: head/libexec/rc/rc.d/linux Modified: head/libexec/rc/rc.d/linux ============================================================================== --- head/libexec/rc/rc.d/linux Thu Nov 7 18:14:58 2019 (r354457) +++ head/libexec/rc/rc.d/linux Thu Nov 7 18:15:24 2019 (r354458) @@ -17,7 +17,7 @@ stop_cmd=":" linux_start() { - local _tmpdir + local _emul_path _tmpdir load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -33,6 +33,25 @@ linux_start() fi rm -rf ${_tmpdir} fi + + # Linux uses the pre-pts(4) tty naming scheme. + load_kld pty + + # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. + if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then + sysctl kern.elf64.fallback_brand=3 > /dev/null + fi + + if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then + sysctl kern.elf32.fallback_brand=3 > /dev/null + fi + + _emul_path="/compat/linux" + mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" + mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" + mount -o nocover -t devfs devfs "${_emul_path}/dev" + mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" } load_rc_config $name From owner-svn-src-all@freebsd.org Thu Nov 7 18:16:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7941C1BC0B9; Thu, 7 Nov 2019 18:16:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BSH2bWMz4514; Thu, 7 Nov 2019 18:16:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DB6119C9C; Thu, 7 Nov 2019 18:16:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7IGldU070186; Thu, 7 Nov 2019 18:16:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7IGlun070185; Thu, 7 Nov 2019 18:16:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911071816.xA7IGlun070185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 7 Nov 2019 18:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354459 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:16:47 -0000 Author: trasz Date: Thu Nov 7 18:16:46 2019 New Revision: 354459 URL: https://svnweb.freebsd.org/changeset/base/354459 Log: The cdceem(4) driver debuted in 12.1. MFC after: 2 weeks Modified: head/share/man/man4/cdceem.4 Modified: head/share/man/man4/cdceem.4 ============================================================================== --- head/share/man/man4/cdceem.4 Thu Nov 7 18:15:24 2019 (r354458) +++ head/share/man/man4/cdceem.4 Thu Nov 7 18:16:46 2019 (r354459) @@ -22,7 +22,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd August 7, 2019 +.Dd November 7, 2019 .Dt CDCEEM 4 .Os .Sh NAME @@ -110,7 +110,7 @@ Defaults to 0. The .Nm device driver first appeared in -.Fx 13.0 . +.Fx 12.1 . .Sh AUTHORS The .Nm From owner-svn-src-all@freebsd.org Thu Nov 7 18:26:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 271841BC608; Thu, 7 Nov 2019 18:26:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Bfy0KRJz45s2; Thu, 7 Nov 2019 18:26:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E341319EE6; Thu, 7 Nov 2019 18:26:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7IQ11V076707; Thu, 7 Nov 2019 18:26:01 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7IQ1JY076704; Thu, 7 Nov 2019 18:26:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911071826.xA7IQ1JY076704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 7 Nov 2019 18:26:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354460 - in head: contrib/libc++/include sys/sys X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/libc++/include sys/sys X-SVN-Commit-Revision: 354460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:26:02 -0000 Author: dim Date: Thu Nov 7 18:26:01 2019 New Revision: 354460 URL: https://svnweb.freebsd.org/changeset/base/354460 Log: Merge commit e8316372b from llvm git (by Louis Dionne): [libc++] Add `__truncating_cast` for safely casting float types to integers This is needed anytime we need to clamp an arbitrary floating point value to an integer type. Thanks to Eric Fiselier for the patch. Differential Revision: https://reviews.llvm.org/D66836 llvm-svn: 370891 Merge commit b92deded8 from llvm git (by Louis Dionne): [libc++] Move __clamp_to_integral to , and harden against min()/max() macros llvm-svn: 370900 Merge commit 0ec6a4882 from llvm git (by Louis Dionne): [libc++] Fix potential OOB in poisson_distribution See details in the original Chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=994957 Together, these fix a security issue in libc++'s implementation of std::poisson_distribution, which can be exploited to read data which is out of bounds. Note there are no programs in the FreeBSD base system that use std::poisson_distribution, so this is only a possible issue for ports and external programs which have been built against libc++. Therefore, I am bumping __FreeBSD_version for the benefit of our port maintainers. Requested by: emaste Security: potential OOB read MFC after: 3 days Modified: head/contrib/libc++/include/cmath head/contrib/libc++/include/random head/sys/sys/param.h Modified: head/contrib/libc++/include/cmath ============================================================================== --- head/contrib/libc++/include/cmath Thu Nov 7 18:16:46 2019 (r354459) +++ head/contrib/libc++/include/cmath Thu Nov 7 18:26:01 2019 (r354460) @@ -303,11 +303,15 @@ long double truncl(long double x); #include <__config> #include #include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD using ::signbit; @@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t #endif // _LIBCPP_STD_VER > 17 +template ::digits > numeric_limits<_IntT>::digits), + int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> +_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT { + static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); + static_assert(is_integral<_IntT>::value, "must be an integral type"); + static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); + static_assert(_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value + || _IsSame<_FloatT,long double>::value, "unsupported floating point type"); + return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); +} + +// Convert a floating point number to the specified integral type after +// clamping to the integral types representable range. +// +// The behavior is undefined if `__r` is NaN. +template +_LIBCPP_INLINE_VISIBILITY +_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { + using _Lim = std::numeric_limits<_IntT>; + const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + return _Lim::max(); + } else if (__r <= _Lim::lowest()) { + return _Lim::min(); + } + return static_cast<_IntT>(__r); +} + _LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS #endif // _LIBCPP_CMATH Modified: head/contrib/libc++/include/random ============================================================================== --- head/contrib/libc++/include/random Thu Nov 7 18:16:46 2019 (r354459) +++ head/contrib/libc++/include/random Thu Nov 7 18:26:01 2019 (r354460) @@ -4592,7 +4592,10 @@ class _LIBCPP_TEMPLATE_VIS poisson_distribution (publi template poisson_distribution<_IntType>::param_type::param_type(double __mean) - : __mean_(__mean) + // According to the standard `inf` is a valid input, but it causes the + // distribution to hang, so we replace it with the maximum representable + // mean. + : __mean_(isinf(__mean) ? numeric_limits::max() : __mean) { if (__mean_ < 10) { @@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type { __s_ = _VSTD::sqrt(__mean_); __d_ = 6 * __mean_ * __mean_; - __l_ = static_cast(__mean_ - 1.1484); + __l_ = std::trunc(__mean_ - 1.1484); __omega_ = .3989423 / __s_; double __b1_ = .4166667E-1 / __mean_; double __b2_ = .3 * __b1_ * __b1_; @@ -4627,12 +4630,12 @@ template _IntType poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr) { - result_type __x; + double __tx; uniform_real_distribution __urd; if (__pr.__mean_ < 10) { - __x = 0; - for (double __p = __urd(__urng); __p > __pr.__l_; ++__x) + __tx = 0; + for (double __p = __urd(__urng); __p > __pr.__l_; ++__tx) __p *= __urd(__urng); } else @@ -4642,19 +4645,19 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur double __u; if (__g > 0) { - __x = static_cast(__g); - if (__x >= __pr.__l_) - return __x; - __difmuk = __pr.__mean_ - __x; + __tx = std::trunc(__g); + if (__tx >= __pr.__l_) + return std::__clamp_to_integral(__tx); + __difmuk = __pr.__mean_ - __tx; __u = __urd(__urng); if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk) - return __x; + return std::__clamp_to_integral(__tx); } exponential_distribution __edist; for (bool __using_exp_dist = false; true; __using_exp_dist = true) { double __e; - if (__using_exp_dist || __g < 0) + if (__using_exp_dist || __g <= 0) { double __t; do @@ -4664,31 +4667,31 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur __u += __u - 1; __t = 1.8 + (__u < 0 ? -__e : __e); } while (__t <= -.6744); - __x = __pr.__mean_ + __pr.__s_ * __t; - __difmuk = __pr.__mean_ - __x; + __tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t); + __difmuk = __pr.__mean_ - __tx; __using_exp_dist = true; } double __px; double __py; - if (__x < 10) + if (__tx < 10 && __tx >= 0) { const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; __px = -__pr.__mean_; - __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x]; + __py = _VSTD::pow(__pr.__mean_, (double)__tx) / __fac[static_cast(__tx)]; } else { - double __del = .8333333E-1 / __x; + double __del = .8333333E-1 / __tx; __del -= 4.8 * __del * __del * __del; - double __v = __difmuk / __x; + double __v = __difmuk / __tx; if (_VSTD::abs(__v) > 0.25) - __px = __x * _VSTD::log(1 + __v) - __difmuk - __del; + __px = __tx * _VSTD::log(1 + __v) - __difmuk - __del; else - __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) * + __px = __tx * __v * __v * (((((((.1250060 * __v + -.1384794) * __v + .1421878) * __v + -.1661269) * __v + .2000118) * __v + -.2500068) * __v + .3333333) * __v + -.5) - __del; - __py = .3989423 / _VSTD::sqrt(__x); + __py = .3989423 / _VSTD::sqrt(__tx); } double __r = (0.5 - __difmuk) / __pr.__s_; double __r2 = __r * __r; @@ -4708,7 +4711,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __ur } } } - return __x; + return std::__clamp_to_integral(__tx); } template Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 7 18:16:46 2019 (r354459) +++ head/sys/sys/param.h Thu Nov 7 18:26:01 2019 (r354460) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300055 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300056 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Thu Nov 7 18:26:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E2691BC698; Thu, 7 Nov 2019 18:26:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BgT728dz460c; Thu, 7 Nov 2019 18:26:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D553819EE7; Thu, 7 Nov 2019 18:26:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7IQTVx076773; Thu, 7 Nov 2019 18:26:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7IQTvT076772; Thu, 7 Nov 2019 18:26:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911071826.xA7IQTvT076772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 18:26:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354461 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:26:30 -0000 Author: markj Date: Thu Nov 7 18:26:29 2019 New Revision: 354461 URL: https://svnweb.freebsd.org/changeset/base/354461 Log: Drop Giant before sleeping on a busy page. Before the page busy code was converted to make direct use of sleepqueues, this was handled by _sleep(). Reported by: glebius Reviewed by: kib Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Nov 7 18:26:01 2019 (r354460) +++ head/sys/vm/vm_page.c Thu Nov 7 18:26:29 2019 (r354461) @@ -1053,8 +1053,10 @@ _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, cons } if (locked) VM_OBJECT_DROP(obj); + DROP_GIANT(); sleepq_add(m, NULL, wmesg, 0, 0); sleepq_wait(m, PVM); + PICKUP_GIANT(); } /* From owner-svn-src-all@freebsd.org Thu Nov 7 18:29:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 229991BC778; Thu, 7 Nov 2019 18:29:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BlQ0v7Xz46V6; Thu, 7 Nov 2019 18:29:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0310719EEE; Thu, 7 Nov 2019 18:29:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7ITrLG077103; Thu, 7 Nov 2019 18:29:53 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7ITq8W077093; Thu, 7 Nov 2019 18:29:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911071829.xA7ITq8W077093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 7 Nov 2019 18:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354462 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:29:54 -0000 Author: bz Date: Thu Nov 7 18:29:51 2019 New Revision: 354462 URL: https://svnweb.freebsd.org/changeset/base/354462 Log: netinet*: variable cleanup In preparation for another change factor out various variable cleanups. These mainly include: (1) do not assign values to variables during declaration: this makes the code more readable and does allow for better grouping of variable declarations, (2) do not assign values to variables before need; e.g., if a variable is only used in the 2nd half of a function and we have multiple return paths before that, then do not set it before it is needed, and (3) try to avoid assigning the same value multiple times. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet/tcp_input.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/dest6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/route6.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet/tcp_input.c Thu Nov 7 18:29:51 2019 (r354462) @@ -512,10 +512,11 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, int tcp6_input(struct mbuf **mp, int *offp, int proto) { - struct mbuf *m = *mp; + struct mbuf *m; struct in6_ifaddr *ia6; struct ip6_hdr *ip6; + m = *mp; IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE); /* @@ -525,10 +526,8 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) ip6 = mtod(m, struct ip6_hdr *); ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) { - struct ip6_hdr *ip6; ifa_free(&ia6->ia_ifa); - ip6 = mtod(m, struct ip6_hdr *); icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return (IPPROTO_DONE); Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet/udp_usrreq.c Thu Nov 7 18:29:51 2019 (r354462) @@ -421,14 +421,13 @@ udp_input(struct mbuf **mp, int *offp, int proto) /* * Get IP and UDP header together in first mbuf. */ - ip = mtod(m, struct ip *); if (m->m_len < iphlen + sizeof(struct udphdr)) { if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == NULL) { UDPSTAT_INC(udps_hdrops); return (IPPROTO_DONE); } - ip = mtod(m, struct ip *); } + ip = mtod(m, struct ip *); uh = (struct udphdr *)((caddr_t)ip + iphlen); cscov_partial = (proto == IPPROTO_UDPLITE) ? 1 : 0; Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/dest6.c Thu Nov 7 18:29:51 2019 (r354462) @@ -64,10 +64,13 @@ __FBSDID("$FreeBSD$"); int dest6_input(struct mbuf **mp, int *offp, int proto) { - struct mbuf *m = *mp; - int off = *offp, dstoptlen, optlen; + struct mbuf *m; + int off, dstoptlen, optlen; struct ip6_dest *dstopts; u_int8_t *opt; + + m = *mp; + off = *offp; /* validation of the length of the header */ #ifndef PULLDOWN_TEST Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/icmp6.c Thu Nov 7 18:29:51 2019 (r354462) @@ -401,17 +401,15 @@ icmp6_error(struct mbuf *m, int type, int code, int pa int icmp6_input(struct mbuf **mp, int *offp, int proto) { - struct mbuf *m = *mp, *n; + struct mbuf *m, *n; struct ifnet *ifp; struct ip6_hdr *ip6, *nip6; struct icmp6_hdr *icmp6, *nicmp6; - int off = *offp; - int icmp6len = m->m_pkthdr.len - *offp; - int code, sum, noff; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; - int ip6len, error; + int code, error, icmp6len, ip6len, noff, off, sum; - ifp = m->m_pkthdr.rcvif; + m = *mp; + off = *offp; #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE); @@ -423,13 +421,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) * that not corrupted and of at least minimum length */ - ip6 = mtod(m, struct ip6_hdr *); - ip6len = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen); + icmp6len = m->m_pkthdr.len - off; if (icmp6len < sizeof(struct icmp6_hdr)) { ICMP6STAT_INC(icp6s_tooshort); goto freeit; } + ip6 = mtod(m, struct ip6_hdr *); + ifp = m->m_pkthdr.rcvif; /* * Check multicast group membership. * Note: SSM filters are not applied for ICMPv6 traffic. @@ -445,9 +444,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } } - /* - * calculate the checksum - */ + /* Calculate the checksum. */ #ifndef PULLDOWN_TEST icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); #else @@ -473,6 +470,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (icmp6->icmp6_type < ICMP6_INFOMSG_MASK) icmp6_ifstat_inc(ifp, ifs6_in_error); + ip6len = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen); switch (icmp6->icmp6_type) { case ICMP6_DST_UNREACH: icmp6_ifstat_inc(ifp, ifs6_in_dstunreach); @@ -881,12 +879,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) static int icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) { - struct mbuf *m = *mp; + struct mbuf *m; struct icmp6_hdr *icmp6; struct ip6_hdr *eip6; u_int32_t notifymtu; struct sockaddr_in6 icmp6src, icmp6dst; + m = *mp; + if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) { ICMP6STAT_INC(icp6s_tooshort); goto freeit; @@ -2220,24 +2220,19 @@ void icmp6_redirect_input(struct mbuf *m, int off) { struct ifnet *ifp; - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ip6_hdr *ip6; struct nd_redirect *nd_rd; - int icmp6len = ntohs(ip6->ip6_plen); - char *lladdr = NULL; - int lladdrlen = 0; - int is_router; - int is_onlink; - struct in6_addr src6 = ip6->ip6_src; + struct in6_addr src6; struct in6_addr redtgt6; struct in6_addr reddst6; union nd_opts ndopts; char ip6buf[INET6_ADDRSTRLEN]; + char *lladdr; + int icmp6len, is_onlink, is_router, lladdrlen; M_ASSERTPKTHDR(m); KASSERT(m->m_pkthdr.rcvif != NULL, ("%s: no rcvif", __func__)); - ifp = m->m_pkthdr.rcvif; - /* XXX if we are router, we don't update route by icmp6 redirect */ if (V_ip6_forwarding) goto freeit; @@ -2248,6 +2243,8 @@ icmp6_redirect_input(struct mbuf *m, int off) if(m->m_flags & M_FRAGMENTED) goto freeit; + ip6 = mtod(m, struct ip6_hdr *); + icmp6len = ntohs(ip6->ip6_plen); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, icmp6len,); nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); @@ -2258,15 +2255,18 @@ icmp6_redirect_input(struct mbuf *m, int off) return; } #endif + + ifp = m->m_pkthdr.rcvif; redtgt6 = nd_rd->nd_rd_target; reddst6 = nd_rd->nd_rd_dst; - if (in6_setscope(&redtgt6, m->m_pkthdr.rcvif, NULL) || - in6_setscope(&reddst6, m->m_pkthdr.rcvif, NULL)) { + if (in6_setscope(&redtgt6, ifp, NULL) || + in6_setscope(&reddst6, ifp, NULL)) { goto freeit; } /* validation */ + src6 = ip6->ip6_src; if (!IN6_IS_ADDR_LINKLOCAL(&src6)) { nd6log((LOG_ERR, "ICMP6 redirect sent from %s rejected; " @@ -2352,6 +2352,8 @@ icmp6_redirect_input(struct mbuf *m, int off) goto freeit; } + lladdr = NULL; + lladdrlen = 0; if (ndopts.nd_opts_tgt_lladdr) { lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/ip6_input.c Thu Nov 7 18:29:51 2019 (r354462) @@ -1409,13 +1409,14 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, void ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp) { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ip6_hdr *ip6; int v4only = 0; mp = ip6_savecontrol_v4(inp, m, mp, &v4only); if (v4only) return; + ip6 = mtod(m, struct ip6_hdr *); /* * IPV6_HOPOPTS socket option. Recall that we required super-user * privilege for the option (see ip6_ctloutput), but it might be too Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/ip6_mroute.c Thu Nov 7 18:29:51 2019 (r354462) @@ -1720,12 +1720,10 @@ pim6_input(struct mbuf *m, int off, int proto, void *a PIM6STAT_INC(pim6s_rcv_total); - ip6 = mtod(m, struct ip6_hdr *); - pimlen = m->m_pkthdr.len - off; - /* * Validate lengths */ + pimlen = m->m_pkthdr.len - off; if (pimlen < PIM_MINLEN) { PIM6STAT_INC(pim6s_rcv_tooshort); MRT6_DLOG(DEBUG_PIM, "PIM packet too short"); Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/mld6.c Thu Nov 7 18:29:51 2019 (r354462) @@ -1260,8 +1260,6 @@ mld_input(struct mbuf *m, int off, int icmp6len) ifp = m->m_pkthdr.rcvif; - ip6 = mtod(m, struct ip6_hdr *); - /* Pullup to appropriate size. */ mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); if (mld->mld_type == MLD_LISTENER_QUERY && @@ -1275,6 +1273,7 @@ mld_input(struct mbuf *m, int off, int icmp6len) ICMP6STAT_INC(icp6s_badlen); return (IPPROTO_DONE); } + ip6 = mtod(m, struct ip6_hdr *); /* * Userland needs to see all of this traffic for implementing Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/nd6_nbr.c Thu Nov 7 18:29:51 2019 (r354462) @@ -121,30 +121,33 @@ VNET_DEFINE_STATIC(int, dad_maxtry) = 15; /* max # of void nd6_ns_input(struct mbuf *m, int off, int icmp6len) { - struct ifnet *ifp = m->m_pkthdr.rcvif; - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ifnet *ifp; + struct ip6_hdr *ip6; struct nd_neighbor_solicit *nd_ns; - struct in6_addr saddr6 = ip6->ip6_src; - struct in6_addr daddr6 = ip6->ip6_dst; - struct in6_addr taddr6; - struct in6_addr myaddr6; - char *lladdr = NULL; - struct ifaddr *ifa = NULL; - int lladdrlen = 0; - int anycast = 0, proxy = 0, tentative = 0; - int tlladdr; - int rflag; - union nd_opts ndopts; + struct in6_addr daddr6, myaddr6, saddr6, taddr6; + struct ifaddr *ifa; struct sockaddr_dl proxydl; + union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + char *lladdr; + int anycast, lladdrlen, proxy, rflag, tentative, tlladdr; + ifa = NULL; + /* RFC 6980: Nodes MUST silently ignore fragments */ if(m->m_flags & M_FRAGMENTED) goto freeit; - rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0; - if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif) - rflag = 0; + ifp = m->m_pkthdr.rcvif; + ip6 = mtod(m, struct ip6_hdr *); + if (ip6->ip6_hlim != 255) { + nd6log((LOG_ERR, + "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n", + ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), + ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp))); + goto bads; + } + #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, icmp6len,); nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); @@ -156,17 +159,16 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) } #endif ip6 = mtod(m, struct ip6_hdr *); /* adjust pointer for safety */ + + saddr6 = ip6->ip6_src; + daddr6 = ip6->ip6_dst; taddr6 = nd_ns->nd_ns_target; if (in6_setscope(&taddr6, ifp, NULL) != 0) goto bad; - if (ip6->ip6_hlim != 255) { - nd6log((LOG_ERR, - "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n", - ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp))); - goto bad; - } + rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0; + if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif) + rflag = 0; if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { /* dst has to be a solicited node multicast address. */ @@ -215,6 +217,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + lladdr = NULL; + lladdrlen = 0; if (ndopts.nd_opts_src_lladdr) { lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; @@ -254,6 +258,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); /* (2) check. */ + proxy = 0; if (ifa == NULL) { struct sockaddr_dl rt_gateway; struct rt_addrinfo info; @@ -380,6 +385,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) ip6_sprintf(ip6bufs, &daddr6))); nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(ip6bufs, &taddr6))); + bads: ICMP6STAT_INC(icp6s_badns); if (ifa != NULL) ifa_free(ifa); @@ -614,34 +620,34 @@ nd6_ns_output(struct ifnet *ifp, const struct in6_addr void nd6_na_input(struct mbuf *m, int off, int icmp6len) { - struct ifnet *ifp = m->m_pkthdr.rcvif; - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); - struct nd_neighbor_advert *nd_na; - struct in6_addr daddr6 = ip6->ip6_dst; - struct in6_addr taddr6; - int flags; - int is_router; - int is_solicited; - int is_override; - char *lladdr = NULL; - int lladdrlen = 0; - int checklink = 0; + struct ifnet *ifp; + struct ip6_hdr *ip6; struct ifaddr *ifa; - struct llentry *ln = NULL; - union nd_opts ndopts; - struct mbuf *chain = NULL; + struct llentry *ln; + struct mbuf *chain; + struct nd_neighbor_advert *nd_na; + struct in6_addr daddr6, taddr6; struct sockaddr_in6 sin6; + union nd_opts ndopts; u_char linkhdr[LLE_MAX_LINKHDR]; - size_t linkhdrsize; - int lladdr_off; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + char *lladdr; + size_t linkhdrsize; + int flags, is_override, is_router, is_solicited; + int lladdr_off, lladdrlen, checklink; NET_EPOCH_ASSERT(); + chain = NULL; + ln = NULL; + checklink = 0; + /* RFC 6980: Nodes MUST silently ignore fragments */ if(m->m_flags & M_FRAGMENTED) goto freeit; + ifp = m->m_pkthdr.rcvif; + ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, "nd6_na_input: invalid hlim (%d) from %s to %s on %s\n", @@ -665,7 +671,6 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) is_router = ((flags & ND_NA_FLAG_ROUTER) != 0); is_solicited = ((flags & ND_NA_FLAG_SOLICITED) != 0); is_override = ((flags & ND_NA_FLAG_OVERRIDE) != 0); - memset(&sin6, 0, sizeof(sin6)); taddr6 = nd_na->nd_na_target; if (in6_setscope(&taddr6, ifp, NULL)) @@ -677,6 +682,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) ip6_sprintf(ip6bufs, &taddr6))); goto bad; } + + daddr6 = ip6->ip6_dst; if (IN6_IS_ADDR_MULTICAST(&daddr6)) if (is_solicited) { nd6log((LOG_ERR, @@ -693,6 +700,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + lladdr = NULL; + lladdrlen = 0; if (ndopts.nd_opts_tgt_lladdr) { lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; @@ -888,8 +897,10 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) * rt->rt_flags &= ~RTF_REJECT; */ ln->la_asked = 0; - if (ln->la_hold != NULL) + if (ln->la_hold != NULL) { + memset(&sin6, 0, sizeof(sin6)); nd6_grab_holdchain(ln, &chain, &sin6); + } freeit: if (ln != NULL) LLE_WUNLOCK(ln); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/nd6_rtr.c Thu Nov 7 18:29:51 2019 (r354462) @@ -127,15 +127,17 @@ VNET_DEFINE(int, nd6_ignore_ipv6_only_ra) = 1; void nd6_rs_input(struct mbuf *m, int off, int icmp6len) { - struct ifnet *ifp = m->m_pkthdr.rcvif; - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ifnet *ifp; + struct ip6_hdr *ip6; struct nd_router_solicit *nd_rs; - struct in6_addr saddr6 = ip6->ip6_src; - char *lladdr = NULL; - int lladdrlen = 0; + struct in6_addr saddr6; union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + char *lladdr; + int lladdrlen; + ifp = m->m_pkthdr.rcvif; + /* * Accept RS only when V_ip6_forwarding=1 and the interface has * no ND6_IFF_ACCEPT_RTADV. @@ -148,6 +150,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) goto freeit; /* Sanity checks */ + ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n", @@ -160,6 +163,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) * Don't update the neighbor cache, if src = ::. * This indicates that the src has no IP address assigned yet. */ + saddr6 = ip6->ip6_src; if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) goto freeit; @@ -183,6 +187,8 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + lladdr = NULL; + lladdrlen = 0; if (ndopts.nd_opts_src_lladdr) { lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; @@ -322,22 +328,22 @@ nd6_ifnet_link_event(void *arg __unused, struct ifnet void nd6_ra_input(struct mbuf *m, int off, int icmp6len) { - struct ifnet *ifp = m->m_pkthdr.rcvif; - struct nd_ifinfo *ndi = ND_IFINFO(ifp); - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ifnet *ifp; + struct nd_ifinfo *ndi; + struct ip6_hdr *ip6; struct nd_router_advert *nd_ra; - struct in6_addr saddr6 = ip6->ip6_src; - int mcast = 0; - union nd_opts ndopts; + struct in6_addr saddr6; struct nd_defrouter *dr; + union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + int mcast; - dr = NULL; - /* * We only accept RAs only when the per-interface flag * ND6_IFF_ACCEPT_RTADV is on the receiving interface. */ + ifp = m->m_pkthdr.rcvif; + ndi = ND_IFINFO(ifp); if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV)) goto freeit; @@ -345,6 +351,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) if(m->m_flags & M_FRAGMENTED) goto freeit; + ip6 = mtod(m, struct ip6_hdr *); if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n", @@ -353,6 +360,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) goto bad; } + saddr6 = ip6->ip6_src; if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) { nd6log((LOG_ERR, "nd6_ra_input: src %s is not link-local\n", @@ -380,6 +388,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) goto freeit; } + mcast = 0; + dr = NULL; { struct nd_defrouter dr0; u_int32_t advreachable = nd_ra->nd_ra_reachable; Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Thu Nov 7 18:26:29 2019 (r354461) +++ head/sys/netinet6/route6.c Thu Nov 7 18:29:51 2019 (r354462) @@ -62,12 +62,16 @@ int route6_input(struct mbuf **mp, int *offp, int proto) { struct ip6_hdr *ip6; - struct mbuf *m = *mp; + struct mbuf *m; struct ip6_rthdr *rh; int off = *offp, rhlen; #ifdef __notyet__ struct ip6aux *ip6a; +#endif + m = *mp; + +#ifdef __notyet__ ip6a = ip6_findaux(m); if (ip6a) { /* XXX reject home-address option before rthdr */ From owner-svn-src-all@freebsd.org Thu Nov 7 19:06:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3C061BD839; Thu, 7 Nov 2019 19:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478CYR46s5z497t; Thu, 7 Nov 2019 19:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D0DA1A635; Thu, 7 Nov 2019 19:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7J6Jkb011036; Thu, 7 Nov 2019 19:06:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7J6JNF011035; Thu, 7 Nov 2019 19:06:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911071906.xA7J6JNF011035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 19:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354463 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 354463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:06:19 -0000 Author: glebius Date: Thu Nov 7 19:06:18 2019 New Revision: 354463 URL: https://svnweb.freebsd.org/changeset/base/354463 Log: sysctl_rtsock() has all necessary locking and doesn't need Giant to run. While here add description. Modified: head/sys/net/rtsock.c Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Thu Nov 7 18:29:51 2019 (r354462) +++ head/sys/net/rtsock.c Thu Nov 7 19:06:18 2019 (r354463) @@ -1970,7 +1970,8 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) return (error); } -static SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD, sysctl_rtsock, ""); +static SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD | CTLFLAG_MPSAFE, + sysctl_rtsock, "Return route tables and interface/address lists"); /* * Definitions of protocols supported in the ROUTE domain. From owner-svn-src-all@freebsd.org Thu Nov 7 19:13:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1E1C1BDC32; Thu, 7 Nov 2019 19:13:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Ck95GM8z49yh; Thu, 7 Nov 2019 19:13:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9796A1A812; Thu, 7 Nov 2019 19:13:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JDrDu016555; Thu, 7 Nov 2019 19:13:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JDrNZ016554; Thu, 7 Nov 2019 19:13:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911071913.xA7JDrNZ016554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 7 Nov 2019 19:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354464 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:13:53 -0000 Author: kevans Date: Thu Nov 7 19:13:53 2019 New Revision: 354464 URL: https://svnweb.freebsd.org/changeset/base/354464 Log: sys/conf/files.arm64: remove some unnecessary soc_* dependencies These files already have 'device' lines that they require; adding a dependency on SOC_* options is an extra restriction that adds extra verbosity when future supported Broadcom-based SOC will also feature the same compatible device. Users wishing to not compile these devices in should remove the 'device' lines from their config. Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Nov 7 19:06:18 2019 (r354463) +++ head/sys/conf/files.arm64 Thu Nov 7 19:13:53 2019 (r354464) @@ -88,18 +88,18 @@ arm/arm/pmu.c standard arm/arm/physmem.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq fdt \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" -arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc fdt arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 fdt arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_intr.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_mbox.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_rng.c optional !random_loadable soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt From owner-svn-src-all@freebsd.org Thu Nov 7 19:22:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82FA11BDE6C; Thu, 7 Nov 2019 19:22:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478CwY30c9z4BQd; Thu, 7 Nov 2019 19:22:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 306791A9D1; Thu, 7 Nov 2019 19:22:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JMrFl022579; Thu, 7 Nov 2019 19:22:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JMpdH022571; Thu, 7 Nov 2019 19:22:51 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911071922.xA7JMpdH022571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 19:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354465 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Commit-Revision: 354465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:22:53 -0000 Author: brooks Date: Thu Nov 7 19:22:51 2019 New Revision: 354465 URL: https://svnweb.freebsd.org/changeset/base/354465 Log: Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything" Additional testing is required.. Deleted: head/libexec/rtld-elf32/ head/usr.bin/ldd32/ Modified: head/Makefile.inc1 head/Makefile.libcompat head/lib/msun/src/k_sincosl.h head/libexec/Makefile head/libexec/rtld-elf/Makefile head/share/mk/bsd.compat.mk head/share/mk/src.opts.mk head/usr.bin/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 7 19:13:53 2019 (r354464) +++ head/Makefile.inc1 Thu Nov 7 19:22:51 2019 (r354465) @@ -802,10 +802,11 @@ XCFLAGS+= --sysroot=${WORLDTMP} XCFLAGS+= ${BFLAGS} .endif -.if ${MK_LIB32} == "yes" +.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ + ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "") _LIBCOMPAT= 32 .include "Makefile.libcompat" -.elif ${MK_LIBSOFT} == "yes" +.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != "" _LIBCOMPAT= SOFT .include "Makefile.libcompat" .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu Nov 7 19:13:53 2019 (r354464) +++ head/Makefile.libcompat Thu Nov 7 19:22:51 2019 (r354465) @@ -111,10 +111,28 @@ build${libcompat}: .PHONY .endfor ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries +.if ${libcompat} == "32" +.for _t in ${_obj} all +.if !defined(NO_RTLD) + ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ + -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} +.endif + ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ + DIRPRFX=usr.bin/ldd ${_t} +.endfor +.endif distribute${libcompat} install${libcompat}: .PHONY .for _dir in ${_LC_LIBDIRS.yes} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} .endfor +.if ${libcompat} == "32" +.if !defined(NO_RTLD) + ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ + PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} +.endif + ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ + ${.TARGET:S/32$//} +.endif -.endif # !targets(__<${_this:T}>__) +.endif Modified: head/lib/msun/src/k_sincosl.h ============================================================================== --- head/lib/msun/src/k_sincosl.h Thu Nov 7 19:13:53 2019 (r354464) +++ head/lib/msun/src/k_sincosl.h Thu Nov 7 19:22:51 2019 (r354465) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Thu Nov 7 19:13:53 2019 (r354464) +++ head/libexec/Makefile Thu Nov 7 19:22:51 2019 (r354465) @@ -74,7 +74,6 @@ _tftp-proxy= tftp-proxy .if !defined(NO_PIC) && !defined(NO_RTLD) _rtld-elf= rtld-elf -SUBDIR.${MK_LIB32}+= rtld-elf32 .endif .if ${MK_RBOOTD} != "no" Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Thu Nov 7 19:13:53 2019 (r354464) +++ head/libexec/rtld-elf/Makefile Thu Nov 7 19:22:51 2019 (r354465) @@ -4,8 +4,6 @@ # linker: # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all -RTLD_ELF_DIR:= ${.PARSEDIR} - .include PACKAGE= clibs MK_PIE= no # Always position independent using local rules @@ -27,16 +25,16 @@ SRCS= \ xmalloc.c \ debug.c \ libmap.c -MAN?= rtld.1 +MAN= rtld.1 CSTD?= gnu99 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding CFLAGS+= -I${SRCTOP}/lib/csu/common -.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH}) +.if exists(${.CURDIR}/${MACHINE_ARCH}) RTLD_ARCH= ${MACHINE_ARCH} .else RTLD_ARCH= ${MACHINE_CPUARCH} .endif -CFLAGS+= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} +CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} .if ${MACHINE_ARCH} == "powerpc64" LDFLAGS+= -nostdlib -e _rtld_start .else @@ -83,16 +81,16 @@ LIBADD+= compiler_rt .if ${MK_SYMVER} == "yes" VERSION_DEF= ${LIBCSRCDIR}/Versions.def -SYMBOL_MAPS= ${RTLD_ELF_DIR}/Symbol.map +SYMBOL_MAPS= ${.CURDIR}/Symbol.map VERSION_MAP= Version.map LDFLAGS+= -Wl,--version-script=${VERSION_MAP} -.if exists(${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map) -SYMBOL_MAPS+= ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map +.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) +SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc" +.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. @@ -101,12 +99,10 @@ beforeinstall: -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} .endif -.PATH: ${RTLD_ELF_DIR}/${RTLD_ARCH} +.PATH: ${.CURDIR}/${RTLD_ARCH} -.if ${.CURDIR} == ${RTLD_ELF_DIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests -.endif .include ${PROG_FULL}: ${VERSION_MAP} Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Thu Nov 7 19:13:53 2019 (r354464) +++ head/share/mk/bsd.compat.mk Thu Nov 7 19:22:51 2019 (r354465) @@ -26,9 +26,8 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -m32 -LIB32_MACHINE= i386 -LIB32_MACHINE_ARCH= i386 -LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2" +LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ + MACHINE_CPU="i686 mmx sse sse2" LIB32WMAKEFLAGS= \ AS="${XAS} --32" \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" @@ -41,8 +40,7 @@ LIB32CPUFLAGS= -mcpu=powerpc LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif LIB32CPUFLAGS+= -m32 -LIB32_MACHINE= powerpc -LIB32_MACHINE_ARCH= powerpc +LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" @@ -63,8 +61,7 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif .endif LIB32CPUFLAGS+= -mabi=32 -LIB32_MACHINE= mips -LIB32_MACHINE_ARCH= mips +LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips .if ${COMPAT_ARCH:Mmips64el*} != "" LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" .else @@ -85,9 +82,7 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFT_MACHINE= arm -LIBSOFT_MACHINE_ARCH= ${COMPAT_ARCH} -LIBSOFTWMAKEENV= CPUTYPE=soft +LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${COMPAT_ARCH} LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif @@ -119,8 +114,8 @@ _LIBCOMPAT:= ${WANT_COMPAT} # Generic code for each type. # Set defaults based on type. libcompat= ${_LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS \ - _MACHINE _MACHINE_ARCH WMAKEENV WMAKEFLAGS WMAKE +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ + WMAKEFLAGS WMAKE .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${_LIBCOMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} @@ -136,9 +131,6 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ --sysroot=${LIBCOMPATTMP} \ ${BFLAGS} -LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE} -LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH} - # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} @@ -147,8 +139,6 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} CFLAGS+= ${LIBCOMPATCFLAGS} -MACHINE= ${LIBCOMPAT_MACHINE} -MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH} .endif .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Nov 7 19:13:53 2019 (r354464) +++ head/share/mk/src.opts.mk Thu Nov 7 19:22:51 2019 (r354465) @@ -126,6 +126,7 @@ __DEFAULT_YES_OPTIONS = \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ + LIB32 \ LIBPTHREAD \ LIBTHR \ LLVM_COV \ @@ -356,13 +357,6 @@ BROKEN_OPTIONS+=LLDB __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC -.endif -# LIB32 is supported on amd64, mips64, and powerpc64 -.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH:Mmips64*} || \ - ${MACHINE_ARCH} == "powerpc64") -__DEFAULT_YES_OPTIONS+=LIB32 -.else -BROKEN_OPTIONS+=LIB32 .endif # Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Nov 7 19:13:53 2019 (r354464) +++ head/usr.bin/Makefile Thu Nov 7 19:22:51 2019 (r354465) @@ -226,7 +226,6 @@ SUBDIR.${MK_KDUMP}+= truss SUBDIR.${MK_KERBEROS_SUPPORT}+= compile_et SUBDIR.${MK_LDNS_UTILS}+= drill SUBDIR.${MK_LDNS_UTILS}+= host -SUBDIR.${MK_LIB32}+= ldd32 SUBDIR.${MK_LOCATE}+= locate # XXX msgs? SUBDIR.${MK_MAIL}+= biff From owner-svn-src-all@freebsd.org Thu Nov 7 19:28:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA44C1BE09C; Thu, 7 Nov 2019 19:28:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478D2X46sgz4Bm7; Thu, 7 Nov 2019 19:28:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E3A61A9DD; Thu, 7 Nov 2019 19:28:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JS46d022858; Thu, 7 Nov 2019 19:28:04 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JS4mI022857; Thu, 7 Nov 2019 19:28:04 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911071928.xA7JS4mI022857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 19:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354466 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 354466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:28:04 -0000 Author: brooks Date: Thu Nov 7 19:28:03 2019 New Revision: 354466 URL: https://svnweb.freebsd.org/changeset/base/354466 Log: Revert change accidentally included in r354465. Will recommit with a proper commit message shortly. Modified: head/lib/msun/src/k_sincosl.h Modified: head/lib/msun/src/k_sincosl.h ============================================================================== --- head/lib/msun/src/k_sincosl.h Thu Nov 7 19:22:51 2019 (r354465) +++ head/lib/msun/src/k_sincosl.h Thu Nov 7 19:28:03 2019 (r354466) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-all@freebsd.org Thu Nov 7 19:31:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E9151BE367; Thu, 7 Nov 2019 19:31:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478D711SYTz4C4D; Thu, 7 Nov 2019 19:31:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16DEC1AB70; Thu, 7 Nov 2019 19:31:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JVuEk025472; Thu, 7 Nov 2019 19:31:56 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JVuPi025460; Thu, 7 Nov 2019 19:31:56 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911071931.xA7JVuPi025460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 19:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354467 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 354467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:31:57 -0000 Author: brooks Date: Thu Nov 7 19:31:56 2019 New Revision: 354467 URL: https://svnweb.freebsd.org/changeset/base/354467 Log: Fix declaration of S1 by swapping misplaced ',' and ';'. Reported by: kargl Obtained from: OpenBSD (tb@openbsd.org) MFC after: 1 week Modified: head/lib/msun/src/k_sincosl.h Modified: head/lib/msun/src/k_sincosl.h ============================================================================== --- head/lib/msun/src/k_sincosl.h Thu Nov 7 19:28:03 2019 (r354466) +++ head/lib/msun/src/k_sincosl.h Thu Nov 7 19:31:56 2019 (r354467) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-all@freebsd.org Thu Nov 7 19:37:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E4E41BE74F; Thu, 7 Nov 2019 19:37:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478DFM0Q7cz4Cpy; Thu, 7 Nov 2019 19:37:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E73D01ABBA; Thu, 7 Nov 2019 19:37:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JbQXc028702; Thu, 7 Nov 2019 19:37:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JbQkT028701; Thu, 7 Nov 2019 19:37:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911071937.xA7JbQkT028701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 7 Nov 2019 19:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354468 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 354468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:37:27 -0000 Author: emaste Date: Thu Nov 7 19:37:26 2019 New Revision: 354468 URL: https://svnweb.freebsd.org/changeset/base/354468 Log: arch.7: claim 12.x as the last architecture with sparc64 support GCC 4.2.1 is being removed before FreeBSD 13, as are some other components required by FreeBSD/sparc64. Contemporary GCC does not build and there is currently no indication that anyone is going to address these issues. PR: 228919, 233405, 236839, 239851 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Nov 7 19:31:56 2019 (r354467) +++ head/share/man/man7/arch.7 Thu Nov 7 19:37:26 2019 (r354468) @@ -114,7 +114,7 @@ architectures, the final release. .It powerpc64 Ta 6.0 .It riscv64 Ta 12.0 .It riscv64sf Ta 12.0 -.It sparc64 Ta 5.0 +.It sparc64 Ta 5.0 Ta 12.x .El .Ss Type sizes All From owner-svn-src-all@freebsd.org Thu Nov 7 19:54:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 789981BF101; Thu, 7 Nov 2019 19:54:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Dck3Nktz4FHF; Thu, 7 Nov 2019 19:54:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57C9E1AF78; Thu, 7 Nov 2019 19:54:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JsEPp040353; Thu, 7 Nov 2019 19:54:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Js9vs040329; Thu, 7 Nov 2019 19:54:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911071954.xA7Js9vs040329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 7 Nov 2019 19:54:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354469 - in head/contrib/llvm: include/llvm/DebugInfo/DWARF include/llvm/MC lib/DebugInfo/DWARF lib/MC lib/Object lib/Target/RISCV lib/Target/RISCV/AsmParser lib/Target/RISCV/MCTargetD... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm: include/llvm/DebugInfo/DWARF include/llvm/MC lib/DebugInfo/DWARF lib/MC lib/Object lib/Target/RISCV lib/Target/RISCV/AsmParser lib/Target/RISCV/MCTargetDesc tools/clang/lib/Basic... X-SVN-Commit-Revision: 354469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:54:14 -0000 Author: dim Date: Thu Nov 7 19:54:08 2019 New Revision: 354469 URL: https://svnweb.freebsd.org/changeset/base/354469 Log: Merge commit f596f4507 from llvm git (by Sam Elliott): [RISCV] Add Custom Parser for Atomic Memory Operands Summary: GCC Accepts both (reg) and 0(reg) for atomic instruction memory operands. These instructions do not allow for an offset in their encoding, so in the latter case, the 0 is silently dropped. Due to how we have structured the RISCVAsmParser, the easiest way to add support for parsing this offset is to add a custom AsmOperand and parser. This parser drops all the parens, and just keeps the register. This commit also adds a custom printer for these operands, which matches the GCC canonical printer, printing both `(a0)` and `0(a0)` as `(a0)`. Reviewers: asb, lewis-revill Reviewed By: asb Subscribers: s.egerton, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65205 llvm-svn: 367553 Merge commit f596f4507 from llvm git (by Sam Elliott): [RISCV] Add FreeBSD targets Reviewers: asb Reviewed By: asb Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne, emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57795 Patch by James Clarke (jrtc27) llvm-svn: 367557 Merge commit f596f4507 from llvm git (by Hsiangkai Wang): [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame. It is necessary to generate fixups in .debug_frame or .eh_frame as relaxation is enabled due to the address delta may be changed after relaxation. There is an opcode with 6-bits data in debug frame encoding. So, we also need 6-bits fixup types. Differential Revision: https://reviews.llvm.org/D58335 llvm-svn: 366524 Merge commit f596f4507 from llvm git (by Hsiangkai Wang): [DebugInfo] Some fields do not need relocations even relax is enabled. In debug frame information, some fields, e.g., Length in CIE/FDE and Offset in FDE are attributes to describe the structure of CIE/FDE. They are not related to the relaxed code. However, these attributes are symbol differences. So, in current design, these attributes will be filled as zero and LLVM generates relocations for them. We only need to generate relocations for symbols in executable sections. So, if the symbols are not located in executable sections, we still evaluate their values under relaxation. Differential Revision: https://reviews.llvm.org/D61584 llvm-svn: 366531 Merge commit f596f4507 from llvm git (by Alex Bradbury): [RISCV] Don't force absolute FK_Data_X fixups to relocs The current behavior of shouldForceRelocation forces relocations for the majority of fixups when relaxation is enabled. This makes sense for fixups which incorporate symbols but is unnecessary for simple data fixups where the fixup target is already resolved to an absolute value. Differential Revision: https://reviews.llvm.org/D63404 Patch by Edward Jones. llvm-svn: 369257 Merge commit f596f4507 from llvm git (by Alex Bradbury): [RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE location Follow binutils in using RISCV_32_PCREL for the FDE initial location. As explained in the relevant binutils commit , the ADD/SUB pair of relocations is problematic in the presence of linker relaxation. This patch has the same end goal as D64715 but includes test changes and avoids adding a new global VariantKind to MCExpr.h (preferring RISCVMCExpr VKs like the rest of the RISC-V backend). Differential Revision: https://reviews.llvm.org/D66419 llvm-svn: 369375 This series of merges will permit riscv64 kernels and riscv64sf worlds to build with clang instead of gcc (but still using the bfd linker). Requested by: jhb Obtained from: https://github.com/freebsd/freebsd/compare/master...bsdjhb:riscv_clang MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFObject.h head/contrib/llvm/include/llvm/MC/MCDwarf.h head/contrib/llvm/include/llvm/MC/MCFixup.h head/contrib/llvm/include/llvm/MC/MCFragment.h head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp head/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp head/contrib/llvm/lib/MC/MCAsmBackend.cpp head/contrib/llvm/lib/MC/MCAssembler.cpp head/contrib/llvm/lib/MC/MCDwarf.cpp head/contrib/llvm/lib/MC/MCExpr.cpp head/contrib/llvm/lib/Object/RelocationResolver.cpp head/contrib/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h head/contrib/llvm/lib/Target/RISCV/RISCVInstrInfoA.td head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp Modified: head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h ============================================================================== --- head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h Thu Nov 7 19:54:08 2019 (r354469) @@ -69,7 +69,7 @@ class CFIProgram { (public) /// starting at *Offset and ending at EndOffset. *Offset is updated /// to EndOffset upon successful parsing, or indicates the offset /// where a problem occurred in case an error is returned. - Error parse(DataExtractor Data, uint32_t *Offset, uint32_t EndOffset); + Error parse(DWARFDataExtractor Data, uint32_t *Offset, uint32_t EndOffset); void dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH, unsigned IndentLevel = 1) const; Modified: head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFObject.h ============================================================================== --- head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFObject.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFObject.h Thu Nov 7 19:54:08 2019 (r354469) @@ -40,8 +40,8 @@ class DWARFObject { (public) virtual const DWARFSection &getLocSection() const { return Dummy; } virtual const DWARFSection &getLoclistsSection() const { return Dummy; } virtual StringRef getARangeSection() const { return ""; } - virtual StringRef getDebugFrameSection() const { return ""; } - virtual StringRef getEHFrameSection() const { return ""; } + virtual const DWARFSection &getDebugFrameSection() const { return Dummy; } + virtual const DWARFSection &getEHFrameSection() const { return Dummy; } virtual const DWARFSection &getLineSection() const { return Dummy; } virtual StringRef getLineStringSection() const { return ""; } virtual StringRef getStringSection() const { return ""; } Modified: head/contrib/llvm/include/llvm/MC/MCDwarf.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCDwarf.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/include/llvm/MC/MCDwarf.h Thu Nov 7 19:54:08 2019 (r354469) @@ -629,7 +629,8 @@ class MCDwarfFrameEmitter { (public) static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH); static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta); static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, - raw_ostream &OS); + raw_ostream &OS, uint32_t *Offset = nullptr, + uint32_t *Size = nullptr); }; } // end namespace llvm Modified: head/contrib/llvm/include/llvm/MC/MCFixup.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCFixup.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/include/llvm/MC/MCFixup.h Thu Nov 7 19:54:08 2019 (r354469) @@ -20,35 +20,38 @@ class MCExpr; /// Extensible enumeration to represent the type of a fixup. enum MCFixupKind { - FK_NONE = 0, ///< A no-op fixup. - FK_Data_1, ///< A one-byte fixup. - FK_Data_2, ///< A two-byte fixup. - FK_Data_4, ///< A four-byte fixup. - FK_Data_8, ///< A eight-byte fixup. - FK_PCRel_1, ///< A one-byte pc relative fixup. - FK_PCRel_2, ///< A two-byte pc relative fixup. - FK_PCRel_4, ///< A four-byte pc relative fixup. - FK_PCRel_8, ///< A eight-byte pc relative fixup. - FK_GPRel_1, ///< A one-byte gp relative fixup. - FK_GPRel_2, ///< A two-byte gp relative fixup. - FK_GPRel_4, ///< A four-byte gp relative fixup. - FK_GPRel_8, ///< A eight-byte gp relative fixup. - FK_DTPRel_4, ///< A four-byte dtp relative fixup. - FK_DTPRel_8, ///< A eight-byte dtp relative fixup. - FK_TPRel_4, ///< A four-byte tp relative fixup. - FK_TPRel_8, ///< A eight-byte tp relative fixup. - FK_SecRel_1, ///< A one-byte section relative fixup. - FK_SecRel_2, ///< A two-byte section relative fixup. - FK_SecRel_4, ///< A four-byte section relative fixup. - FK_SecRel_8, ///< A eight-byte section relative fixup. - FK_Data_Add_1, ///< A one-byte add fixup. - FK_Data_Add_2, ///< A two-byte add fixup. - FK_Data_Add_4, ///< A four-byte add fixup. - FK_Data_Add_8, ///< A eight-byte add fixup. - FK_Data_Sub_1, ///< A one-byte sub fixup. - FK_Data_Sub_2, ///< A two-byte sub fixup. - FK_Data_Sub_4, ///< A four-byte sub fixup. - FK_Data_Sub_8, ///< A eight-byte sub fixup. + FK_NONE = 0, ///< A no-op fixup. + FK_Data_1, ///< A one-byte fixup. + FK_Data_2, ///< A two-byte fixup. + FK_Data_4, ///< A four-byte fixup. + FK_Data_8, ///< A eight-byte fixup. + FK_Data_6b, ///< A six-bits fixup. + FK_PCRel_1, ///< A one-byte pc relative fixup. + FK_PCRel_2, ///< A two-byte pc relative fixup. + FK_PCRel_4, ///< A four-byte pc relative fixup. + FK_PCRel_8, ///< A eight-byte pc relative fixup. + FK_GPRel_1, ///< A one-byte gp relative fixup. + FK_GPRel_2, ///< A two-byte gp relative fixup. + FK_GPRel_4, ///< A four-byte gp relative fixup. + FK_GPRel_8, ///< A eight-byte gp relative fixup. + FK_DTPRel_4, ///< A four-byte dtp relative fixup. + FK_DTPRel_8, ///< A eight-byte dtp relative fixup. + FK_TPRel_4, ///< A four-byte tp relative fixup. + FK_TPRel_8, ///< A eight-byte tp relative fixup. + FK_SecRel_1, ///< A one-byte section relative fixup. + FK_SecRel_2, ///< A two-byte section relative fixup. + FK_SecRel_4, ///< A four-byte section relative fixup. + FK_SecRel_8, ///< A eight-byte section relative fixup. + FK_Data_Add_1, ///< A one-byte add fixup. + FK_Data_Add_2, ///< A two-byte add fixup. + FK_Data_Add_4, ///< A four-byte add fixup. + FK_Data_Add_8, ///< A eight-byte add fixup. + FK_Data_Add_6b, ///< A six-bits add fixup. + FK_Data_Sub_1, ///< A one-byte sub fixup. + FK_Data_Sub_2, ///< A two-byte sub fixup. + FK_Data_Sub_4, ///< A four-byte sub fixup. + FK_Data_Sub_8, ///< A eight-byte sub fixup. + FK_Data_Sub_6b, ///< A six-bits sub fixup. FirstTargetFixupKind = 128, @@ -129,16 +132,40 @@ class MCFixup { (public) /// Return the generic fixup kind for a value with the given size. It /// is an error to pass an unsupported size. - static MCFixupKind getKindForSize(unsigned Size, bool isPCRel) { + static MCFixupKind getKindForSize(unsigned Size, bool IsPCRel) { switch (Size) { default: llvm_unreachable("Invalid generic fixup size!"); - case 1: return isPCRel ? FK_PCRel_1 : FK_Data_1; - case 2: return isPCRel ? FK_PCRel_2 : FK_Data_2; - case 4: return isPCRel ? FK_PCRel_4 : FK_Data_4; - case 8: return isPCRel ? FK_PCRel_8 : FK_Data_8; + case 1: + return IsPCRel ? FK_PCRel_1 : FK_Data_1; + case 2: + return IsPCRel ? FK_PCRel_2 : FK_Data_2; + case 4: + return IsPCRel ? FK_PCRel_4 : FK_Data_4; + case 8: + return IsPCRel ? FK_PCRel_8 : FK_Data_8; } } + /// Return the generic fixup kind for a value with the given size in bits. + /// It is an error to pass an unsupported size. + static MCFixupKind getKindForSizeInBits(unsigned Size, bool IsPCRel) { + switch (Size) { + default: + llvm_unreachable("Invalid generic fixup size!"); + case 6: + assert(!IsPCRel && "Invalid pc-relative fixup size!"); + return FK_Data_6b; + case 8: + return IsPCRel ? FK_PCRel_1 : FK_Data_1; + case 16: + return IsPCRel ? FK_PCRel_2 : FK_Data_2; + case 32: + return IsPCRel ? FK_PCRel_4 : FK_Data_4; + case 64: + return IsPCRel ? FK_PCRel_8 : FK_Data_8; + } + } + /// Return the generic fixup kind for an addition with a given size. It /// is an error to pass an unsupported size. static MCFixupKind getAddKindForKind(unsigned Kind) { @@ -148,6 +175,7 @@ class MCFixup { (public) case FK_Data_2: return FK_Data_Add_2; case FK_Data_4: return FK_Data_Add_4; case FK_Data_8: return FK_Data_Add_8; + case FK_Data_6b: return FK_Data_Add_6b; } } @@ -160,6 +188,7 @@ class MCFixup { (public) case FK_Data_2: return FK_Data_Sub_2; case FK_Data_4: return FK_Data_Sub_4; case FK_Data_8: return FK_Data_Sub_8; + case FK_Data_6b: return FK_Data_Sub_6b; } } Modified: head/contrib/llvm/include/llvm/MC/MCFragment.h ============================================================================== --- head/contrib/llvm/include/llvm/MC/MCFragment.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/include/llvm/MC/MCFragment.h Thu Nov 7 19:54:08 2019 (r354469) @@ -149,6 +149,7 @@ class MCEncodedFragment : public MCFragment { (public) case MCFragment::FT_CompactEncodedInst: case MCFragment::FT_Data: case MCFragment::FT_Dwarf: + case MCFragment::FT_DwarfFrame: return true; } } @@ -232,7 +233,8 @@ class MCEncodedFragmentWithFixups : (public) static bool classof(const MCFragment *F) { MCFragment::FragmentType Kind = F->getKind(); return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data || - Kind == MCFragment::FT_CVDefRange || Kind == MCFragment::FT_Dwarf;; + Kind == MCFragment::FT_CVDefRange || Kind == MCFragment::FT_Dwarf || + Kind == MCFragment::FT_DwarfFrame; } }; @@ -543,26 +545,20 @@ class MCDwarfLineAddrFragment : public MCEncodedFragme } }; -class MCDwarfCallFrameFragment : public MCFragment { +class MCDwarfCallFrameFragment : public MCEncodedFragmentWithFixups<8, 1> { /// AddrDelta - The expression for the difference of the two symbols that /// make up the address delta between two .cfi_* dwarf directives. const MCExpr *AddrDelta; - SmallString<8> Contents; - public: MCDwarfCallFrameFragment(const MCExpr &AddrDelta, MCSection *Sec = nullptr) - : MCFragment(FT_DwarfFrame, false, Sec), AddrDelta(&AddrDelta) { - Contents.push_back(0); - } + : MCEncodedFragmentWithFixups<8, 1>(FT_DwarfFrame, false, Sec), + AddrDelta(&AddrDelta) {} /// \name Accessors /// @{ const MCExpr &getAddrDelta() const { return *AddrDelta; } - - SmallString<8> &getContents() { return Contents; } - const SmallString<8> &getContents() const { return Contents; } /// @} Modified: head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp ============================================================================== --- head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -402,11 +402,11 @@ void DWARFContext::dump( } if (const auto *Off = shouldDump(Explicit, ".debug_frame", DIDT_ID_DebugFrame, - DObj->getDebugFrameSection())) + DObj->getDebugFrameSection().Data)) getDebugFrame()->dump(OS, getRegisterInfo(), *Off); if (const auto *Off = shouldDump(Explicit, ".eh_frame", DIDT_ID_DebugFrame, - DObj->getEHFrameSection())) + DObj->getEHFrameSection().Data)) getEHFrame()->dump(OS, getRegisterInfo(), *Off); if (DumpType & DIDT_DebugMacro) { @@ -766,7 +766,7 @@ const DWARFDebugFrame *DWARFContext::getDebugFrame() { // provides this information). This problem is fixed in DWARFv4 // See this dwarf-discuss discussion for more details: // http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html - DWARFDataExtractor debugFrameData(DObj->getDebugFrameSection(), + DWARFDataExtractor debugFrameData(*DObj, DObj->getDebugFrameSection(), isLittleEndian(), DObj->getAddressSize()); DebugFrame.reset(new DWARFDebugFrame(getArch(), false /* IsEH */)); DebugFrame->parse(debugFrameData); @@ -777,8 +777,8 @@ const DWARFDebugFrame *DWARFContext::getEHFrame() { if (EHFrame) return EHFrame.get(); - DWARFDataExtractor debugFrameData(DObj->getEHFrameSection(), isLittleEndian(), - DObj->getAddressSize()); + DWARFDataExtractor debugFrameData(*DObj, DObj->getEHFrameSection(), + isLittleEndian(), DObj->getAddressSize()); DebugFrame.reset(new DWARFDebugFrame(getArch(), true /* IsEH */)); DebugFrame->parse(debugFrameData); return DebugFrame.get(); @@ -1385,6 +1385,8 @@ class DWARFObjInMemory final : public DWARFObject { DWARFSectionMap RnglistsSection; DWARFSectionMap StringOffsetSection; DWARFSectionMap LineDWOSection; + DWARFSectionMap DebugFrameSection; + DWARFSectionMap EHFrameSection; DWARFSectionMap LocDWOSection; DWARFSectionMap StringOffsetDWOSection; DWARFSectionMap RangeDWOSection; @@ -1405,6 +1407,8 @@ class DWARFObjInMemory final : public DWARFObject { .Case("debug_loc", &LocSection) .Case("debug_loclists", &LocListsSection) .Case("debug_line", &LineSection) + .Case("debug_frame", &DebugFrameSection) + .Case("eh_frame", &EHFrameSection) .Case("debug_str_offsets", &StringOffsetSection) .Case("debug_ranges", &RangeSection) .Case("debug_rnglists", &RnglistsSection) @@ -1428,8 +1432,6 @@ class DWARFObjInMemory final : public DWARFObject { StringRef AbbrevSection; StringRef ARangeSection; - StringRef DebugFrameSection; - StringRef EHFrameSection; StringRef StringSection; StringRef MacinfoSection; StringRef AbbrevDWOSection; @@ -1449,8 +1451,6 @@ class DWARFObjInMemory final : public DWARFObject { return StringSwitch(Name) .Case("debug_abbrev", &AbbrevSection) .Case("debug_aranges", &ARangeSection) - .Case("debug_frame", &DebugFrameSection) - .Case("eh_frame", &EHFrameSection) .Case("debug_str", &StringSection) .Case("debug_macinfo", &MacinfoSection) .Case("debug_abbrev.dwo", &AbbrevDWOSection) @@ -1747,8 +1747,12 @@ class DWARFObjInMemory final : public DWARFObject { const DWARFSection &getLocSection() const override { return LocSection; } const DWARFSection &getLoclistsSection() const override { return LocListsSection; } StringRef getARangeSection() const override { return ARangeSection; } - StringRef getDebugFrameSection() const override { return DebugFrameSection; } - StringRef getEHFrameSection() const override { return EHFrameSection; } + const DWARFSection &getDebugFrameSection() const override { + return DebugFrameSection; + } + const DWARFSection &getEHFrameSection() const override { + return EHFrameSection; + } const DWARFSection &getLineSection() const override { return LineSection; } StringRef getStringSection() const override { return StringSection; } const DWARFSection &getRangeSection() const override { return RangeSection; } Modified: head/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp ============================================================================== --- head/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -34,10 +34,10 @@ using namespace dwarf; const uint8_t DWARF_CFI_PRIMARY_OPCODE_MASK = 0xc0; const uint8_t DWARF_CFI_PRIMARY_OPERAND_MASK = 0x3f; -Error CFIProgram::parse(DataExtractor Data, uint32_t *Offset, +Error CFIProgram::parse(DWARFDataExtractor Data, uint32_t *Offset, uint32_t EndOffset) { while (*Offset < EndOffset) { - uint8_t Opcode = Data.getU8(Offset); + uint8_t Opcode = Data.getRelocatedValue(1, Offset); // Some instructions have a primary opcode encoded in the top bits. uint8_t Primary = Opcode & DWARF_CFI_PRIMARY_OPCODE_MASK; @@ -74,19 +74,19 @@ Error CFIProgram::parse(DataExtractor Data, uint32_t * break; case DW_CFA_set_loc: // Operands: Address - addInstruction(Opcode, Data.getAddress(Offset)); + addInstruction(Opcode, Data.getRelocatedAddress(Offset)); break; case DW_CFA_advance_loc1: // Operands: 1-byte delta - addInstruction(Opcode, Data.getU8(Offset)); + addInstruction(Opcode, Data.getRelocatedValue(1, Offset)); break; case DW_CFA_advance_loc2: // Operands: 2-byte delta - addInstruction(Opcode, Data.getU16(Offset)); + addInstruction(Opcode, Data.getRelocatedValue(2, Offset)); break; case DW_CFA_advance_loc4: // Operands: 4-byte delta - addInstruction(Opcode, Data.getU32(Offset)); + addInstruction(Opcode, Data.getRelocatedValue(4, Offset)); break; case DW_CFA_restore_extended: case DW_CFA_undefined: @@ -361,7 +361,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) { uint32_t StartOffset = Offset; bool IsDWARF64 = false; - uint64_t Length = Data.getU32(&Offset); + uint64_t Length = Data.getRelocatedValue(4, &Offset); uint64_t Id; if (Length == UINT32_MAX) { @@ -369,7 +369,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) { // field being 0xffffffff. Then, the next 64 bits are the actual entry // length. IsDWARF64 = true; - Length = Data.getU64(&Offset); + Length = Data.getRelocatedValue(8, &Offset); } // At this point, Offset points to the next field after Length. @@ -512,8 +512,8 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) { ReportError(StartOffset, "Parsing augmentation data at %lx failed"); } } else { - InitialLocation = Data.getAddress(&Offset); - AddressRange = Data.getAddress(&Offset); + InitialLocation = Data.getRelocatedAddress(&Offset); + AddressRange = Data.getRelocatedAddress(&Offset); } Entries.emplace_back(new FDE(StartOffset, Length, CIEPointer, Modified: head/contrib/llvm/lib/MC/MCAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAsmBackend.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/MC/MCAsmBackend.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -73,6 +73,7 @@ const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo( {"FK_Data_2", 0, 16, 0}, {"FK_Data_4", 0, 32, 0}, {"FK_Data_8", 0, 64, 0}, + {"FK_Data_6b", 0, 6, 0}, {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel}, {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel}, {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel}, @@ -93,10 +94,12 @@ const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo( {"FK_Data_Add_2", 0, 16, 0}, {"FK_Data_Add_4", 0, 32, 0}, {"FK_Data_Add_8", 0, 64, 0}, + {"FK_Data_Add_6b", 0, 6, 0}, {"FK_Data_Sub_1", 0, 8, 0}, {"FK_Data_Sub_2", 0, 16, 0}, {"FK_Data_Sub_4", 0, 32, 0}, - {"FK_Data_Sub_8", 0, 64, 0}}; + {"FK_Data_Sub_8", 0, 64, 0}, + {"FK_Data_Sub_6b", 0, 6, 0}}; assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind"); return Builtins[Kind]; Modified: head/contrib/llvm/lib/MC/MCAssembler.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCAssembler.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/MC/MCAssembler.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -840,6 +840,10 @@ void MCAssembler::layout(MCAsmLayout &Layout) { getBackend().shouldInsertFixupForCodeAlign(*this, Layout, *AF); } continue; + } else if (auto *FragWithFixups = + dyn_cast(&Frag)) { + Fixups = FragWithFixups->getFixups(); + Contents = FragWithFixups->getContents(); } else llvm_unreachable("Unknown fragment with fixups!"); for (const MCFixup &Fixup : Fixups) { @@ -969,13 +973,9 @@ bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layo MCContext &Context = Layout.getAssembler().getContext(); uint64_t OldSize = DF.getContents().size(); int64_t AddrDelta; - bool Abs; - if (getBackend().requiresDiffExpressionRelocations()) - Abs = DF.getAddrDelta().evaluateAsAbsolute(AddrDelta, Layout); - else { - Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, Layout); - assert(Abs && "We created a line delta with an invalid expression"); - } + bool Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, Layout); + assert(Abs && "We created a line delta with an invalid expression"); + (void)Abs; int64_t LineDelta; LineDelta = DF.getLineDelta(); SmallVectorImpl &Data = DF.getContents(); @@ -983,7 +983,7 @@ bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layo raw_svector_ostream OSE(Data); DF.getFixups().clear(); - if (Abs) { + if (!getBackend().requiresDiffExpressionRelocations()) { MCDwarfLineAddr::Encode(Context, getDWARFLinetableParams(), LineDelta, AddrDelta, OSE); } else { @@ -1017,10 +1017,25 @@ bool MCAssembler::relaxDwarfCallFrameFragment(MCAsmLay bool Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, Layout); assert(Abs && "We created call frame with an invalid expression"); (void) Abs; - SmallString<8> &Data = DF.getContents(); + SmallVectorImpl &Data = DF.getContents(); Data.clear(); raw_svector_ostream OSE(Data); - MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OSE); + DF.getFixups().clear(); + + if (getBackend().requiresDiffExpressionRelocations()) { + uint32_t Offset; + uint32_t Size; + MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OSE, &Offset, + &Size); + if (Size) { + DF.getFixups().push_back(MCFixup::create( + Offset, &DF.getAddrDelta(), + MCFixup::getKindForSizeInBits(Size /*In bits.*/, false /*isPCRel*/))); + } + } else { + MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OSE); + } + return OldSize != Data.size(); } Modified: head/contrib/llvm/lib/MC/MCDwarf.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCDwarf.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/MC/MCDwarf.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -1897,26 +1897,54 @@ void MCDwarfFrameEmitter::EmitAdvanceLoc(MCObjectStrea } void MCDwarfFrameEmitter::EncodeAdvanceLoc(MCContext &Context, - uint64_t AddrDelta, - raw_ostream &OS) { + uint64_t AddrDelta, raw_ostream &OS, + uint32_t *Offset, uint32_t *Size) { // Scale the address delta by the minimum instruction length. AddrDelta = ScaleAddrDelta(Context, AddrDelta); + bool WithFixups = false; + if (Offset && Size) + WithFixups = true; + support::endianness E = Context.getAsmInfo()->isLittleEndian() ? support::little : support::big; if (AddrDelta == 0) { + if (WithFixups) { + *Offset = 0; + *Size = 0; + } } else if (isUIntN(6, AddrDelta)) { uint8_t Opcode = dwarf::DW_CFA_advance_loc | AddrDelta; - OS << Opcode; + if (WithFixups) { + *Offset = OS.tell(); + *Size = 6; + OS << uint8_t(dwarf::DW_CFA_advance_loc); + } else + OS << Opcode; } else if (isUInt<8>(AddrDelta)) { OS << uint8_t(dwarf::DW_CFA_advance_loc1); - OS << uint8_t(AddrDelta); + if (WithFixups) { + *Offset = OS.tell(); + *Size = 8; + OS.write_zeros(1); + } else + OS << uint8_t(AddrDelta); } else if (isUInt<16>(AddrDelta)) { OS << uint8_t(dwarf::DW_CFA_advance_loc2); - support::endian::write(OS, AddrDelta, E); + if (WithFixups) { + *Offset = OS.tell(); + *Size = 16; + OS.write_zeros(2); + } else + support::endian::write(OS, AddrDelta, E); } else { assert(isUInt<32>(AddrDelta)); OS << uint8_t(dwarf::DW_CFA_advance_loc4); - support::endian::write(OS, AddrDelta, E); + if (WithFixups) { + *Offset = OS.tell(); + *Size = 32; + OS.write_zeros(4); + } else + support::endian::write(OS, AddrDelta, E); } } Modified: head/contrib/llvm/lib/MC/MCExpr.cpp ============================================================================== --- head/contrib/llvm/lib/MC/MCExpr.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/MC/MCExpr.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -577,6 +577,24 @@ static void AttemptToFoldSymbolOffsetDifference( A = B = nullptr; } +static bool canFold(const MCAssembler *Asm, const MCSymbolRefExpr *A, + const MCSymbolRefExpr *B, bool InSet) { + if (InSet) + return true; + + if (!Asm->getBackend().requiresDiffExpressionRelocations()) + return true; + + const MCSymbol &CheckSym = A ? A->getSymbol() : B->getSymbol(); + if (!CheckSym.isInSection()) + return true; + + if (!CheckSym.getSection().hasInstructions()) + return true; + + return false; +} + /// Evaluate the result of an add between (conceptually) two MCValues. /// /// This routine conceptually attempts to construct an MCValue: @@ -617,8 +635,7 @@ EvaluateSymbolicAdd(const MCAssembler *Asm, const MCAs // the backend requires this to be emitted as individual relocations, unless // the InSet flag is set to get the current difference anyway (used for // example to calculate symbol sizes). - if (Asm && - (InSet || !Asm->getBackend().requiresDiffExpressionRelocations())) { + if (Asm && canFold(Asm, LHS_A, LHS_B, InSet)) { // First, fold out any differences which are fully resolved. By // reassociating terms in // Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst). Modified: head/contrib/llvm/lib/Object/RelocationResolver.cpp ============================================================================== --- head/contrib/llvm/lib/Object/RelocationResolver.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Object/RelocationResolver.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -335,6 +335,8 @@ static bool supportsRISCV(uint64_t Type) { case ELF::R_RISCV_NONE: case ELF::R_RISCV_32: case ELF::R_RISCV_64: + case ELF::R_RISCV_SET6: + case ELF::R_RISCV_SUB6: case ELF::R_RISCV_ADD8: case ELF::R_RISCV_SUB8: case ELF::R_RISCV_ADD16: @@ -358,6 +360,10 @@ static uint64_t resolveRISCV(RelocationRef R, uint64_t return (S + RA) & 0xFFFFFFFF; case ELF::R_RISCV_64: return S + RA; + case ELF::R_RISCV_SET6: + return (A + (S + RA)) & 0xFF; + case ELF::R_RISCV_SUB6: + return (A - (S + RA)) & 0xFF; case ELF::R_RISCV_ADD8: return (A + (S + RA)) & 0xFF; case ELF::R_RISCV_SUB8: Modified: head/contrib/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -127,6 +127,7 @@ class RISCVAsmParser : public MCTargetAsmParser { OperandMatchResultTy parseRegister(OperandVector &Operands, bool AllowParens = false); OperandMatchResultTy parseMemOpBaseReg(OperandVector &Operands); + OperandMatchResultTy parseAtomicMemOp(OperandVector &Operands); OperandMatchResultTy parseOperandWithModifier(OperandVector &Operands); OperandMatchResultTy parseBareSymbol(OperandVector &Operands); OperandMatchResultTy parseCallSymbol(OperandVector &Operands); @@ -575,6 +576,15 @@ struct RISCVOperand : public MCParsedAsmOperand { (pub bool isSImm21Lsb0JAL() const { return isBareSimmNLsb0<21>(); } + bool isImmZero() const { + if (!isImm()) + return false; + int64_t Imm; + RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; + bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); + return IsConstantImm && (Imm == 0) && VK == RISCVMCExpr::VK_RISCV_None; + } + /// getStartLoc - Gets location of the first token of this operand SMLoc getStartLoc() const override { return StartLoc; } /// getEndLoc - Gets location of the last token of this operand @@ -1296,6 +1306,73 @@ RISCVAsmParser::parseMemOpBaseReg(OperandVector &Opera getParser().Lex(); // Eat ')' Operands.push_back(RISCVOperand::createToken(")", getLoc(), isRV64())); + + return MatchOperand_Success; +} + +OperandMatchResultTy RISCVAsmParser::parseAtomicMemOp(OperandVector &Operands) { + // Atomic operations such as lr.w, sc.w, and amo*.w accept a "memory operand" + // as one of their register operands, such as `(a0)`. This just denotes that + // the register (in this case `a0`) contains a memory address. + // + // Normally, we would be able to parse these by putting the parens into the + // instruction string. However, GNU as also accepts a zero-offset memory + // operand (such as `0(a0)`), and ignores the 0. Normally this would be parsed + // with parseImmediate followed by parseMemOpBaseReg, but these instructions + // do not accept an immediate operand, and we do not want to add a "dummy" + // operand that is silently dropped. + // + // Instead, we use this custom parser. This will: allow (and discard) an + // offset if it is zero; require (and discard) parentheses; and add only the + // parsed register operand to `Operands`. + // + // These operands are printed with RISCVInstPrinter::printAtomicMemOp, which + // will only print the register surrounded by parentheses (which GNU as also + // uses as its canonical representation for these operands). + std::unique_ptr OptionalImmOp; + + if (getLexer().isNot(AsmToken::LParen)) { + // Parse an Integer token. We do not accept arbritrary constant expressions + // in the offset field (because they may include parens, which complicates + // parsing a lot). + int64_t ImmVal; + SMLoc ImmStart = getLoc(); + if (getParser().parseIntToken(ImmVal, + "expected '(' or optional integer offset")) + return MatchOperand_ParseFail; + + // Create a RISCVOperand for checking later (so the error messages are + // nicer), but we don't add it to Operands. + SMLoc ImmEnd = getLoc(); + OptionalImmOp = + RISCVOperand::createImm(MCConstantExpr::create(ImmVal, getContext()), + ImmStart, ImmEnd, isRV64()); + } + + if (getLexer().isNot(AsmToken::LParen)) { + Error(getLoc(), OptionalImmOp ? "expected '(' after optional integer offset" + : "expected '(' or optional integer offset"); + return MatchOperand_ParseFail; + } + getParser().Lex(); // Eat '(' + + if (parseRegister(Operands) != MatchOperand_Success) { + Error(getLoc(), "expected register"); + return MatchOperand_ParseFail; + } + + if (getLexer().isNot(AsmToken::RParen)) { + Error(getLoc(), "expected ')'"); + return MatchOperand_ParseFail; + } + getParser().Lex(); // Eat ')' + + // Deferred Handling of non-zero offsets. This makes the error messages nicer. + if (OptionalImmOp && !OptionalImmOp->isImmZero()) { + Error(OptionalImmOp->getStartLoc(), "optional integer offset must be 0", + SMRange(OptionalImmOp->getStartLoc(), OptionalImmOp->getEndLoc())); + return MatchOperand_ParseFail; + } return MatchOperand_Success; } Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -33,6 +33,13 @@ bool RISCVAsmBackend::shouldForceRelocation(const MCAs switch ((unsigned)Fixup.getKind()) { default: break; + case FK_Data_1: + case FK_Data_2: + case FK_Data_4: + case FK_Data_8: + if (Target.isAbsolute()) + return false; + break; case RISCV::fixup_riscv_got_hi20: case RISCV::fixup_riscv_tls_got_hi20: case RISCV::fixup_riscv_tls_gd_hi20: @@ -186,6 +193,7 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, case FK_Data_2: case FK_Data_4: case FK_Data_8: + case FK_Data_6b: return Value; case RISCV::fixup_riscv_lo12_i: case RISCV::fixup_riscv_pcrel_lo12_i: Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "MCTargetDesc/RISCVFixupKinds.h" +#include "MCTargetDesc/RISCVMCExpr.h" #include "MCTargetDesc/RISCVMCTargetDesc.h" #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCFixup.h" @@ -47,6 +48,7 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const { + const MCExpr *Expr = Fixup.getValue(); // Determine the type of the relocation unsigned Kind = Fixup.getKind(); if (IsPCRel) { @@ -87,6 +89,9 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext default: llvm_unreachable("invalid fixup kind!"); case FK_Data_4: + if (Expr->getKind() == MCExpr::Target && + cast(Expr)->getKind() == RISCVMCExpr::VK_RISCV_32_PCREL) + return ELF::R_RISCV_32_PCREL; return ELF::R_RISCV_32; case FK_Data_8: return ELF::R_RISCV_64; @@ -98,6 +103,8 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext return ELF::R_RISCV_ADD32; case FK_Data_Add_8: return ELF::R_RISCV_ADD64; + case FK_Data_Add_6b: + return ELF::R_RISCV_SET6; case FK_Data_Sub_1: return ELF::R_RISCV_SUB8; case FK_Data_Sub_2: @@ -106,6 +113,8 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext return ELF::R_RISCV_SUB32; case FK_Data_Sub_8: return ELF::R_RISCV_SUB64; + case FK_Data_Sub_6b: + return ELF::R_RISCV_SUB6; case RISCV::fixup_riscv_hi20: return ELF::R_RISCV_HI20; case RISCV::fixup_riscv_lo12_i: Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -112,3 +112,15 @@ void RISCVInstPrinter::printFRMArg(const MCInst *MI, u static_cast(MI->getOperand(OpNo).getImm()); O << RISCVFPRndMode::roundingModeToString(FRMArg); } + +void RISCVInstPrinter::printAtomicMemOp(const MCInst *MI, unsigned OpNo, + const MCSubtargetInfo &STI, + raw_ostream &O) { + const MCOperand &MO = MI->getOperand(OpNo); + + assert(MO.isReg() && "printAtomicMemOp can only print register operands"); + O << "("; + printRegName(O, MO.getReg()); + O << ")"; + return; +} Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h Thu Nov 7 19:54:08 2019 (r354469) @@ -37,6 +37,8 @@ class RISCVInstPrinter : public MCInstPrinter { (publi const MCSubtargetInfo &STI, raw_ostream &O); void printFRMArg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O); + void printAtomicMemOp(const MCInst *MI, unsigned OpNo, + const MCSubtargetInfo &STI, raw_ostream &O); // Autogenerated by tblgen. void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI, Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -11,7 +11,10 @@ //===----------------------------------------------------------------------===// #include "RISCVMCAsmInfo.h" +#include "MCTargetDesc/RISCVMCExpr.h" #include "llvm/ADT/Triple.h" +#include "llvm/BinaryFormat/Dwarf.h" +#include "llvm/MC/MCStreamer.h" using namespace llvm; void RISCVMCAsmInfo::anchor() {} @@ -24,4 +27,21 @@ RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) { ExceptionsType = ExceptionHandling::DwarfCFI; Data16bitsDirective = "\t.half\t"; Data32bitsDirective = "\t.word\t"; +} + +const MCExpr *RISCVMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, + unsigned Encoding, + MCStreamer &Streamer) const { + if (!(Encoding & dwarf::DW_EH_PE_pcrel)) + return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer); + + // The default symbol subtraction results in an ADD/SUB relocation pair. + // Processing this relocation pair is problematic when linker relaxation is + // enabled, so we follow binutils in using the R_RISCV_32_PCREL relocation + // for the FDE initial location. + MCContext &Ctx = Streamer.getContext(); + const MCExpr *ME = + MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx); + assert(Encoding & dwarf::DW_EH_PE_sdata4 && "Unexpected encoding"); + return RISCVMCExpr::create(ME, RISCVMCExpr::VK_RISCV_32_PCREL, Ctx); } Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h Thu Nov 7 19:54:08 2019 (r354469) @@ -23,6 +23,9 @@ class RISCVMCAsmInfo : public MCAsmInfoELF { public: explicit RISCVMCAsmInfo(const Triple &TargetTriple); + + const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, + MCStreamer &Streamer) const override; }; } // namespace llvm Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -266,6 +266,7 @@ unsigned RISCVMCCodeEmitter::getImmOpValue(const MCIns switch (RVExpr->getKind()) { case RISCVMCExpr::VK_RISCV_None: case RISCVMCExpr::VK_RISCV_Invalid: + case RISCVMCExpr::VK_RISCV_32_PCREL: llvm_unreachable("Unhandled fixup kind!"); case RISCVMCExpr::VK_RISCV_TPREL_ADD: // tprel_add is only used to indicate that a relocation should be emitted Modified: head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h Thu Nov 7 19:54:08 2019 (r354469) @@ -36,6 +36,7 @@ class RISCVMCExpr : public MCTargetExpr { (public) VK_RISCV_TLS_GD_HI, VK_RISCV_CALL, VK_RISCV_CALL_PLT, + VK_RISCV_32_PCREL, VK_RISCV_Invalid }; Modified: head/contrib/llvm/lib/Target/RISCV/RISCVInstrInfoA.td ============================================================================== --- head/contrib/llvm/lib/Target/RISCV/RISCVInstrInfoA.td Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/lib/Target/RISCV/RISCVInstrInfoA.td Thu Nov 7 19:54:08 2019 (r354469) @@ -12,14 +12,32 @@ //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// +// Operand and SDNode transformation definitions. +//===----------------------------------------------------------------------===// + +// A parse method for (${gpr}) or 0(${gpr}), where the 0 is be silently ignored. +// Used for GNU as Compatibility. +def AtomicMemOpOperand : AsmOperandClass { + let Name = "AtomicMemOpOperand"; + let RenderMethod = "addRegOperands"; + let PredicateMethod = "isReg"; + let ParserMethod = "parseAtomicMemOp"; +} + +def GPRMemAtomic : RegisterOperand { + let ParserMatchClass = AtomicMemOpOperand; + let PrintMethod = "printAtomicMemOp"; +} + +//===----------------------------------------------------------------------===// // Instruction class templates //===----------------------------------------------------------------------===// let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in class LR_r funct3, string opcodestr> : RVInstRAtomic<0b00010, aq, rl, funct3, OPC_AMO, - (outs GPR:$rd), (ins GPR:$rs1), - opcodestr, "$rd, (${rs1})"> { + (outs GPR:$rd), (ins GPRMemAtomic:$rs1), + opcodestr, "$rd, $rs1"> { let rs2 = 0; } @@ -33,8 +51,8 @@ multiclass LR_r_aq_rl funct3, string opcodestr let hasSideEffects = 0, mayLoad = 1, mayStore = 1 in class AMO_rr funct5, bit aq, bit rl, bits<3> funct3, string opcodestr> : RVInstRAtomic; + (outs GPR:$rd), (ins GPRMemAtomic:$rs1, GPR:$rs2), + opcodestr, "$rd, $rs2, $rs1">; multiclass AMO_rr_aq_rl funct5, bits<3> funct3, string opcodestr> { def "" : AMO_rr; Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -363,15 +363,26 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new AMDGPUTargetInfo(Triple, Opts); case llvm::Triple::riscv32: - // TODO: add cases for FreeBSD, NetBSD, RTEMS once tested. - if (os == llvm::Triple::Linux) + // TODO: add cases for NetBSD, RTEMS once tested. + switch (os) { + case llvm::Triple::FreeBSD: + return new FreeBSDTargetInfo(Triple, Opts); + case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); - return new RISCV32TargetInfo(Triple, Opts); + default: + return new RISCV32TargetInfo(Triple, Opts); + } + case llvm::Triple::riscv64: - // TODO: add cases for FreeBSD, NetBSD, RTEMS once tested. - if (os == llvm::Triple::Linux) + // TODO: add cases for NetBSD, RTEMS once tested. + switch (os) { + case llvm::Triple::FreeBSD: + return new FreeBSDTargetInfo(Triple, Opts); + case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); - return new RISCV64TargetInfo(Triple, Opts); + default: + return new RISCV64TargetInfo(Triple, Opts); + } case llvm::Triple::sparc: switch (os) { Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp Thu Nov 7 19:37:26 2019 (r354468) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/FreeBSD.cpp Thu Nov 7 19:54:08 2019 (r354469) @@ -197,6 +197,14 @@ void freebsd::Linker::ConstructJob(Compilation &C, con else CmdArgs.push_back("elf64ltsmip_fbsd"); break; + case llvm::Triple::riscv32: + CmdArgs.push_back("-m"); + CmdArgs.push_back("elf32lriscv"); + break; + case llvm::Triple::riscv64: + CmdArgs.push_back("-m"); + CmdArgs.push_back("elf64lriscv"); + break; default: break; } From owner-svn-src-all@freebsd.org Thu Nov 7 19:54:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F141BF183; Thu, 7 Nov 2019 19:54:25 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Dcx1xK1z4FPw; Thu, 7 Nov 2019 19:54:25 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25E7B1AF79; Thu, 7 Nov 2019 19:54:25 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7JsP8K040403; Thu, 7 Nov 2019 19:54:25 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7JsOUc040399; Thu, 7 Nov 2019 19:54:24 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201911071954.xA7JsOUc040399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Thu, 7 Nov 2019 19:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354470 - head/sys/dev/hwpmc X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/dev/hwpmc X-SVN-Commit-Revision: 354470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 19:54:25 -0000 Author: gallatin Date: Thu Nov 7 19:54:24 2019 New Revision: 354470 URL: https://svnweb.freebsd.org/changeset/base/354470 Log: hwpmc : fix AMD perf counter MSR access - amd_intr() does not account for the offset (0x200) in the counter MSR address and ends up accessing invalid regions while reading counter value after the 4th counter (0xC001000[8,9,..]) and erroneously updates the counter values for counters [1-4]. - amd_intr() should only check core pmcs for interrupts since other types of pmcs (L3,DF) cannot generate interrupts. - fix pmc NMI's being ignored due to NMI latency on newer AMD processors Note that this fixes a kernel panic due to GPFs accessing MSRs on higher core count AMD cpus (seen on both Rome 7502P, and Threadripper 2990WX 32-core CPUs) Discussed with: markj Submitted by: Shreyank Amartya Differential Revision: https://reviews.freebsd.org/D21553 Modified: head/sys/dev/hwpmc/hwpmc_amd.c head/sys/dev/hwpmc/hwpmc_amd.h Modified: head/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_amd.c Thu Nov 7 19:54:08 2019 (r354469) +++ head/sys/dev/hwpmc/hwpmc_amd.c Thu Nov 7 19:54:24 2019 (r354470) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -53,6 +54,10 @@ __FBSDID("$FreeBSD$"); enum pmc_class amd_pmc_class; #endif +#define OVERFLOW_WAIT_COUNT 50 + +DPCPU_DEFINE_STATIC(uint32_t, nmi_counter); + /* AMD K7 & K8 PMCs */ struct amd_descr { struct pmc_descr pm_descr; /* "base class" */ @@ -739,6 +744,7 @@ amd_stop_pmc(int cpu, int ri) struct pmc_hw *phw; const struct amd_descr *pd; uint64_t config; + int i; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[amd,%d] illegal CPU value %d", __LINE__, cpu)); @@ -761,6 +767,21 @@ amd_stop_pmc(int cpu, int ri) /* turn off the PMC ENABLE bit */ config = pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE; wrmsr(pd->pm_evsel, config); + + /* + * Due to NMI latency on newer AMD processors + * NMI interrupts are ignored, which leads to + * panic or messages based on kernel configuraiton + */ + + /* Wait for the count to be reset */ + for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) { + if (rdmsr(pd->pm_perfctr) & (1 << (pd->pm_descr.pd_width - 1))) + break; + + DELAY(1); + } + return 0; } @@ -779,6 +800,7 @@ amd_intr(struct trapframe *tf) struct pmc *pm; struct amd_cpu *pac; pmc_value_t v; + uint32_t active = 0, count = 0; cpu = curcpu; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -798,19 +820,21 @@ amd_intr(struct trapframe *tf) * * If found, we call a helper to process the interrupt. * - * If multiple PMCs interrupt at the same time, the AMD64 - * processor appears to deliver as many NMIs as there are - * outstanding PMC interrupts. So we process only one NMI - * interrupt at a time. + * PMCs interrupting at the same time are collapsed into + * a single interrupt. Check all the valid pmcs for + * overflow. */ - for (i = 0; retval == 0 && i < AMD_NPMCS; i++) { + for (i = 0; i < AMD_CORE_NPMCS; i++) { if ((pm = pac->pc_amdpmcs[i].phw_pmc) == NULL || !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { continue; } + /* Consider pmc with valid handle as active */ + active++; + if (!AMD_PMC_HAS_OVERFLOWED(i)) continue; @@ -820,8 +844,8 @@ amd_intr(struct trapframe *tf) continue; /* Stop the PMC, reload count. */ - evsel = AMD_PMC_EVSEL_0 + i; - perfctr = AMD_PMC_PERFCTR_0 + i; + evsel = amd_pmcdesc[i].pm_evsel; + perfctr = amd_pmcdesc[i].pm_perfctr; v = pm->pm_sc.pm_reloadcount; config = rdmsr(evsel); @@ -837,6 +861,26 @@ amd_intr(struct trapframe *tf) error = pmc_process_interrupt(PMC_HR, pm, tf); if (error == 0) wrmsr(evsel, config); + } + + /* + * Due to NMI latency, there can be a scenario in which + * multiple pmcs gets serviced in an earlier NMI and we + * do not find an overflow in the subsequent NMI. + * + * For such cases we keep a per-cpu count of active NMIs + * and compare it with min(active pmcs, 2) to determine + * if this NMI was for a pmc overflow which was serviced + * in an earlier request or should be ignored. + */ + + if (retval) { + DPCPU_SET(nmi_counter, min(2, active)); + } else { + if ((count = DPCPU_GET(nmi_counter))) { + retval = 1; + DPCPU_SET(nmi_counter, --count); + } } if (retval) Modified: head/sys/dev/hwpmc/hwpmc_amd.h ============================================================================== --- head/sys/dev/hwpmc/hwpmc_amd.h Thu Nov 7 19:54:08 2019 (r354469) +++ head/sys/dev/hwpmc/hwpmc_amd.h Thu Nov 7 19:54:24 2019 (r354470) @@ -76,6 +76,7 @@ #define AMD_PMC_PERFCTR_EP_DF_3 0xC0010247 #define AMD_NPMCS 16 +#define AMD_CORE_NPMCS 6 #define AMD_PMC_COUNTERMASK 0xFF000000 From owner-svn-src-all@freebsd.org Thu Nov 7 20:09:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 242E91BF666; Thu, 7 Nov 2019 20:09:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Dyb06N2z4G5Q; Thu, 7 Nov 2019 20:09:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC7B71B153; Thu, 7 Nov 2019 20:09:42 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7K9gPx046771; Thu, 7 Nov 2019 20:09:42 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7K9fpb046764; Thu, 7 Nov 2019 20:09:41 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911072009.xA7K9fpb046764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 7 Nov 2019 20:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354471 - in stable/12: share/man/man4 sys/dev/netmap sys/net tools/tools/netmap usr.sbin usr.sbin/valectl X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/netmap sys/net tools/tools/netmap usr.sbin usr.sbin/valectl X-SVN-Commit-Revision: 354471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:09:43 -0000 Author: vmaffione Date: Thu Nov 7 20:09:41 2019 New Revision: 354471 URL: https://svnweb.freebsd.org/changeset/base/354471 Log: MFC r354229 add valectl to the system commands The valectl(4) program is used to manage vale(4) switches. Add it to the system commands so that it can be used right away. This program was previously called vale-ctl, and stored in tools/tools/netmap Reviewed by: hrs, bcr, lwhsu, kevans Differential Revision: https://reviews.freebsd.org/D22146 Added: stable/12/usr.sbin/valectl/ - copied from r354229, head/usr.sbin/valectl/ Deleted: stable/12/tools/tools/netmap/vale-ctl.4 stable/12/tools/tools/netmap/vale-ctl.c Modified: stable/12/share/man/man4/netmap.4 stable/12/sys/dev/netmap/netmap_bdg.c stable/12/sys/net/netmap_legacy.h stable/12/tools/tools/netmap/Makefile stable/12/tools/tools/netmap/README stable/12/tools/tools/netmap/lb.8 stable/12/usr.sbin/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/netmap.4 ============================================================================== --- stable/12/share/man/man4/netmap.4 Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/share/man/man4/netmap.4 Thu Nov 7 20:09:41 2019 (r354471) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2018 +.Dd October 26, 2019 .Dt NETMAP 4 .Os .Sh NAME @@ -1087,14 +1087,14 @@ changing port names, e.g., .Pp The following command attaches an interface and the host stack to a switch: -.Dl vale-ctl -h vale2:em0 +.Dl valectl -h vale2:em0 Other .Nm clients attached to the same switch can now communicate with the network card or the host. .Sh SEE ALSO .Xr vale 4 , -.Xr vale-ctl 4 , +.Xr valectl 8 , .Xr bridge 8 , .Xr lb 8 , .Xr nmreplay 8 , Modified: stable/12/sys/dev/netmap/netmap_bdg.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_bdg.c Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/sys/dev/netmap/netmap_bdg.c Thu Nov 7 20:09:41 2019 (r354471) @@ -1442,7 +1442,7 @@ put_out: /* nm_bdg_ctl callback for the bwrap. - * Called on bridge-attach and detach, as an effect of vale-ctl -[ahd]. + * Called on bridge-attach and detach, as an effect of valectl -[ahd]. * On attach, it needs to provide a fake netmap_priv_d structure and * perform a netmap_do_regif() on the bwrap. This will put both the * bwrap and the hwna in netmap mode, with the netmap rings shared Modified: stable/12/sys/net/netmap_legacy.h ============================================================================== --- stable/12/sys/net/netmap_legacy.h Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/sys/net/netmap_legacy.h Thu Nov 7 20:09:41 2019 (r354471) @@ -116,13 +116,13 @@ * nr_cmd (in) if non-zero indicates a special command: * NETMAP_BDG_ATTACH and nr_name = vale*:ifname * attaches the NIC to the switch; nr_ringid specifies - * which rings to use. Used by vale-ctl -a ... + * which rings to use. Used by valectl -a ... * nr_arg1 = NETMAP_BDG_HOST also attaches the host port - * as in vale-ctl -h ... + * as in valectl -h ... * * NETMAP_BDG_DETACH and nr_name = vale*:ifname * disconnects a previously attached NIC. - * Used by vale-ctl -d ... + * Used by valectl -d ... * * NETMAP_BDG_LIST * list the configuration of VALE switches. @@ -133,10 +133,10 @@ * * NETMAP_BDG_NEWIF * create a persistent VALE port with name nr_name. - * Used by vale-ctl -n ... + * Used by valectl -n ... * * NETMAP_BDG_DELIF - * delete a persistent VALE port. Used by vale-ctl -d ... + * delete a persistent VALE port. Used by valectl -d ... * * nr_arg1, nr_arg2, nr_arg3 (in/out) command specific * Modified: stable/12/tools/tools/netmap/Makefile ============================================================================== --- stable/12/tools/tools/netmap/Makefile Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/tools/tools/netmap/Makefile Thu Nov 7 20:09:41 2019 (r354471) @@ -3,7 +3,7 @@ # # For multiple programs using a single source file each, # we can just define 'progs' and create custom targets. -PROGS = pkt-gen nmreplay bridge vale-ctl lb +PROGS = pkt-gen nmreplay bridge lb CLEANFILES = $(PROGS) *.o MAN= @@ -31,9 +31,6 @@ bridge: bridge.o nmreplay: nmreplay.o $(CC) $(CFLAGS) -o nmreplay nmreplay.o $(LDFLAGS) - -vale-ctl: vale-ctl.o - $(CC) $(CFLAGS) -o vale-ctl vale-ctl.o lb: lb.o pkt_hash.o $(CC) $(CFLAGS) -o lb lb.o pkt_hash.o $(LDFLAGS) Modified: stable/12/tools/tools/netmap/README ============================================================================== --- stable/12/tools/tools/netmap/README Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/tools/tools/netmap/README Thu Nov 7 20:09:41 2019 (r354471) @@ -6,8 +6,6 @@ This directory contains applications that use the netm bridge a two-port jumper wire, also using the netmap API - vale-ctl the program to control and inspect VALE switches - lb an L3/L4 load balancer nmreplay a tool to playback a pcap file to a netmap port Modified: stable/12/tools/tools/netmap/lb.8 ============================================================================== --- stable/12/tools/tools/netmap/lb.8 Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/tools/tools/netmap/lb.8 Thu Nov 7 20:09:41 2019 (r354471) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2018 +.Dd October 26, 2019 .Dt LB 8 .Os .Sh NAME @@ -111,7 +111,7 @@ If .Nm does not exit cleanly the ports will not be removed. Please use -.Xr vale-ctl 4 +.Xr valectl 8 to remove any stale persistent VALE port. .Sh SEE ALSO .Xr netmap 4 , Modified: stable/12/usr.sbin/Makefile ============================================================================== --- stable/12/usr.sbin/Makefile Thu Nov 7 19:54:24 2019 (r354470) +++ stable/12/usr.sbin/Makefile Thu Nov 7 20:09:41 2019 (r354471) @@ -96,6 +96,7 @@ SUBDIR= adduser \ trpt \ tzsetup \ ugidfw \ + valectl \ vigr \ vipw \ wake \ From owner-svn-src-all@freebsd.org Thu Nov 7 20:11:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 950961BF80D; Thu, 7 Nov 2019 20:11:54 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478F163TRYz4GPk; Thu, 7 Nov 2019 20:11:54 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5AE4F1B2E6; Thu, 7 Nov 2019 20:11:54 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7KBs9B048389; Thu, 7 Nov 2019 20:11:54 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7KBs1d048388; Thu, 7 Nov 2019 20:11:54 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911072011.xA7KBs1d048388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 7 Nov 2019 20:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354472 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 354472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:11:54 -0000 Author: vmaffione Date: Thu Nov 7 20:11:53 2019 New Revision: 354472 URL: https://svnweb.freebsd.org/changeset/base/354472 Log: MFC r354231 netmap: fix build issue in netmap_user.h The issue was a comparison of integers of different signs on 32 bit architectures. Reported by: jenkins MFC after: 1 week Modified: stable/12/sys/net/netmap_user.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/netmap_user.h ============================================================================== --- stable/12/sys/net/netmap_user.h Thu Nov 7 20:09:41 2019 (r354471) +++ stable/12/sys/net/netmap_user.h Thu Nov 7 20:11:53 2019 (r354472) @@ -1116,7 +1116,7 @@ nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_ slot = &ring->slot[i]; d->hdr.len += slot->len; nbuf = (u_char *)NETMAP_BUF(ring, slot->buf_idx); - if (oldbuf != NULL && nbuf - oldbuf == ring->nr_buf_size && + if (oldbuf != NULL && nbuf - oldbuf == (int)ring->nr_buf_size && oldlen == ring->nr_buf_size) { d->hdr.caplen += slot->len; oldbuf = nbuf; From owner-svn-src-all@freebsd.org Thu Nov 7 20:38:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 949181781E2; Thu, 7 Nov 2019 20:38:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478FcG3T1Qz4J4K; Thu, 7 Nov 2019 20:38:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 567461B6AB; Thu, 7 Nov 2019 20:38:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Kcs3M066506; Thu, 7 Nov 2019 20:38:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Kcs5h066505; Thu, 7 Nov 2019 20:38:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072038.xA7Kcs5h066505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354473 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:38:54 -0000 Author: glebius Date: Thu Nov 7 20:38:53 2019 New Revision: 354473 URL: https://svnweb.freebsd.org/changeset/base/354473 Log: Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in udp6_input(). It shall always run in the network epoch. Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Nov 7 20:11:53 2019 (r354472) +++ head/sys/netinet6/udp6_usrreq.c Thu Nov 7 20:38:53 2019 (r354473) @@ -214,12 +214,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto) int off = *offp; int cscov_partial; int plen, ulen; - struct epoch_tracker et; struct sockaddr_in6 fromsa[2]; struct m_tag *fwd_tag; uint16_t uh_sum; uint8_t nxt; + NET_EPOCH_ASSERT(); + ifp = m->m_pkthdr.rcvif; #ifndef PULLDOWN_TEST @@ -301,7 +302,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) struct inpcbhead *pcblist; struct ip6_moptions *imo; - INP_INFO_RLOCK_ET(pcbinfo, et); /* * In the event that laddr should be set to the link-local * address (this happens in RIPng), the multicast address @@ -395,7 +395,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) UDP_PROBE(receive, NULL, last, ip6, last, uh); if (udp6_append(last, n, off, fromsa)) - goto inp_lost; + return (IPPROTO_DONE); } INP_RUNLOCK(last); } @@ -422,7 +422,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) */ UDPSTAT_INC(udps_noport); UDPSTAT_INC(udps_noportmcast); - goto badheadlocked; + goto badunlocked; } INP_RLOCK(last); if (__predict_true(last->inp_flags2 & INP_FREED) == 0) { @@ -434,8 +434,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) INP_RUNLOCK(last); } else INP_RUNLOCK(last); - inp_lost: - INP_INFO_RUNLOCK_ET(pcbinfo, et); return (IPPROTO_DONE); } /* @@ -522,8 +520,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto) INP_RUNLOCK(inp); return (IPPROTO_DONE); -badheadlocked: - INP_INFO_RUNLOCK_ET(pcbinfo, et); badunlocked: if (m) m_freem(m); From owner-svn-src-all@freebsd.org Thu Nov 7 20:40:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C2D1782A8; Thu, 7 Nov 2019 20:40:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478FfP5GWQz4JCv; Thu, 7 Nov 2019 20:40:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98D891B6BD; Thu, 7 Nov 2019 20:40:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7KejWu066693; Thu, 7 Nov 2019 20:40:45 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7KejRL066692; Thu, 7 Nov 2019 20:40:45 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072040.xA7KejRL066692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354474 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:40:45 -0000 Author: glebius Date: Thu Nov 7 20:40:44 2019 New Revision: 354474 URL: https://svnweb.freebsd.org/changeset/base/354474 Log: Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in raw input functions for IPv4 and IPv6. They shall always run in the network epoch. Modified: head/sys/netinet/raw_ip.c head/sys/netinet6/raw_ip6.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Thu Nov 7 20:38:53 2019 (r354473) +++ head/sys/netinet/raw_ip.c Thu Nov 7 20:40:44 2019 (r354474) @@ -284,9 +284,10 @@ rip_input(struct mbuf **mp, int *offp, int proto) struct ip *ip = mtod(m, struct ip *); struct inpcb *inp, *last; struct sockaddr_in ripsrc; - struct epoch_tracker et; int hash; + NET_EPOCH_ASSERT(); + *mp = NULL; bzero(&ripsrc, sizeof(ripsrc)); @@ -299,7 +300,6 @@ rip_input(struct mbuf **mp, int *offp, int proto) hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); CK_LIST_FOREACH(inp, &V_ripcbinfo.ipi_hashbase[hash], inp_hash) { if (inp->inp_ip_p != proto) continue; @@ -422,7 +422,6 @@ rip_input(struct mbuf **mp, int *offp, int proto) skip_2: INP_RUNLOCK(inp); } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); if (last != NULL) { if (rip_append(last, ip, m, &ripsrc) != 0) IPSTAT_INC(ips_delivered); Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Thu Nov 7 20:38:53 2019 (r354473) +++ head/sys/netinet6/raw_ip6.c Thu Nov 7 20:40:44 2019 (r354474) @@ -165,15 +165,15 @@ rip6_input(struct mbuf **mp, int *offp, int proto) struct inpcb *last = NULL; struct mbuf *opts = NULL; struct sockaddr_in6 fromsa; - struct epoch_tracker et; + NET_EPOCH_ASSERT(); + RIP6STAT_INC(rip6s_ipackets); init_sin6(&fromsa, m, 0); /* general init */ ifp = m->m_pkthdr.rcvif; - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); CK_LIST_FOREACH(inp, &V_ripcb, inp_list) { /* XXX inp locking */ if ((inp->inp_vflag & INP_IPV6) == 0) @@ -303,7 +303,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto) skip_2: INP_RUNLOCK(inp); } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); #if defined(IPSEC) || defined(IPSEC_SUPPORT) /* * Check AH/ESP integrity. From owner-svn-src-all@freebsd.org Thu Nov 7 20:43:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 169CB1784BA; Thu, 7 Nov 2019 20:43:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478FjD6rVvz4JZy; Thu, 7 Nov 2019 20:43:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE60C1B87A; Thu, 7 Nov 2019 20:43:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7KhC18072005; Thu, 7 Nov 2019 20:43:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7KhCYl072004; Thu, 7 Nov 2019 20:43:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072043.xA7KhCYl072004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354475 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:43:13 -0000 Author: glebius Date: Thu Nov 7 20:43:12 2019 New Revision: 354475 URL: https://svnweb.freebsd.org/changeset/base/354475 Log: Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in icmp6_rip6_input(). It shall always run in the network epoch. Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Thu Nov 7 20:40:44 2019 (r354474) +++ head/sys/netinet6/icmp6.c Thu Nov 7 20:43:12 2019 (r354475) @@ -1893,9 +1893,10 @@ icmp6_rip6_input(struct mbuf **mp, int off) struct inpcb *last = NULL; struct sockaddr_in6 fromsa; struct icmp6_hdr *icmp6; - struct epoch_tracker et; struct mbuf *opts = NULL; + NET_EPOCH_ASSERT(); + #ifndef PULLDOWN_TEST /* this is assumed to be safe. */ icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off); @@ -1920,7 +1921,6 @@ icmp6_rip6_input(struct mbuf **mp, int off) return (IPPROTO_DONE); } - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); CK_LIST_FOREACH(inp, &V_ripcb, inp_list) { if ((inp->inp_vflag & INP_IPV6) == 0) continue; @@ -2002,7 +2002,6 @@ icmp6_rip6_input(struct mbuf **mp, int off) } last = inp; } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); if (last != NULL) { if (last->inp_flags & INP_CONTROLOPTS) ip6_savecontrol(last, m, &opts); From owner-svn-src-all@freebsd.org Thu Nov 7 20:44:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEA90178545; Thu, 7 Nov 2019 20:44:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Fkp4ctDz4Jjt; Thu, 7 Nov 2019 20:44:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81C691B87C; Thu, 7 Nov 2019 20:44:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7KiYYZ072131; Thu, 7 Nov 2019 20:44:34 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7KiYnn072130; Thu, 7 Nov 2019 20:44:34 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072044.xA7KiYnn072130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354476 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:44:34 -0000 Author: glebius Date: Thu Nov 7 20:44:34 2019 New Revision: 354476 URL: https://svnweb.freebsd.org/changeset/base/354476 Log: Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in divert_packet(). This function is called only from pfil(9) filters, which in their place always run in the network epoch. Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Thu Nov 7 20:43:12 2019 (r354475) +++ head/sys/netinet/ip_divert.c Thu Nov 7 20:44:34 2019 (r354476) @@ -192,8 +192,9 @@ divert_packet(struct mbuf *m, bool incoming) u_int16_t nport; struct sockaddr_in divsrc; struct m_tag *mtag; - struct epoch_tracker et; + NET_EPOCH_ASSERT(); + mtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL); if (mtag == NULL) { m_freem(m); @@ -231,7 +232,6 @@ divert_packet(struct mbuf *m, bool incoming) /* Sanity check */ M_ASSERTPKTHDR(m); - NET_EPOCH_ASSERT(); /* Find IP address for receive interface */ ifp = m->m_pkthdr.rcvif; @@ -272,7 +272,6 @@ divert_packet(struct mbuf *m, bool incoming) /* Put packet on socket queue, if any */ sa = NULL; nport = htons((u_int16_t)(((struct ipfw_rule_ref *)(mtag+1))->info)); - INP_INFO_RLOCK_ET(&V_divcbinfo, et); CK_LIST_FOREACH(inp, &V_divcb, inp_list) { /* XXX why does only one socket match? */ if (inp->inp_lport == nport) { @@ -290,7 +289,6 @@ divert_packet(struct mbuf *m, bool incoming) break; } } - INP_INFO_RUNLOCK_ET(&V_divcbinfo, et); if (sa == NULL) { m_freem(m); KMOD_IPSTAT_INC(ips_noproto); From owner-svn-src-all@freebsd.org Thu Nov 7 20:49:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0E0A178767; Thu, 7 Nov 2019 20:49:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Fs15lDWz4K2j; Thu, 7 Nov 2019 20:49:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A855C1B885; Thu, 7 Nov 2019 20:49:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Knv1k072526; Thu, 7 Nov 2019 20:49:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Knu4I072521; Thu, 7 Nov 2019 20:49:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072049.xA7Knu4I072521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:49:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354477 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:49:57 -0000 Author: glebius Date: Thu Nov 7 20:49:56 2019 New Revision: 354477 URL: https://svnweb.freebsd.org/changeset/base/354477 Log: Since r353292 on input path we are always in network epoch, when we lookup PCBs. Thus, do not enter epoch recursively in in_pcblookup_hash() and in6_pcblookup_hash(). Same applies to tcp_ctlinput() and tcp6_ctlinput(). This leaves several sysctl(9) handlers that return PCB credentials unprotected. Add epoch enter/exit to all of them. Differential Revision: https://reviews.freebsd.org/D22197 Modified: head/sys/netinet/in_pcb.c head/sys/netinet/tcp_subr.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 7 20:44:34 2019 (r354476) +++ head/sys/netinet/in_pcb.c Thu Nov 7 20:49:56 2019 (r354477) @@ -2252,12 +2252,10 @@ in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, st struct inpcb *inp, *tmpinp; u_short fport = fport_arg, lport = lport_arg; -#ifdef INVARIANTS KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); - if (!mtx_owned(&pcbinfo->ipi_hash_lock)) - MPASS(in_epoch_verbose(net_epoch_preempt, 1)); -#endif + INP_HASH_LOCK_ASSERT(pcbinfo); + /* * First look for an exact match. */ @@ -2384,7 +2382,6 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in { struct inpcb *inp; - INP_HASH_RLOCK(pcbinfo); inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { @@ -2411,7 +2408,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in } #endif } - INP_HASH_RUNLOCK(pcbinfo); + return (inp); } Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Nov 7 20:44:34 2019 (r354476) +++ head/sys/netinet/tcp_subr.c Thu Nov 7 20:49:56 2019 (r354477) @@ -2257,6 +2257,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in addrs[2]; + struct epoch_tracker et; struct inpcb *inp; int error; @@ -2266,8 +2267,10 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); + NET_EPOCH_ENTER(et); inp = in_pcblookup(&V_tcbinfo, addrs[1].sin_addr, addrs[1].sin_port, addrs[0].sin_addr, addrs[0].sin_port, INPLOOKUP_RLOCKPCB, NULL); + NET_EPOCH_EXIT(et); if (inp != NULL) { if (inp->inp_socket == NULL) error = ENOENT; @@ -2292,6 +2295,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, getcred, static int tcp6_getcred(SYSCTL_HANDLER_ARGS) { + struct epoch_tracker et; struct xucred xuc; struct sockaddr_in6 addrs[2]; struct inpcb *inp; @@ -2319,6 +2323,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) return (EINVAL); } + NET_EPOCH_ENTER(et); #ifdef INET if (mapped == 1) inp = in_pcblookup(&V_tcbinfo, @@ -2332,6 +2337,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) &addrs[1].sin6_addr, addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, INPLOOKUP_RLOCKPCB, NULL); + NET_EPOCH_EXIT(et); if (inp != NULL) { if (inp->inp_socket == NULL) error = ENOENT; @@ -2365,7 +2371,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip) struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify; struct icmp *icp; struct in_conninfo inc; - struct epoch_tracker et; tcp_seq icmp_tcp_seq; int mtu; @@ -2397,7 +2402,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip) icp = (struct icmp *)((caddr_t)ip - offsetof(struct icmp, icmp_ip)); th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2)); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); inp = in_pcblookup(&V_tcbinfo, faddr, th->th_dport, ip->ip_src, th->th_sport, INPLOOKUP_WLOCKPCB, NULL); if (inp != NULL && PRC_IS_REDIRECT(cmd)) { @@ -2462,7 +2466,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip) out: if (inp != NULL) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); } #endif /* INET */ @@ -2480,7 +2483,6 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d) struct ip6ctlparam *ip6cp = NULL; const struct sockaddr_in6 *sa6_src = NULL; struct in_conninfo inc; - struct epoch_tracker et; struct tcp_ports { uint16_t th_sport; uint16_t th_dport; @@ -2542,7 +2544,6 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d) } bzero(&t_ports, sizeof(struct tcp_ports)); m_copydata(m, off, sizeof(struct tcp_ports), (caddr_t)&t_ports); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_dst, t_ports.th_dport, &ip6->ip6_src, t_ports.th_sport, INPLOOKUP_WLOCKPCB, NULL); if (inp != NULL && PRC_IS_REDIRECT(cmd)) { @@ -2614,7 +2615,6 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d) out: if (inp != NULL) INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); } #endif /* INET6 */ Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Nov 7 20:44:34 2019 (r354476) +++ head/sys/netinet/udp_usrreq.c Thu Nov 7 20:49:56 2019 (r354477) @@ -963,6 +963,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in addrs[2]; + struct epoch_tracker et; struct inpcb *inp; int error; @@ -972,9 +973,11 @@ udp_getcred(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); + NET_EPOCH_ENTER(et); inp = in_pcblookup(&V_udbinfo, addrs[1].sin_addr, addrs[1].sin_port, addrs[0].sin_addr, addrs[0].sin_port, INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL); + NET_EPOCH_EXIT(et); if (inp != NULL) { INP_RLOCK_ASSERT(inp); if (inp->inp_socket == NULL) Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Thu Nov 7 20:44:34 2019 (r354476) +++ head/sys/netinet6/in6_pcb.c Thu Nov 7 20:49:56 2019 (r354477) @@ -1245,7 +1245,6 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct i { struct inpcb *inp; - INP_HASH_RLOCK(pcbinfo); inp = in6_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport, (lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp); if (inp != NULL) { @@ -1272,7 +1271,6 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, struct i } #endif } - INP_HASH_RUNLOCK(pcbinfo); return (inp); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Nov 7 20:44:34 2019 (r354476) +++ head/sys/netinet6/udp6_usrreq.c Thu Nov 7 20:49:56 2019 (r354477) @@ -634,6 +634,7 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in6 addrs[2]; + struct epoch_tracker et; struct inpcb *inp; int error; @@ -652,9 +653,11 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { return (error); } + NET_EPOCH_ENTER(et); inp = in6_pcblookup(&V_udbinfo, &addrs[1].sin6_addr, addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL); + NET_EPOCH_EXIT(et); if (inp != NULL) { INP_RLOCK_ASSERT(inp); if (inp->inp_socket == NULL) From owner-svn-src-all@freebsd.org Thu Nov 7 20:50:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24827178A4D; Thu, 7 Nov 2019 20:50:38 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Fsn2ZQbz4KL5; Thu, 7 Nov 2019 20:50:36 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xA7KoYne059384 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 7 Nov 2019 12:50:35 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xA7KoYav059383; Thu, 7 Nov 2019 12:50:34 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 7 Nov 2019 12:50:34 -0800 From: Gleb Smirnoff To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354477 - in head/sys: netinet netinet6 Message-ID: <20191107205034.GQ2195@FreeBSD.org> References: <201911072049.xA7Knu4I072521@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911072049.xA7Knu4I072521@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 478Fsn2ZQbz4KL5 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.94 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.95)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:50:38 -0000 On Thu, Nov 07, 2019 at 08:49:56PM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Thu Nov 7 20:49:56 2019 T> New Revision: 354477 T> URL: https://svnweb.freebsd.org/changeset/base/354477 T> T> Log: T> Since r353292 on input path we are always in network epoch, when T> we lookup PCBs. Thus, do not enter epoch recursively in T> in_pcblookup_hash() and in6_pcblookup_hash(). Same applies to T> tcp_ctlinput() and tcp6_ctlinput(). T> T> This leaves several sysctl(9) handlers that return PCB credentials T> unprotected. Add epoch enter/exit to all of them. T> T> Differential Revision: https://reviews.freebsd.org/D22197 Note: only this commit references the differential revision, as it is the core change. But preceeding commits and following commits related to PCB locking were all part of this review. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Thu Nov 7 20:57:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C9DD179039; Thu, 7 Nov 2019 20:57:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478G280NkQz4L79; Thu, 7 Nov 2019 20:57:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5DF31BA89; Thu, 7 Nov 2019 20:57:51 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7KvpZO078285; Thu, 7 Nov 2019 20:57:51 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7KvpMt078284; Thu, 7 Nov 2019 20:57:51 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072057.xA7KvpMt078284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 20:57:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354478 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 20:57:52 -0000 Author: glebius Date: Thu Nov 7 20:57:51 2019 New Revision: 354478 URL: https://svnweb.freebsd.org/changeset/base/354478 Log: Add INP_UNLOCK() which will do whatever R/W unlock is required. Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu Nov 7 20:49:56 2019 (r354477) +++ head/sys/netinet/in_pcb.h Thu Nov 7 20:57:51 2019 (r354478) @@ -586,6 +586,7 @@ struct inpcblbgroup { #define INP_TRY_WLOCK(inp) rw_try_wlock(&(inp)->inp_lock) #define INP_RUNLOCK(inp) rw_runlock(&(inp)->inp_lock) #define INP_WUNLOCK(inp) rw_wunlock(&(inp)->inp_lock) +#define INP_UNLOCK(inp) rw_unlock(&(inp)->inp_lock) #define INP_TRY_UPGRADE(inp) rw_try_upgrade(&(inp)->inp_lock) #define INP_DOWNGRADE(inp) rw_downgrade(&(inp)->inp_lock) #define INP_WLOCKED(inp) rw_wowned(&(inp)->inp_lock) From owner-svn-src-all@freebsd.org Thu Nov 7 21:01:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54F6A1793CA; Thu, 7 Nov 2019 21:01:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478G6T2F9Mz4LVw; Thu, 7 Nov 2019 21:01:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16A9F1BBEF; Thu, 7 Nov 2019 21:01:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7L1arP078554; Thu, 7 Nov 2019 21:01:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7L1a9t078550; Thu, 7 Nov 2019 21:01:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072101.xA7L1a9t078550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354479 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:01:37 -0000 Author: glebius Date: Thu Nov 7 21:01:36 2019 New Revision: 354479 URL: https://svnweb.freebsd.org/changeset/base/354479 Log: Now with epoch synchronized PCB lookup tables we can greatly simplify locking in udp_output() and udp6_output(). First, we select if we need read or write lock in PCB itself, we take the lock and enter network epoch. Then, we proceed for the rest of the function. In case if we need to modify PCB hash, we would take write lock on it for a short piece of code. We could exit the epoch before allocating an mbuf, but with this patch we are keeping it all the way into ip_output()/ip6_output(). Today this creates an epoch recursion, since ip_output() enters epoch itself. However, once all protocols are reviewed, ip_output() and ip6_output() would require epoch instead of entering it. Note: I'm not 100% sure that in udp6_output() the epoch is required. We don't do PCB hash lookup for a bound socket. And all branches of in6_select_src() don't require epoch, at least they lack assertions. Today inet6 address list is protected by rmlock, although it is CKLIST. AFAIU, the future plan is to protect it by network epoch. That would require epoch in in6_select_src(). Anyway, in future ip6_output() would require epoch, udp6_output() would need to enter it. Modified: head/sys/netinet/udp_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Nov 7 20:57:51 2019 (r354478) +++ head/sys/netinet/udp_usrreq.c Thu Nov 7 21:01:36 2019 (r354479) @@ -1118,9 +1118,6 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt) } #ifdef INET -#define UH_WLOCKED 2 -#define UH_RLOCKED 1 -#define UH_UNLOCKED 0 static int udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) @@ -1136,19 +1133,12 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s int error = 0; int ipflags; u_short fport, lport; - int unlock_udbinfo, unlock_inp; u_char tos; uint8_t pr; uint16_t cscov = 0; uint32_t flowid = 0; uint8_t flowtype = M_HASHTYPE_NONE; - /* - * udp_output() may need to temporarily bind or connect the current - * inpcb. As such, we don't know up front whether we will need the - * pcbinfo lock or not. Do any work to decide what is needed up - * front before acquiring any locks. - */ if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) { if (control) m_freem(control); @@ -1158,28 +1148,22 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s src.sin_family = 0; sin = (struct sockaddr_in *)addr; -retry: + + /* + * udp_output() may need to temporarily bind or connect the current + * inpcb. As such, we don't know up front whether we will need the + * pcbinfo lock or not. Do any work to decide what is needed up + * front before acquiring any locks. + * + * We will need network epoch in either case, to safely lookup into + * pcb hash. + */ if (sin == NULL || - (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) { + (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) INP_WLOCK(inp); - /* - * In case we lost a race and another thread bound addr/port - * on the inp we cannot keep the wlock (which still would be - * fine) as further down, based on these values we make - * decisions for the pcbinfo lock. If the locks are not in - * synch the assertions on unlock will fire, hence we go for - * one retry loop. - */ - if (sin != NULL && (inp->inp_laddr.s_addr != INADDR_ANY || - inp->inp_lport != 0)) { - INP_WUNLOCK(inp); - goto retry; - } - unlock_inp = UH_WLOCKED; - } else { + else INP_RLOCK(inp); - unlock_inp = UH_RLOCKED; - } + NET_EPOCH_ENTER(et); tos = inp->inp_ip_tos; if (control != NULL) { /* @@ -1187,13 +1171,9 @@ retry: * stored in a single mbuf. */ if (control->m_next) { - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); m_freem(control); - m_freem(m); - return (EINVAL); + error = EINVAL; + goto release; } for (; control->m_len > 0; control->m_data += CMSG_ALIGN(cm->cmsg_len), @@ -1264,56 +1244,11 @@ retry: } m_freem(control); } - if (error) { - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); - m_freem(m); - return (error); - } + if (error) + goto release; - /* - * In the old days, depending on whether or not the application had - * bound or connected the socket, we had to do varying levels of work. - * The optimal case was for a connected UDP socket, as a global lock - * wasn't required at all. - * In order to decide which we need, we required stability of the - * inpcb binding, which we ensured by acquiring a read lock on the - * inpcb. This didn't strictly follow the lock order, so we played - * the trylock and retry game. - * With the re-introduction of the route-cache in some cases, we started - * to acquire an early inp wlock and a possible race during re-lock - * went away. With the introduction of epoch(9) some read locking - * became epoch(9) and the lock-order issues also went away. - * Due to route-cache we may now hold more conservative locks than - * otherwise required and have split up the 2nd case in case 2 and 3 - * in order to keep the udpinfo lock level in sync with the inp one - * for the IP_SENDSRCADDR case below. - */ pr = inp->inp_socket->so_proto->pr_protocol; pcbinfo = udp_get_inpcbinfo(pr); - if (sin != NULL && - (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) { - INP_HASH_WLOCK(pcbinfo); - unlock_udbinfo = UH_WLOCKED; - } else if (sin != NULL && - (sin->sin_addr.s_addr == INADDR_ANY || - sin->sin_addr.s_addr == INADDR_BROADCAST || - inp->inp_laddr.s_addr == INADDR_ANY || - inp->inp_lport == 0)) { - INP_HASH_RLOCK_ET(pcbinfo, et); - unlock_udbinfo = UH_RLOCKED; - } else if (src.sin_family == AF_INET) { - if (unlock_inp == UH_WLOCKED) { - INP_HASH_WLOCK(pcbinfo); - unlock_udbinfo = UH_WLOCKED; - } else { - INP_HASH_RLOCK_ET(pcbinfo, et); - unlock_udbinfo = UH_RLOCKED; - } - } else - unlock_udbinfo = UH_UNLOCKED; /* * If the IP_SENDSRCADDR control message was specified, override the @@ -1389,7 +1324,6 @@ retry: if (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0) { INP_WLOCK_ASSERT(inp); - INP_HASH_WLOCK_ASSERT(pcbinfo); /* * Remember addr if jailed, to prevent * rebinding. @@ -1397,7 +1331,10 @@ retry: if (prison_flag(td->td_ucred, PR_IP4)) inp->inp_laddr = laddr; inp->inp_lport = lport; - if (in_pcbinshash(inp) != 0) { + INP_HASH_WLOCK(pcbinfo); + error = in_pcbinshash(inp); + INP_HASH_WUNLOCK(pcbinfo); + if (error != 0) { inp->inp_lport = 0; error = EAGAIN; goto release; @@ -1562,48 +1499,20 @@ retry: ipflags |= IP_NODEFAULTFLOWID; #endif /* RSS */ - if (unlock_udbinfo == UH_WLOCKED) - INP_HASH_WUNLOCK(pcbinfo); - else if (unlock_udbinfo == UH_RLOCKED) - INP_HASH_RUNLOCK_ET(pcbinfo, et); if (pr == IPPROTO_UDPLITE) UDPLITE_PROBE(send, NULL, inp, &ui->ui_i, inp, &ui->ui_u); else UDP_PROBE(send, NULL, inp, &ui->ui_i, inp, &ui->ui_u); error = ip_output(m, inp->inp_options, - (unlock_inp == UH_WLOCKED ? &inp->inp_route : NULL), ipflags, + INP_WLOCKED(inp) ? &inp->inp_route : NULL, ipflags, inp->inp_moptions, inp); - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); + NET_EPOCH_EXIT(et); return (error); release: - if (unlock_udbinfo == UH_WLOCKED) { - KASSERT(unlock_inp == UH_WLOCKED, - ("%s: excl udbinfo lock %#03x, shared inp lock %#03x, " - "sin %p daddr %#010x inp %p laddr %#010x lport %#06x " - "src fam %#04x", - __func__, unlock_udbinfo, unlock_inp, sin, - (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp, - inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family)); - INP_HASH_WUNLOCK(pcbinfo); - INP_WUNLOCK(inp); - } else if (unlock_udbinfo == UH_RLOCKED) { - KASSERT(unlock_inp == UH_RLOCKED, - ("%s: shared udbinfo lock %#03x, excl inp lock %#03x, " - "sin %p daddr %#010x inp %p laddr %#010x lport %#06x " - "src fam %#04x", - __func__, unlock_udbinfo, unlock_inp, sin, - (sin != NULL) ? sin->sin_addr.s_addr : 0xfefefefe, inp, - inp->inp_laddr.s_addr, inp->inp_lport, src.sin_family)); - INP_HASH_RUNLOCK_ET(pcbinfo, et); - INP_RUNLOCK(inp); - } else if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); + NET_EPOCH_EXIT(et); m_freem(m); return (error); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Nov 7 20:57:51 2019 (r354478) +++ head/sys/netinet6/udp6_usrreq.c Thu Nov 7 21:01:36 2019 (r354479) @@ -678,14 +678,10 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_net_inet6_udp6, OID_AUTO, getcred, CTLTYPE_OPAQUE|CTLFLAG_RW, 0, 0, udp6_getcred, "S,xucred", "Get the xucred of a UDP6 connection"); -#define UH_WLOCKED 2 -#define UH_RLOCKED 1 -#define UH_UNLOCKED 0 static int udp6_output(struct socket *so, int flags_arg, struct mbuf *m, struct sockaddr *addr6, struct mbuf *control, struct thread *td) { - struct inpcbinfo *pcbinfo; struct inpcb *inp; struct ip6_hdr *ip6; struct udphdr *udp6; @@ -697,7 +693,7 @@ udp6_output(struct socket *so, int flags_arg, struct m u_int32_t ulen, plen; uint16_t cscov; u_short fport; - uint8_t nxt, unlock_inp, unlock_udbinfo; + uint8_t nxt; /* addr6 has been validated in udp6_send(). */ sin6 = (struct sockaddr_in6 *)addr6; @@ -740,30 +736,17 @@ udp6_output(struct socket *so, int flags_arg, struct m * - on connected sockets (sin6 is NULL) for route cache updates, * - when we are not bound to an address and source port (it is * in6_pcbsetport() which will require the write lock). + * + * We check the inp fields before actually locking the inp, so + * here exists a race, and we may WLOCK the inp and end with already + * bound one by other thread. This is fine. */ -retry: if (sin6 == NULL || (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && - inp->inp_lport == 0)) { + inp->inp_lport == 0)) INP_WLOCK(inp); - /* - * In case we lost a race and another thread bound addr/port - * on the inp we cannot keep the wlock (which still would be - * fine) as further down, based on these values we make - * decisions for the pcbinfo lock. If the locks are not in - * synch the assertions on unlock will fire, hence we go for - * one retry loop. - */ - if (sin6 != NULL && - (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) || - inp->inp_lport != 0)) { - INP_WUNLOCK(inp); - goto retry; - } - unlock_inp = UH_WLOCKED; - } else { + else INP_RLOCK(inp); - unlock_inp = UH_RLOCKED; - } + nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ? IPPROTO_UDP : IPPROTO_UDPLITE; @@ -787,10 +770,7 @@ retry: * potential race in which the factors causing us to * select the UDPv4 output routine are invalidated? */ - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); if (sin6) in6_sin6_2_sin_in_sock((struct sockaddr *)sin6); pru = inetsw[ip_protox[nxt]].pr_usrreqs; @@ -805,21 +785,17 @@ retry: * Given this is either an IPv6-only socket or no INET is * supported we will fail the send if the given destination * address is a v4mapped address. + * + * XXXGL: do we leak m and control? */ - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); return (EINVAL); } if (control) { if ((error = ip6_setpktopts(control, &opt, inp->in6p_outputopts, td->td_ucred, nxt)) != 0) { - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); ip6_clearpktopts(&opt, -1); if (control) m_freem(control); @@ -830,20 +806,7 @@ retry: } else optp = inp->in6p_outputopts; - pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); - if (sin6 != NULL && - IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && inp->inp_lport == 0) { - INP_HASH_WLOCK(pcbinfo); - unlock_udbinfo = UH_WLOCKED; - } else if (sin6 != NULL && - (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) || - IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) || - inp->inp_lport == 0)) { - INP_HASH_RLOCK_ET(pcbinfo, et); - unlock_udbinfo = UH_RLOCKED; - } else - unlock_udbinfo = UH_UNLOCKED; - + NET_EPOCH_ENTER(et); if (sin6) { /* @@ -879,9 +842,14 @@ retry: laddr = &in6a; if (inp->inp_lport == 0) { + struct inpcbinfo *pcbinfo; INP_WLOCK_ASSERT(inp); + + pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); + INP_HASH_WLOCK(pcbinfo); error = in6_pcbsetport(laddr, inp, td->td_ucred); + INP_HASH_WUNLOCK(pcbinfo); if (error != 0) { /* Undo an address bind that may have occurred. */ inp->in6p_laddr = in6addr_any; @@ -1005,21 +973,15 @@ retry: #endif UDPSTAT_INC(udps_opackets); - if (unlock_udbinfo == UH_WLOCKED) - INP_HASH_WUNLOCK(pcbinfo); - else if (unlock_udbinfo == UH_RLOCKED) - INP_HASH_RUNLOCK_ET(pcbinfo, et); if (nxt == IPPROTO_UDPLITE) UDPLITE_PROBE(send, NULL, inp, ip6, inp, udp6); else UDP_PROBE(send, NULL, inp, ip6, inp, udp6); error = ip6_output(m, optp, - (unlock_inp == UH_WLOCKED) ? &inp->inp_route6 : NULL, flags, + INP_WLOCKED(inp) ? &inp->inp_route6 : NULL, flags, inp->in6p_moptions, NULL, inp); - if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); + NET_EPOCH_EXIT(et); if (control) { ip6_clearpktopts(&opt, -1); @@ -1028,22 +990,8 @@ retry: return (error); release: - if (unlock_udbinfo == UH_WLOCKED) { - KASSERT(unlock_inp == UH_WLOCKED, ("%s: excl udbinfo lock, " - "non-excl inp lock: pcbinfo %p %#x inp %p %#x", - __func__, pcbinfo, unlock_udbinfo, inp, unlock_inp)); - INP_HASH_WUNLOCK(pcbinfo); - INP_WUNLOCK(inp); - } else if (unlock_udbinfo == UH_RLOCKED) { - KASSERT(unlock_inp == UH_RLOCKED, ("%s: non-excl udbinfo lock, " - "excl inp lock: pcbinfo %p %#x inp %p %#x", - __func__, pcbinfo, unlock_udbinfo, inp, unlock_inp)); - INP_HASH_RUNLOCK_ET(pcbinfo, et); - INP_RUNLOCK(inp); - } else if (unlock_inp == UH_WLOCKED) - INP_WUNLOCK(inp); - else - INP_RUNLOCK(inp); + INP_UNLOCK(inp); + NET_EPOCH_EXIT(et); if (control) { ip6_clearpktopts(&opt, -1); m_freem(control); From owner-svn-src-all@freebsd.org Thu Nov 7 21:03:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BF97179524; Thu, 7 Nov 2019 21:03:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478G8N39FBz4Lk7; Thu, 7 Nov 2019 21:03:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5056A1BC49; Thu, 7 Nov 2019 21:03:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7L3GCb084467; Thu, 7 Nov 2019 21:03:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7L3GQw084466; Thu, 7 Nov 2019 21:03:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072103.xA7L3GQw084466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354480 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:03:16 -0000 Author: glebius Date: Thu Nov 7 21:03:15 2019 New Revision: 354480 URL: https://svnweb.freebsd.org/changeset/base/354480 Log: Remove now unused INP_HASH_RLOCK() macros. Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu Nov 7 21:01:36 2019 (r354479) +++ head/sys/netinet/in_pcb.h Thu Nov 7 21:03:15 2019 (r354480) @@ -664,11 +664,7 @@ int inp_so_options(const struct inpcb *inp); #define INP_HASH_LOCK_INIT(ipi, d) mtx_init(&(ipi)->ipi_hash_lock, (d), NULL, MTX_DEF) #define INP_HASH_LOCK_DESTROY(ipi) mtx_destroy(&(ipi)->ipi_hash_lock) -#define INP_HASH_RLOCK(ipi) struct epoch_tracker inp_hash_et; epoch_enter_preempt(net_epoch_preempt, &inp_hash_et) -#define INP_HASH_RLOCK_ET(ipi, et) epoch_enter_preempt(net_epoch_preempt, &(et)) #define INP_HASH_WLOCK(ipi) mtx_lock(&(ipi)->ipi_hash_lock) -#define INP_HASH_RUNLOCK(ipi) NET_EPOCH_EXIT(inp_hash_et) -#define INP_HASH_RUNLOCK_ET(ipi, et) NET_EPOCH_EXIT((et)) #define INP_HASH_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_hash_lock) #define INP_HASH_LOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_hash_lock)) #define INP_HASH_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_hash_lock, MA_OWNED); From owner-svn-src-all@freebsd.org Thu Nov 7 21:08:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 711C6179735; Thu, 7 Nov 2019 21:08:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478GGp2HjZz4M1v; Thu, 7 Nov 2019 21:08:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32EB81BC51; Thu, 7 Nov 2019 21:08:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7L8nV7084905; Thu, 7 Nov 2019 21:08:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7L8n3q084904; Thu, 7 Nov 2019 21:08:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072108.xA7L8n3q084904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354481 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:08:50 -0000 Author: glebius Date: Thu Nov 7 21:08:49 2019 New Revision: 354481 URL: https://svnweb.freebsd.org/changeset/base/354481 Log: Remove unnecessary recursive epoch enter via INP_INFO_RLOCK macro in udp_input(). It shall always run in the network epoch. Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Nov 7 21:03:15 2019 (r354480) +++ head/sys/netinet/udp_usrreq.c Thu Nov 7 21:08:49 2019 (r354481) @@ -399,7 +399,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) struct sockaddr_in udp_in[2]; struct mbuf *m; struct m_tag *fwd_tag; - struct epoch_tracker et; int cscov_partial, iphlen; m = *mp; @@ -528,7 +527,8 @@ udp_input(struct mbuf **mp, int *offp, int proto) struct inpcb *last; struct inpcbhead *pcblist; - INP_INFO_RLOCK_ET(pcbinfo, et); + NET_EPOCH_ASSERT(); + pcblist = udp_get_pcblist(proto); last = NULL; CK_LIST_FOREACH(inp, pcblist, inp_list) { @@ -635,7 +635,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) UDPSTAT_INC(udps_noportbcast); if (inp) INP_RUNLOCK(inp); - INP_INFO_RUNLOCK_ET(pcbinfo, et); goto badunlocked; } if (proto == IPPROTO_UDPLITE) @@ -645,7 +644,6 @@ udp_input(struct mbuf **mp, int *offp, int proto) if (udp_append(last, ip, m, iphlen, udp_in) == 0) INP_RUNLOCK(last); inp_lost: - INP_INFO_RUNLOCK_ET(pcbinfo, et); return (IPPROTO_DONE); } From owner-svn-src-all@freebsd.org Thu Nov 7 21:15:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DC941799FA; Thu, 7 Nov 2019 21:15:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478GPv7560z4MSj; Thu, 7 Nov 2019 21:14:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D68D91BE0F; Thu, 7 Nov 2019 21:14:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LExbH090363; Thu, 7 Nov 2019 21:14:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LExVP090362; Thu, 7 Nov 2019 21:14:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911072114.xA7LExVP090362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 21:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354482 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:15:00 -0000 Author: avg Date: Thu Nov 7 21:14:59 2019 New Revision: 354482 URL: https://svnweb.freebsd.org/changeset/base/354482 Log: IPI_TRACE is not really supported on xen x86 stack_save_td_running() can work safely only if IPI_TRACE is a non-maskable interrupt. But at the moment FreeBSD/Xen does not provide support for the NMI delivery mode. So, mark the functionality as unsupported similarly to other platforms without NMI. Maybe there is a way to provide a Xen-specific working stack_save_td_running(), but I couldn't figure it out. MFC after: 3 weeks Sponsored by: Panzura Modified: head/sys/x86/x86/stack_machdep.c Modified: head/sys/x86/x86/stack_machdep.c ============================================================================== --- head/sys/x86/x86/stack_machdep.c Thu Nov 7 21:08:49 2019 (r354481) +++ head/sys/x86/x86/stack_machdep.c Thu Nov 7 21:14:59 2019 (r354482) @@ -135,6 +135,13 @@ int stack_save_td_running(struct stack *st, struct thread *td) { +#ifdef XENHVM + /* + * There is no NMI support on Xen, so this code can lead to + * an inter-processor deadlock. + */ + return (EOPNOTSUPP); +#endif /* XENHVM */ #ifdef STACK THREAD_LOCK_ASSERT(td, MA_OWNED); MPASS(TD_IS_RUNNING(td)); From owner-svn-src-all@freebsd.org Thu Nov 7 21:19:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D39D4179B3B for ; Thu, 7 Nov 2019 21:19:11 +0000 (UTC) (envelope-from 0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com) Received: from a8-176.smtp-out.amazonses.com (a8-176.smtp-out.amazonses.com [54.240.8.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 478GVl15Gfz4Mf4 for ; Thu, 7 Nov 2019 21:19:11 +0000 (UTC) (envelope-from 0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1573161549; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=CK+Cxk2dV2kwTecnNi+A6MqhrEQ4gG9hYoSNb54O5WQ=; b=DISp0PZ2Yz1sB1KtcPQhgddwmgvA2DqfVMvDjAL4NeU+hQ51DlF7McLYHdXtLZkT WomAfYYEMlgWAKMLWeCM5x4Y4HhElKm6X3AubQM186bbX+sDf4bZkrZyrqJfkQdIymD Rus+VE2a3k+7ntqylgDVpwuUM7DOJ0RoQCwDscmQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1573161549; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=CK+Cxk2dV2kwTecnNi+A6MqhrEQ4gG9hYoSNb54O5WQ=; b=cd6pSc+11PxqYzA4DeoGqS/dV4ofE4HPaS3vFWweTmsXQHOdtP3wp2fR6/ewzUif qRRQElEZ3sW4EoiW+JBapQnvj37dh6cLzYrjoh+ew0h+JsiJUnrbIClGi7JlnBB2ANQ dpITs4mAzGbGdAw7Q/2W9VLN9vle5xFLSaMQJ7fU= Subject: Re: svn commit: r354482 - head/sys/x86/x86 To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911072114.xA7LExVP090362@repo.freebsd.org> From: Colin Percival Autocrypt: addr=cperciva@tarsnap.com; prefer-encrypt=mutual; keydata= mQGhBElrAAcRBACDfDys4ZtK+ErCJ1HAzYeteKpm3OEsvT/49AjUTLihkF79HhIKrCQU+1KC zv7BwHCMLb6hq30As9L7iFKG7n5QFLFC4Te/VcITUnWHMG/c3ViLOfJGvi+9/nOEHaM1dVJY D6tEp5yM1nHmVQpo9932j4KGuGFR0LhOK5IHXOSfGwCgxSFDPdgxe2OEjWxjGgY+oV3EafcD +JROXCTjlcQiG/OguQH4Vks3mhHfFnEppLxTkDuYgHZQiUtpcT9ssH5khgqoTyMar05OUdAj ZIhNbWDh4LgTj+7ZmvLhXT5Zxw8LX9d7T36aTB8XDQSenDqEtinMWOb0TCBBLbsB8EFG1WTT ESbZci9jJS5yhtktuZoY/eM8uXMD/3k4FWFO80VRRkELSp+XSy/VlSQjyi/rhl2nQq/oOA9F oJbDaB0yq9VNhxP+uFBzBWSqeIX0t1ZWLtNfVFr4TRP5hihI5ICrg/0OpqgisKsU2NFe9xyO hyJLYmfD8ebpDJ/9k30C7Iju9pVrwLm1QgS4S2fqJRcR+U4WbjvP7CgStCVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+iGEEExECACEFAklrALYCGwMHCwkIBwMCAQQV AggDBBYCAwECHgECF4AACgkQOM7KaQxqam6/igCgn+z2k3V5ggNppmWrZstt1U2lugsAoL7L wS9V9yLtil3oWmHtwpUqYruEuQINBElrAAcQCAD3ZLMIsP4CIDoJORg+YY0lqLVBgcnF7pFb 4Uy2+KvdWofN+DKH61rZLjgXXkNE9M4EQC1B4lGttBP8IY2gs41y3AUogGdyFbidq99rCBz7 LTsgARHwFxZoaHmXyiZLEU1QZuMqwPZV1mCviRhN5E3rRqYNXVcrnXAAuhBpvNyj/ntHvcDN 2/m+ochiuBYueU4kX3lHya7sOj+mTsndcWmQ9soOUyr8O0r/BG088bMn4qqtUw4dl5/pglXk jbl7uOOPinKf0WVd2r6M0wLPJCD4NPHrCWRLLLAjwfjrtoSRvXxDbXhCdgGBa72+K8eYLzVs hgq7tJOoBWzjVK6XRxR7AAMGB/9Mo3iJ2DxqDecd02KCB5BsFDICbJGhPltU7FwrtbC7djSb XUrwsEVLHi4st4cbdGNCWCrp0BRezXZKohKnNAPFOTK++ZfgeKxrV2sJod+Q9RILF86tQ4XF 7A7Yme5hy92t/WgiU4vc/fWbgP8gV/19f8nunaT2E9NSa70mZFjZNu4iuwThoUUO5CV3Wo0Y UISsnRK8XD1+LR3A2qVyLiFRwh/miC1hgLFCTGCQ3GLxZeZzIpYSlGdQJ0L5lixW5ZQD9r1I 8i/8zhE6qRFAM0upUMI3Gt1Oq2w03DiXrZU0Fu/R8Rm8rlnkQKA+95mRTUq1xL5P5NZIi4gJ Z569OPMFiEkEGBECAAkFAklrAAcCGwwACgkQOM7KaQxqam41igCfbaldnFTu5uAdrnrghESv EI3CAo8AoLkNMks1pThl2BJNRm4CtTK9xZeH Message-ID: <0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@email.amazonses.com> Date: Thu, 7 Nov 2019 21:19:09 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <201911072114.xA7LExVP090362@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2019.11.07-54.240.8.176 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 478GVl15Gfz4Mf4 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57 header.b=DISp0PZ2; dkim=pass header.d=amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=cd6pSc+1; dmarc=none; spf=pass (mx1.freebsd.org: domain of 0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com designates 54.240.8.176 as permitted sender) smtp.mailfrom=0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com X-Spamd-Result: default: False [-1.79 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57,amazonses.com:s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tarsnap.com]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; RCVD_IN_DNSWL_NONE(0.00)[176.8.240.54.list.dnswl.org : 127.0.15.0]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.09)[ip: (-2.48), ipnet: 54.240.8.0/21(-4.61), asn: 14618(-3.30), country: US(-0.05)]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com,0100016e47bc3ddb-c238c572-cd8d-4aae-8067-eb1cf1c11f42-000000@amazonses.com]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:19:11 -0000 On 2019-11-07 13:14, Andriy Gapon wrote: > x86 stack_save_td_running() can work safely only if IPI_TRACE is a > non-maskable interrupt. But at the moment FreeBSD/Xen does not provide > support for the NMI delivery mode. So, mark the functionality as > unsupported similarly to other platforms without NMI. > [...] > +#ifdef XENHVM I'm not sure this does what you intended. XENHVM simply adds *support* for running under Xen/HVM, and it's part of the GENERIC kernel. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Thu Nov 7 21:23:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 980FC179F6B; Thu, 7 Nov 2019 21:23:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478GbJ4Cdlz4NBq; Thu, 7 Nov 2019 21:23:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73BAD1BFE5; Thu, 7 Nov 2019 21:23:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LN845096133; Thu, 7 Nov 2019 21:23:08 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LN7MA096129; Thu, 7 Nov 2019 21:23:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072123.xA7LN7MA096129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354483 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 354483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:23:08 -0000 Author: glebius Date: Thu Nov 7 21:23:07 2019 New Revision: 354483 URL: https://svnweb.freebsd.org/changeset/base/354483 Log: Now that all of the tcp_input() and all its branches are executed in the network epoch, we can greatly simplify synchronization. Remove all unneccesary epoch enters hidden under INP_INFO_RLOCK macro. Remove some unneccesary assertions and convert necessary ones into the NET_EPOCH_ASSERT macro. Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/rack_bbr_common.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 7 21:14:59 2019 (r354482) +++ head/sys/netinet/tcp_input.c Thu Nov 7 21:23:07 2019 (r354483) @@ -561,7 +561,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto) int rstreason = 0; /* For badport_bandlim accounting purposes */ uint8_t iptos; struct m_tag *fwd_tag = NULL; - struct epoch_tracker et; #ifdef INET6 struct ip6_hdr *ip6 = NULL; int isipv6; @@ -570,7 +569,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto) #endif /* INET6 */ struct tcpopt to; /* options in this segment */ char *s = NULL; /* address and port logging */ - int ti_locked; #ifdef TCPDEBUG /* * The size of tcp_saveipgen must be the size of the max ip header, @@ -581,6 +579,8 @@ tcp_input(struct mbuf **mp, int *offp, int proto) short ostate = 0; #endif + NET_EPOCH_ASSERT(); + #ifdef INET6 isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; #endif @@ -747,19 +747,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto) drop_hdrlen = off0 + off; /* - * Locate pcb for segment; if we're likely to add or remove a - * connection then first acquire pcbinfo lock. There are three cases - * where we might discover later we need a write lock despite the - * flags: ACKs moving a connection out of the syncache, ACKs for a - * connection in TIMEWAIT and SYNs not targeting a listening socket. - */ - if ((thflags & (TH_FIN | TH_RST)) != 0) { - INP_INFO_RLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_RLOCKED; - } else - ti_locked = TI_UNLOCKED; - - /* * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */ if ( @@ -776,13 +763,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto) fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); findpcb: -#ifdef INVARIANTS - if (ti_locked == TI_RLOCKED) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } else { - INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); - } -#endif #ifdef INET6 if (isipv6 && fwd_tag != NULL) { struct sockaddr_in6 *next_hop6; @@ -942,12 +922,6 @@ findpcb: * XXXRW: It may be time to rethink timewait locking. */ if (inp->inp_flags & INP_TIMEWAIT) { - if (ti_locked == TI_UNLOCKED) { - INP_INFO_RLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_RLOCKED; - } - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - if (thflags & TH_SYN) tcp_dooptions(&to, optp, optlen, TO_SYN); /* @@ -955,7 +929,6 @@ findpcb: */ if (tcp_twcheck(inp, &to, th, m, tlen)) goto findpcb; - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); return (IPPROTO_DONE); } /* @@ -977,27 +950,6 @@ findpcb: } #endif - /* - * We've identified a valid inpcb, but it could be that we need an - * inpcbinfo write lock but don't hold it. In this case, attempt to - * acquire using the same strategy as the TIMEWAIT case above. If we - * relock, we have to jump back to 'relocked' as the connection might - * now be in TIMEWAIT. - */ -#ifdef INVARIANTS - if ((thflags & (TH_FIN | TH_RST)) != 0) - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); -#endif - if (!((tp->t_state == TCPS_ESTABLISHED && (thflags & TH_SYN) == 0) || - (tp->t_state == TCPS_LISTEN && (thflags & TH_SYN) && - !IS_FASTOPEN(tp->t_flags)))) { - if (ti_locked == TI_UNLOCKED) { - INP_INFO_RLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_RLOCKED; - } - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } - #ifdef MAC INP_WLOCK_ASSERT(inp); if (mac_inpcb_check_deliver(inp, m)) @@ -1052,7 +1004,6 @@ findpcb: */ if ((thflags & (TH_RST|TH_ACK|TH_SYN)) == TH_ACK) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* * Parse the TCP options here because * syncookies need access to the reflected @@ -1130,8 +1081,6 @@ tfo_socket_result: TCP_PROBE5(receive, NULL, tp, m, tp, th); tp->t_fb->tfb_tcp_do_segment(m, th, so, tp, drop_hdrlen, tlen, iptos); - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); return (IPPROTO_DONE); } /* @@ -1334,10 +1283,6 @@ tfo_socket_result: * Entry added to syncache and mbuf consumed. * Only the listen socket is unlocked by syncache_add(). */ - if (ti_locked == TI_RLOCKED) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_UNLOCKED; - } INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); return (IPPROTO_DONE); } else if (tp->t_state == TCPS_LISTEN) { @@ -1370,25 +1315,11 @@ tfo_socket_result: * the inpcb, and unlocks pcbinfo. */ tp->t_fb->tfb_tcp_do_segment(m, th, so, tp, drop_hdrlen, tlen, iptos); - if (ti_locked == TI_RLOCKED) - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); return (IPPROTO_DONE); dropwithreset: TCP_PROBE5(receive, NULL, tp, m, tp, th); - if (ti_locked == TI_RLOCKED) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_UNLOCKED; - } -#ifdef INVARIANTS - else { - KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset " - "ti_locked: %d", __func__, ti_locked)); - INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); - } -#endif - if (inp != NULL) { tcp_dropwithreset(m, th, tp, tlen, rstreason); INP_WUNLOCK(inp); @@ -1401,18 +1332,6 @@ dropunlock: if (m != NULL) TCP_PROBE5(receive, NULL, tp, m, tp, th); - if (ti_locked == TI_RLOCKED) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); - ti_locked = TI_UNLOCKED; - } -#ifdef INVARIANTS - else { - KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock " - "ti_locked: %d", __func__, ti_locked)); - INP_INFO_WUNLOCK_ASSERT(&V_tcbinfo); - } -#endif - if (inp != NULL) INP_WUNLOCK(inp); @@ -1501,7 +1420,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru struct mbuf *mfree; struct tcpopt to; int tfo_syn; - + #ifdef TCPDEBUG /* * The size of tcp_saveipgen must be the size of the max ip header, @@ -1516,16 +1435,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tp->sackhint.last_sack_ack = 0; sack_changed = 0; nsegs = max(1, m->m_pkthdr.lro_nsegs); - /* - * If this is either a state-changing packet or current state isn't - * established, we require a write lock on tcbinfo. Otherwise, we - * allow the tcbinfo to be in either alocked or unlocked, as the - * caller may have unnecessarily acquired a write lock due to a race. - */ - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tp->t_state != TCPS_ESTABLISHED) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } + + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(tp->t_inpcb); KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN", __func__)); @@ -2047,7 +1958,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tcp_state_change(tp, TCPS_SYN_RECEIVED); } - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(tp->t_inpcb); /* @@ -2120,7 +2030,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); KASSERT(tp->t_state != TCPS_SYN_SENT, ("%s: TH_RST for TCPS_SYN_SENT th %p tp %p", __func__, th, tp)); @@ -2163,8 +2072,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru */ if ((thflags & TH_SYN) && tp->t_state != TCPS_SYN_SENT && tp->t_state != TCPS_SYN_RECEIVED) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - TCPSTAT_INC(tcps_badsyn); if (V_tcp_insecure_syn && SEQ_GEQ(th->th_seq, tp->last_ack_sent) && @@ -2288,8 +2195,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru */ if ((so->so_state & SS_NOFDREF) && tp->t_state > TCPS_CLOSE_WAIT && tlen) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: %s: Received %d bytes of data " "after socket was closed, " @@ -2875,7 +2780,6 @@ process_ACK: */ case TCPS_CLOSING: if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tcp_twstart(tp); m_freem(m); return; @@ -2890,7 +2794,6 @@ process_ACK: */ case TCPS_LAST_ACK: if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tp = tcp_close(tp); goto drop; } @@ -3139,8 +3042,6 @@ dodata: /* XXX */ * standard timers. */ case TCPS_FIN_WAIT_2: - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - tcp_twstart(tp); return; } Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Thu Nov 7 21:14:59 2019 (r354482) +++ head/sys/netinet/tcp_stacks/bbr.c Thu Nov 7 21:23:07 2019 (r354483) @@ -8618,7 +8618,6 @@ dodata: /* XXX */ bbr->rc_timer_first = 1; bbr_timer_cancel(bbr, __LINE__, bbr->r_ctl.rc_rcvtime); - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(tp->t_inpcb); tcp_twstart(tp); return (1); @@ -9619,7 +9618,6 @@ bbr_check_data_after_close(struct mbuf *m, struct tcp_ struct tcpcb *tp, int32_t * tlen, struct tcphdr *th, struct socket *so) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); if (bbr->rc_allow_data_af_clo == 0) { close_now: tp = tcp_close(tp); @@ -9861,7 +9859,6 @@ bbr_do_closing(struct mbuf *m, struct tcphdr *th, stru return (ret_val); } if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tcp_twstart(tp); m_freem(m); return (1); @@ -9974,7 +9971,6 @@ bbr_do_lastack(struct mbuf *m, struct tcphdr *th, stru return (ret_val); } if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tp = tcp_close(tp); ctf_do_drop(m, tp); return (1); Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Nov 7 21:14:59 2019 (r354482) +++ head/sys/netinet/tcp_stacks/rack.c Thu Nov 7 21:23:07 2019 (r354483) @@ -5875,7 +5875,6 @@ dodata: /* XXX */ case TCPS_FIN_WAIT_2: rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__); - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tcp_twstart(tp); return (1); } @@ -6353,7 +6352,6 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st tp->t_flags |= (TF_ACKNOW | TF_NEEDSYN); tcp_state_change(tp, TCPS_SYN_RECEIVED); } - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(tp->t_inpcb); /* * Advance th->th_seq to correspond to first data byte. If data, @@ -6847,7 +6845,6 @@ rack_check_data_after_close(struct mbuf *m, { struct tcp_rack *rack; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack->rc_allow_data_af_clo == 0) { close_now: @@ -7079,7 +7076,6 @@ rack_do_closing(struct mbuf *m, struct tcphdr *th, str return (ret_val); } if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tcp_twstart(tp); m_freem(m); return (1); @@ -7187,7 +7183,6 @@ rack_do_lastack(struct mbuf *m, struct tcphdr *th, str return (ret_val); } if (ourfinisacked) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); tp = tcp_close(tp); ctf_do_drop(m, tp); return (1); @@ -7650,16 +7645,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr kern_prefetch(rack, &prev_state); prev_state = 0; thflags = th->th_flags; - /* - * If this is either a state-changing packet or current state isn't - * established, we require a read lock on tcbinfo. Otherwise, we - * allow the tcbinfo to be in either locked or unlocked, as the - * caller may have unnecessarily acquired a lock due to a race. - */ - if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 || - tp->t_state != TCPS_ESTABLISHED) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } + + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(tp->t_inpcb); KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN", __func__)); Modified: head/sys/netinet/tcp_stacks/rack_bbr_common.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack_bbr_common.c Thu Nov 7 21:14:59 2019 (r354482) +++ head/sys/netinet/tcp_stacks/rack_bbr_common.c Thu Nov 7 21:23:07 2019 (r354483) @@ -253,7 +253,6 @@ ctf_process_inbound_raw(struct tcpcb *tp, struct socke */ struct mbuf *m_save; struct ether_header *eh; - struct epoch_tracker et; struct tcphdr *th; #ifdef INET6 struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ @@ -268,14 +267,8 @@ ctf_process_inbound_raw(struct tcpcb *tp, struct socke uint16_t drop_hdrlen; uint8_t iptos, no_vn=0, bpf_req=0; - /* - * This is a bit deceptive, we get the - * "info epoch" which is really the network - * epoch. This covers us on both any INP - * type change but also if the ifp goes - * away it covers us as well. - */ - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ASSERT(); + if (m && m->m_pkthdr.rcvif) ifp = m->m_pkthdr.rcvif; else @@ -445,7 +438,6 @@ skip_vnet: } if (no_vn == 0) CURVNET_RESTORE(); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); return(retval); } skipped_pkt: @@ -453,7 +445,6 @@ skipped_pkt: } if (no_vn == 0) CURVNET_RESTORE(); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); return(retval); } @@ -680,7 +671,6 @@ ctf_process_rst(struct mbuf *m, struct tcphdr *th, str SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); KASSERT(tp->t_state != TCPS_SYN_SENT, ("%s: TH_RST for TCPS_SYN_SENT th %p tp %p", __func__, th, tp)); @@ -732,7 +722,8 @@ ctf_process_rst(struct mbuf *m, struct tcphdr *th, str void ctf_challenge_ack(struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, int32_t * ret_val) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + + NET_EPOCH_ASSERT(); TCPSTAT_INC(tcps_badsyn); if (V_tcp_insecure_syn && From owner-svn-src-all@freebsd.org Thu Nov 7 21:27:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F2C317A0D9; Thu, 7 Nov 2019 21:27:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478GhQ260Tz4NN7; Thu, 7 Nov 2019 21:27:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BD121BFEF; Thu, 7 Nov 2019 21:27:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LRYjb096368; Thu, 7 Nov 2019 21:27:34 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LRXis096363; Thu, 7 Nov 2019 21:27:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072127.xA7LRXis096363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354484 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:27:34 -0000 Author: glebius Date: Thu Nov 7 21:27:32 2019 New Revision: 354484 URL: https://svnweb.freebsd.org/changeset/base/354484 Log: Now that there is no R/W lock on PCB list the pcblist sysctls handlers can be greatly simplified. All the previous double cycling and complex locking was added to avoid these functions holding global PCB locks for extended period of time, preventing addition of new entries. Modified: head/sys/netinet/ip_divert.c head/sys/netinet/raw_ip.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/ip_divert.c Thu Nov 7 21:27:32 2019 (r354484) @@ -629,71 +629,41 @@ div_ctlinput(int cmd, struct sockaddr *sa, void *vip) static int div_pcblist(SYSCTL_HANDLER_ARGS) { - int error, i, n; - struct inpcb *inp, **inp_list; - inp_gen_t gencnt; struct xinpgen xig; struct epoch_tracker et; + struct inpcb *inp; + int error; - /* - * The process of preparing the TCB list is too time-consuming and - * resource-intensive to repeat twice on every request. - */ + if (req->newptr != 0) + return EPERM; + if (req->oldptr == 0) { + int n; + n = V_divcbinfo.ipi_count; n += imax(n / 8, 10); req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb); return 0; } - if (req->newptr != 0) - return EPERM; - - /* - * OK, now we're committed to doing something. - */ - INP_INFO_WLOCK(&V_divcbinfo); - gencnt = V_divcbinfo.ipi_gencnt; - n = V_divcbinfo.ipi_count; - INP_INFO_WUNLOCK(&V_divcbinfo); - - error = sysctl_wire_old_buffer(req, - 2 * sizeof(xig) + n*sizeof(struct xinpcb)); - if (error != 0) + if ((error = sysctl_wire_old_buffer(req, 0)) != 0) return (error); bzero(&xig, sizeof(xig)); xig.xig_len = sizeof xig; - xig.xig_count = n; - xig.xig_gen = gencnt; + xig.xig_count = V_divcbinfo.ipi_count; + xig.xig_gen = V_divcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; error = SYSCTL_OUT(req, &xig, sizeof xig); if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - if (inp_list == NULL) - return ENOMEM; - - INP_INFO_RLOCK_ET(&V_divcbinfo, et); - for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp && i < n; - inp = CK_LIST_NEXT(inp, inp_list)) { - INP_WLOCK(inp); - if (inp->inp_gencnt <= gencnt && - cr_canseeinpcb(req->td->td_ucred, inp) == 0) { - in_pcbref(inp); - inp_list[i++] = inp; - } - INP_WUNLOCK(inp); - } - INP_INFO_RUNLOCK_ET(&V_divcbinfo, et); - n = i; - - error = 0; - for (i = 0; i < n; i++) { - inp = inp_list[i]; + NET_EPOCH_ENTER(et); + for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead); + inp != NULL; + inp = CK_LIST_NEXT(inp, inp_list)) { INP_RLOCK(inp); - if (inp->inp_gencnt <= gencnt) { + if (inp->inp_gencnt <= xig.xig_gen) { struct xinpcb xi; in_pcbtoxinpcb(inp, &xi); @@ -702,17 +672,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS) } else INP_RUNLOCK(inp); } - INP_INFO_WLOCK(&V_divcbinfo); - for (i = 0; i < n; i++) { - inp = inp_list[i]; - INP_RLOCK(inp); - if (!in_pcbrele_rlocked(inp)) - INP_RUNLOCK(inp); - } - INP_INFO_WUNLOCK(&V_divcbinfo); + NET_EPOCH_EXIT(et); if (!error) { - struct epoch_tracker et; /* * Give the user an updated idea of our state. * If the generation differs from what we told @@ -720,15 +682,13 @@ div_pcblist(SYSCTL_HANDLER_ARGS) * while we were processing this request, and it * might be necessary to retry. */ - INP_INFO_RLOCK_ET(&V_divcbinfo, et); xig.xig_gen = V_divcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; xig.xig_count = V_divcbinfo.ipi_count; - INP_INFO_RUNLOCK_ET(&V_divcbinfo, et); error = SYSCTL_OUT(req, &xig, sizeof xig); } - free(inp_list, M_TEMP); - return error; + + return (error); } #ifdef SYSCTL_NODE Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/raw_ip.c Thu Nov 7 21:27:32 2019 (r354484) @@ -1067,97 +1067,67 @@ rip_send(struct socket *so, int flags, struct mbuf *m, static int rip_pcblist(SYSCTL_HANDLER_ARGS) { - int error, i, n; - struct inpcb *inp, **inp_list; - inp_gen_t gencnt; struct xinpgen xig; struct epoch_tracker et; + struct inpcb *inp; + int error; - /* - * The process of preparing the TCB list is too time-consuming and - * resource-intensive to repeat twice on every request. - */ + if (req->newptr != 0) + return (EPERM); + if (req->oldptr == 0) { + int n; + n = V_ripcbinfo.ipi_count; n += imax(n / 8, 10); req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb); return (0); } - if (req->newptr != 0) - return (EPERM); + if ((error = sysctl_wire_old_buffer(req, 0)) != 0) + return (error); - /* - * OK, now we're committed to doing something. - */ - INP_INFO_WLOCK(&V_ripcbinfo); - gencnt = V_ripcbinfo.ipi_gencnt; - n = V_ripcbinfo.ipi_count; - INP_INFO_WUNLOCK(&V_ripcbinfo); - bzero(&xig, sizeof(xig)); xig.xig_len = sizeof xig; - xig.xig_count = n; - xig.xig_gen = gencnt; + xig.xig_count = V_ripcbinfo.ipi_count; + xig.xig_gen = V_ripcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; error = SYSCTL_OUT(req, &xig, sizeof xig); if (error) return (error); - inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); - for (inp = CK_LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp && i < n; - inp = CK_LIST_NEXT(inp, inp_list)) { - INP_WLOCK(inp); - if (inp->inp_gencnt <= gencnt && - cr_canseeinpcb(req->td->td_ucred, inp) == 0) { - in_pcbref(inp); - inp_list[i++] = inp; - } - INP_WUNLOCK(inp); - } - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); - n = i; - - error = 0; - for (i = 0; i < n; i++) { - inp = inp_list[i]; + NET_EPOCH_ENTER(et); + for (inp = CK_LIST_FIRST(V_ripcbinfo.ipi_listhead); + inp != NULL; + inp = CK_LIST_NEXT(inp, inp_list)) { INP_RLOCK(inp); - if (inp->inp_gencnt <= gencnt) { + if (inp->inp_gencnt <= xig.xig_gen && + cr_canseeinpcb(req->td->td_ucred, inp) == 0) { struct xinpcb xi; in_pcbtoxinpcb(inp, &xi); INP_RUNLOCK(inp); error = SYSCTL_OUT(req, &xi, sizeof xi); + if (error) + break; } else INP_RUNLOCK(inp); } - INP_INFO_WLOCK(&V_ripcbinfo); - for (i = 0; i < n; i++) { - inp = inp_list[i]; - INP_RLOCK(inp); - if (!in_pcbrele_rlocked(inp)) - INP_RUNLOCK(inp); - } - INP_INFO_WUNLOCK(&V_ripcbinfo); + NET_EPOCH_EXIT(et); if (!error) { - struct epoch_tracker et; /* * Give the user an updated idea of our state. If the * generation differs from what we told her before, she knows * that something happened while we were processing this * request, and it might be necessary to retry. */ - INP_INFO_RLOCK_ET(&V_ripcbinfo, et); xig.xig_gen = V_ripcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; xig.xig_count = V_ripcbinfo.ipi_count; - INP_INFO_RUNLOCK_ET(&V_ripcbinfo, et); error = SYSCTL_OUT(req, &xig, sizeof xig); } - free(inp_list, M_TEMP); + return (error); } Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/tcp_subr.c Thu Nov 7 21:27:32 2019 (r354484) @@ -2127,17 +2127,17 @@ tcp_notify(struct inpcb *inp, int error) static int tcp_pcblist(SYSCTL_HANDLER_ARGS) { - int error, i, m, n, pcb_count; - struct inpcb *inp, **inp_list; - inp_gen_t gencnt; - struct xinpgen xig; struct epoch_tracker et; + struct inpcb *inp; + struct xinpgen xig; + int error; - /* - * The process of preparing the TCB list is too time-consuming and - * resource-intensive to repeat twice on every request. - */ + if (req->newptr != NULL) + return (EPERM); + if (req->oldptr == NULL) { + int n; + n = V_tcbinfo.ipi_count + counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]); n += imax(n / 8, 10); @@ -2145,44 +2145,29 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) return (0); } - if (req->newptr != NULL) - return (EPERM); - - /* - * OK, now we're committed to doing something. - */ - INP_LIST_RLOCK(&V_tcbinfo); - gencnt = V_tcbinfo.ipi_gencnt; - n = V_tcbinfo.ipi_count; - INP_LIST_RUNLOCK(&V_tcbinfo); - - m = counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]); - - error = sysctl_wire_old_buffer(req, 2 * (sizeof xig) - + (n + m) * sizeof(struct xtcpcb)); - if (error != 0) + if ((error = sysctl_wire_old_buffer(req, 0)) != 0) return (error); bzero(&xig, sizeof(xig)); xig.xig_len = sizeof xig; - xig.xig_count = n + m; - xig.xig_gen = gencnt; + xig.xig_count = V_tcbinfo.ipi_count + + counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]); + xig.xig_gen = V_tcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; error = SYSCTL_OUT(req, &xig, sizeof xig); if (error) return (error); - error = syncache_pcblist(req, m, &pcb_count); + error = syncache_pcblist(req); if (error) return (error); - inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - - INP_INFO_WLOCK(&V_tcbinfo); - for (inp = CK_LIST_FIRST(V_tcbinfo.ipi_listhead), i = 0; - inp != NULL && i < n; inp = CK_LIST_NEXT(inp, inp_list)) { - INP_WLOCK(inp); - if (inp->inp_gencnt <= gencnt) { + NET_EPOCH_ENTER(et); + for (inp = CK_LIST_FIRST(V_tcbinfo.ipi_listhead); + inp != NULL; + inp = CK_LIST_NEXT(inp, inp_list)) { + INP_RLOCK(inp); + if (inp->inp_gencnt <= xig.xig_gen) { /* * XXX: This use of cr_cansee(), introduced with * TCP state changes, is not quite right, but for @@ -2197,36 +2182,18 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) } else error = cr_canseeinpcb(req->td->td_ucred, inp); if (error == 0) { - in_pcbref(inp); - inp_list[i++] = inp; - } - } - INP_WUNLOCK(inp); - } - INP_INFO_WUNLOCK(&V_tcbinfo); - n = i; + struct xtcpcb xt; - error = 0; - for (i = 0; i < n; i++) { - inp = inp_list[i]; - INP_RLOCK(inp); - if (inp->inp_gencnt <= gencnt) { - struct xtcpcb xt; - - tcp_inptoxtp(inp, &xt); - INP_RUNLOCK(inp); - error = SYSCTL_OUT(req, &xt, sizeof xt); + tcp_inptoxtp(inp, &xt); + INP_RUNLOCK(inp); + error = SYSCTL_OUT(req, &xt, sizeof xt); + if (error) + break; + } } else INP_RUNLOCK(inp); } - INP_INFO_RLOCK_ET(&V_tcbinfo, et); - for (i = 0; i < n; i++) { - inp = inp_list[i]; - INP_RLOCK(inp); - if (!in_pcbrele_rlocked(inp)) - INP_RUNLOCK(inp); - } - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); if (!error) { /* @@ -2236,14 +2203,13 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * while we were processing this request, and it * might be necessary to retry. */ - INP_LIST_RLOCK(&V_tcbinfo); xig.xig_gen = V_tcbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; - xig.xig_count = V_tcbinfo.ipi_count + pcb_count; - INP_LIST_RUNLOCK(&V_tcbinfo); + xig.xig_count = V_tcbinfo.ipi_count + + counter_u64_fetch(V_tcps_states[TCPS_SYN_RECEIVED]); error = SYSCTL_OUT(req, &xig, sizeof xig); } - free(inp_list, M_TEMP); + return (error); } Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/tcp_syncache.c Thu Nov 7 21:27:32 2019 (r354484) @@ -2452,46 +2452,41 @@ syncache_unpause(void *arg) * amount of space the caller allocated for this function to use. */ int -syncache_pcblist(struct sysctl_req *req, int max_pcbs, int *pcbs_exported) +syncache_pcblist(struct sysctl_req *req) { struct xtcpcb xt; struct syncache *sc; struct syncache_head *sch; - int count, error, i; + int error, i; - for (count = 0, error = 0, i = 0; i < V_tcp_syncache.hashsize; i++) { + bzero(&xt, sizeof(xt)); + xt.xt_len = sizeof(xt); + xt.t_state = TCPS_SYN_RECEIVED; + xt.xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; + xt.xt_inp.xi_socket.xso_len = sizeof (struct xsocket); + xt.xt_inp.xi_socket.so_type = SOCK_STREAM; + xt.xt_inp.xi_socket.so_state = SS_ISCONNECTING; + + for (i = 0; i < V_tcp_syncache.hashsize; i++) { sch = &V_tcp_syncache.hashbase[i]; SCH_LOCK(sch); TAILQ_FOREACH(sc, &sch->sch_bucket, sc_hash) { - if (count >= max_pcbs) { - SCH_UNLOCK(sch); - goto exit; - } if (cr_cansee(req->td->td_ucred, sc->sc_cred) != 0) continue; - bzero(&xt, sizeof(xt)); - xt.xt_len = sizeof(xt); if (sc->sc_inc.inc_flags & INC_ISIPV6) xt.xt_inp.inp_vflag = INP_IPV6; else xt.xt_inp.inp_vflag = INP_IPV4; bcopy(&sc->sc_inc, &xt.xt_inp.inp_inc, sizeof (struct in_conninfo)); - xt.t_state = TCPS_SYN_RECEIVED; - xt.xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; - xt.xt_inp.xi_socket.xso_len = sizeof (struct xsocket); - xt.xt_inp.xi_socket.so_type = SOCK_STREAM; - xt.xt_inp.xi_socket.so_state = SS_ISCONNECTING; error = SYSCTL_OUT(req, &xt, sizeof xt); if (error) { SCH_UNLOCK(sch); - goto exit; + return (0); } - count++; } SCH_UNLOCK(sch); } -exit: - *pcbs_exported = count; - return error; + + return (0); } Modified: head/sys/netinet/tcp_syncache.h ============================================================================== --- head/sys/netinet/tcp_syncache.h Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/tcp_syncache.h Thu Nov 7 21:27:32 2019 (r354484) @@ -48,7 +48,7 @@ int syncache_add(struct in_conninfo *, struct tcpopt void *, void *); void syncache_chkrst(struct in_conninfo *, struct tcphdr *, struct mbuf *); void syncache_badack(struct in_conninfo *); -int syncache_pcblist(struct sysctl_req *req, int max_pcbs, int *pcbs_exported); +int syncache_pcblist(struct sysctl_req *); struct syncache { TAILQ_ENTRY(syncache) sc_hash; Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Nov 7 21:23:07 2019 (r354483) +++ head/sys/netinet/udp_usrreq.c Thu Nov 7 21:27:32 2019 (r354484) @@ -851,87 +851,53 @@ udplite_ctlinput(int cmd, struct sockaddr *sa, void *v static int udp_pcblist(SYSCTL_HANDLER_ARGS) { - int error, i, n; - struct inpcb *inp, **inp_list; - inp_gen_t gencnt; struct xinpgen xig; struct epoch_tracker et; + struct inpcb *inp; + int error; - /* - * The process of preparing the PCB list is too time-consuming and - * resource-intensive to repeat twice on every request. - */ + if (req->newptr != 0) + return (EPERM); + if (req->oldptr == 0) { + int n; + n = V_udbinfo.ipi_count; n += imax(n / 8, 10); req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb); return (0); } - if (req->newptr != 0) - return (EPERM); - - /* - * OK, now we're committed to doing something. - */ - INP_INFO_RLOCK_ET(&V_udbinfo, et); - gencnt = V_udbinfo.ipi_gencnt; - n = V_udbinfo.ipi_count; - INP_INFO_RUNLOCK_ET(&V_udbinfo, et); - - error = sysctl_wire_old_buffer(req, 2 * (sizeof xig) - + n * sizeof(struct xinpcb)); - if (error != 0) + if ((error = sysctl_wire_old_buffer(req, 0)) != 0) return (error); bzero(&xig, sizeof(xig)); xig.xig_len = sizeof xig; - xig.xig_count = n; - xig.xig_gen = gencnt; + xig.xig_count = V_udbinfo.ipi_count; + xig.xig_gen = V_udbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; error = SYSCTL_OUT(req, &xig, sizeof xig); if (error) return (error); - inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); - if (inp_list == NULL) - return (ENOMEM); - - INP_INFO_RLOCK_ET(&V_udbinfo, et); - for (inp = CK_LIST_FIRST(V_udbinfo.ipi_listhead), i = 0; inp && i < n; - inp = CK_LIST_NEXT(inp, inp_list)) { - INP_WLOCK(inp); - if (inp->inp_gencnt <= gencnt && - cr_canseeinpcb(req->td->td_ucred, inp) == 0) { - in_pcbref(inp); - inp_list[i++] = inp; - } - INP_WUNLOCK(inp); - } - INP_INFO_RUNLOCK_ET(&V_udbinfo, et); - n = i; - - error = 0; - for (i = 0; i < n; i++) { - inp = inp_list[i]; + NET_EPOCH_ENTER(et); + for (inp = CK_LIST_FIRST(V_udbinfo.ipi_listhead); + inp != NULL; + inp = CK_LIST_NEXT(inp, inp_list)) { INP_RLOCK(inp); - if (inp->inp_gencnt <= gencnt) { + if (inp->inp_gencnt <= xig.xig_gen && + cr_canseeinpcb(req->td->td_ucred, inp) == 0) { struct xinpcb xi; in_pcbtoxinpcb(inp, &xi); INP_RUNLOCK(inp); error = SYSCTL_OUT(req, &xi, sizeof xi); + if (error) + break; } else INP_RUNLOCK(inp); } - INP_INFO_WLOCK(&V_udbinfo); - for (i = 0; i < n; i++) { - inp = inp_list[i]; - INP_RLOCK(inp); - if (!in_pcbrele_rlocked(inp)) - INP_RUNLOCK(inp); - } - INP_INFO_WUNLOCK(&V_udbinfo); + NET_EPOCH_EXIT(et); if (!error) { /* @@ -940,14 +906,12 @@ udp_pcblist(SYSCTL_HANDLER_ARGS) * that something happened while we were processing this * request, and it might be necessary to retry. */ - INP_INFO_RLOCK_ET(&V_udbinfo, et); xig.xig_gen = V_udbinfo.ipi_gencnt; xig.xig_sogen = so_gencnt; xig.xig_count = V_udbinfo.ipi_count; - INP_INFO_RUNLOCK_ET(&V_udbinfo, et); error = SYSCTL_OUT(req, &xig, sizeof xig); } - free(inp_list, M_TEMP); + return (error); } From owner-svn-src-all@freebsd.org Thu Nov 7 21:28:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 378D817A210; Thu, 7 Nov 2019 21:28:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Gjq0kZCz4Nc5; Thu, 7 Nov 2019 21:28:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F08D01BFF3; Thu, 7 Nov 2019 21:28:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LSkU4096586; Thu, 7 Nov 2019 21:28:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LSknp096585; Thu, 7 Nov 2019 21:28:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072128.xA7LSknp096585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354485 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:28:47 -0000 Author: glebius Date: Thu Nov 7 21:28:46 2019 New Revision: 354485 URL: https://svnweb.freebsd.org/changeset/base/354485 Log: Since pfslowtimo() runs in the network epoch, tcp_slowtimo() also does. This allows to simplify tcp_tw_2msl_scan() and always require the network epoch in it. Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Nov 7 21:27:32 2019 (r354484) +++ head/sys/netinet/tcp_timewait.c Thu Nov 7 21:28:46 2019 (r354485) @@ -689,25 +689,8 @@ tcp_tw_2msl_scan(int reuse) { struct tcptw *tw; struct inpcb *inp; - struct epoch_tracker et; -#ifdef INVARIANTS - if (reuse) { - /* - * Exclusive pcbinfo lock is not required in reuse case even if - * two inpcb locks can be acquired simultaneously: - * - the inpcb transitioning to TIME_WAIT state in - * tcp_tw_start(), - * - the inpcb closed by tcp_twclose(). - * - * It is because only inpcbs in FIN_WAIT2 or CLOSING states can - * transition in TIME_WAIT state. Then a pcbcb cannot be in - * TIME_WAIT list and transitioning to TIME_WAIT state at same - * time. - */ - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); - } -#endif + NET_EPOCH_ASSERT(); for (;;) { TW_RLOCK(V_tw_lock); @@ -723,12 +706,10 @@ tcp_tw_2msl_scan(int reuse) in_pcbref(inp); TW_RUNLOCK(V_tw_lock); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); INP_WLOCK(inp); tw = intotw(inp); if (in_pcbrele_wlocked(inp)) { if (__predict_true(tw == NULL)) { - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); continue; } else { /* This should not happen as in TIMEWAIT @@ -747,7 +728,6 @@ tcp_tw_2msl_scan(int reuse) "|| inp last reference) && tw != " "NULL", __func__); #endif - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); break; } } @@ -755,12 +735,10 @@ tcp_tw_2msl_scan(int reuse) if (tw == NULL) { /* tcp_twclose() has already been called */ INP_WUNLOCK(inp); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); continue; } tcp_twclose(tw, reuse); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); if (reuse) return tw; } From owner-svn-src-all@freebsd.org Thu Nov 7 21:29:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B02B17A2EE; Thu, 7 Nov 2019 21:29:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Gkp6cFXz4Nlk; Thu, 7 Nov 2019 21:29:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC1761BFFA; Thu, 7 Nov 2019 21:29:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LTcee096668; Thu, 7 Nov 2019 21:29:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LTcBg096667; Thu, 7 Nov 2019 21:29:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072129.xA7LTcBg096667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354486 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:29:39 -0000 Author: glebius Date: Thu Nov 7 21:29:38 2019 New Revision: 354486 URL: https://svnweb.freebsd.org/changeset/base/354486 Log: Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP timewait manipulation leaf functions. Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Nov 7 21:28:46 2019 (r354485) +++ head/sys/netinet/tcp_timewait.c Thu Nov 7 21:29:38 2019 (r354486) @@ -209,10 +209,10 @@ tcp_tw_destroy(void) struct tcptw *tw; struct epoch_tracker et; - INP_INFO_RLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_ENTER(et); while ((tw = TAILQ_FIRST(&V_twq_2msl)) != NULL) tcp_twclose(tw, 0); - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); + NET_EPOCH_EXIT(et); TW_LOCK_DESTROY(V_tw_lock); uma_zdestroy(V_tcptw_zone); @@ -236,7 +236,7 @@ tcp_twstart(struct tcpcb *tp) bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6; #endif - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); /* A dropped inp should never transition to TIME_WAIT state. */ @@ -382,7 +382,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu int thflags; tcp_seq seq; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); /* @@ -488,7 +488,7 @@ tcp_twclose(struct tcptw *tw, int reuse) inp = tw->tw_inpcb; KASSERT((inp->inp_flags & INP_TIMEWAIT), ("tcp_twclose: !timewait")); KASSERT(intotw(inp) == tw, ("tcp_twclose: inp_ppcb != tw")); - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* in_pcbfree() */ + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); tcp_tw_2msl_stop(tw, reuse); @@ -644,7 +644,7 @@ static void tcp_tw_2msl_reset(struct tcptw *tw, int rearm) { - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(tw->tw_inpcb); TW_WLOCK(V_tw_lock); @@ -662,7 +662,7 @@ tcp_tw_2msl_stop(struct tcptw *tw, int reuse) struct inpcb *inp; int released __unused; - INP_INFO_RLOCK_ASSERT(&V_tcbinfo); + NET_EPOCH_ASSERT(); TW_WLOCK(V_tw_lock); inp = tw->tw_inpcb; From owner-svn-src-all@freebsd.org Thu Nov 7 21:30:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C91F317A3C3; Thu, 7 Nov 2019 21:30:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Gll4wGlz4Nth; Thu, 7 Nov 2019 21:30:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C0E21BFFF; Thu, 7 Nov 2019 21:30:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LURr8096783; Thu, 7 Nov 2019 21:30:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LURuL096782; Thu, 7 Nov 2019 21:30:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072130.xA7LURuL096782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 21:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354487 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:30:27 -0000 Author: glebius Date: Thu Nov 7 21:30:27 2019 New Revision: 354487 URL: https://svnweb.freebsd.org/changeset/base/354487 Log: In TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in the leaf functions. Modified: head/sys/netinet/tcp_hpts.c Modified: head/sys/netinet/tcp_hpts.c ============================================================================== --- head/sys/netinet/tcp_hpts.c Thu Nov 7 21:29:38 2019 (r354486) +++ head/sys/netinet/tcp_hpts.c Thu Nov 7 21:30:27 2019 (r354487) @@ -1245,12 +1245,10 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct tim int16_t set_cpu; uint32_t did_prefetch = 0; int dropped; - struct epoch_tracker et; HPTS_MTX_ASSERT(hpts); -#ifndef VIMAGE - INP_INFO_RLOCK_ET(&V_tcbinfo, et); -#endif + NET_EPOCH_ASSERT(); + while ((inp = TAILQ_FIRST(&hpts->p_input)) != NULL) { HPTS_MTX_ASSERT(hpts); hpts_sane_input_remove(hpts, inp, 0); @@ -1266,7 +1264,6 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct tim INP_WLOCK(inp); #ifdef VIMAGE CURVNET_SET(inp->inp_vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); #endif if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) || (inp->inp_flags2 & INP_FREED)) { @@ -1276,7 +1273,6 @@ out: INP_WUNLOCK(inp); } #ifdef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); CURVNET_RESTORE(); #endif mtx_lock(&hpts->p_mtx); @@ -1296,7 +1292,6 @@ out: if (in_pcbrele_wlocked(inp) == 0) INP_WUNLOCK(inp); #ifdef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); CURVNET_RESTORE(); #endif mtx_lock(&hpts->p_mtx); @@ -1349,22 +1344,16 @@ out: INP_WUNLOCK(inp); INP_UNLOCK_ASSERT(inp); #ifdef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); CURVNET_RESTORE(); #endif mtx_lock(&hpts->p_mtx); hpts->p_inp = NULL; } -#ifndef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); - INP_INFO_UNLOCK_ASSERT(&V_tcbinfo); -#endif } static void tcp_hptsi(struct tcp_hpts_entry *hpts) { - struct epoch_tracker et; struct tcpcb *tp; struct inpcb *inp = NULL, *ninp; struct timeval tv; @@ -1378,6 +1367,8 @@ tcp_hptsi(struct tcp_hpts_entry *hpts) int16_t set_cpu; HPTS_MTX_ASSERT(hpts); + NET_EPOCH_ASSERT(); + /* record previous info for any logging */ hpts->saved_lasttick = hpts->p_lasttick; hpts->saved_curtick = hpts->p_curtick; @@ -1469,9 +1460,6 @@ again: goto no_one; } HPTS_MTX_ASSERT(hpts); -#ifndef VIMAGE - INP_INFO_RLOCK_ET(&V_tcbinfo, et); -#endif for (i = 0; i < ticks_to_run; i++) { /* * Calculate our delay, if there are no extra ticks there @@ -1586,7 +1574,6 @@ again: } #ifdef VIMAGE CURVNET_SET(inp->inp_vnet); - INP_INFO_RLOCK_ET(&V_tcbinfo, et); #endif /* Lets do any logging that we might want to */ if (hpts_does_tp_logging && (tp->t_logstate != TCP_LOG_STATE_OFF)) { @@ -1658,7 +1645,6 @@ again: INP_WUNLOCK(inp); skip_pacing: #ifdef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); CURVNET_RESTORE(); #endif INP_UNLOCK_ASSERT(inp); @@ -1678,9 +1664,6 @@ again: hpts->p_runningtick = 0; } } -#ifndef VIMAGE - INP_INFO_RUNLOCK_ET(&V_tcbinfo, et); -#endif no_one: HPTS_MTX_ASSERT(hpts); hpts->p_delayed_by = 0; @@ -1820,6 +1803,7 @@ static void tcp_hpts_thread(void *ctx) { struct tcp_hpts_entry *hpts; + struct epoch_tracker et; struct timeval tv; sbintime_t sb; @@ -1839,7 +1823,9 @@ tcp_hpts_thread(void *ctx) } hpts->p_hpts_wake_scheduled = 0; hpts->p_hpts_active = 1; + NET_EPOCH_ENTER(et); tcp_hptsi(hpts); + NET_EPOCH_EXIT(et); HPTS_MTX_ASSERT(hpts); tv.tv_sec = 0; tv.tv_usec = hpts->p_hpts_sleep_time * HPTS_TICKS_PER_USEC; From owner-svn-src-all@freebsd.org Thu Nov 7 21:31:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 035A417A468; Thu, 7 Nov 2019 21:31:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Gmg6MgXz4PB9; Thu, 7 Nov 2019 21:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDC771C041; Thu, 7 Nov 2019 21:31:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LVFgD099080; Thu, 7 Nov 2019 21:31:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LVFW7099079; Thu, 7 Nov 2019 21:31:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911072131.xA7LVFW7099079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 7 Nov 2019 21:31:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354488 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:31:16 -0000 Author: kevans Date: Thu Nov 7 21:31:15 2019 New Revision: 354488 URL: https://svnweb.freebsd.org/changeset/base/354488 Log: bcm_lintc: don't attach if "interrupt-controller" is missing This is a standard required property for interrupt controllers, and present on the bcm_lintc nodes for currently supported RPi models. For the RPi4, we have both bcm_lintc as well as GIC-400, but only one may be active at a time. Don't probe bcm_lintc if it's missing the "interrupt-controller" property -- in RPi 4 DTS, the bcm_lintc node is actually missing this along with other required interrupt properties. Presumably, if the earlier boot stages will support switching to the legacy interrupt controller (as is suggested possible by the documentation), the DTS will need to be updated to indicate the proper interrupt-parent and hopefully also mark this node as an interrupt-controller instead. Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Nov 7 21:30:27 2019 (r354487) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Nov 7 21:31:15 2019 (r354488) @@ -660,6 +660,8 @@ bcm_lintc_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "brcm,bcm2836-l1-intc")) return (ENXIO); + if (!ofw_bus_has_prop(dev, "interrupt-controller")) + return (ENXIO); device_set_desc(dev, "BCM2836 Interrupt Controller"); return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Thu Nov 7 21:34:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA9C717A7D0; Thu, 7 Nov 2019 21:34:28 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478GrM5hjSz4PVL; Thu, 7 Nov 2019 21:34:27 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f65.google.com with SMTP id q28so2765254lfa.5; Thu, 07 Nov 2019 13:34:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=KndlN7utR4FFf83QDNOlArUWET38XVgYl1DasnEXpqQ=; b=gCvjFVxDz4+JrLMh5dQTOeAEDIB5S53FseRFRgcjNZ5UA5TRoVWa2bliE+LFJfQOH7 PmxZlzvxaCGVEiJxps113amSNpQXID/HdFfXPIzkP388WhpzsxHdgfYcYhTpx1I0v6mx T9TaGBxB7gSTr8xn4RFukcNKVTd0x9ZnWikmxqsjMUgtdzCju7ru/fjuZ5eEckwI/x0g oFQPsxFAbxWdUPkVt4+hxczoMyZdElPDhR71JILnckM6Eqox8NwiyQyDw7rUge0uMYfl x8Vd+sggVs3S2XySC0DUa1cm1b41NLru8A8kEJapR2y/y87sEQAmU9ythZZLdgXP2qmI rlJg== X-Gm-Message-State: APjAAAWjGrDzVHgLpT5OKX0KB+G8ZPLyDI5SOavYIf+pFa9mNlgpcuSM LJ5b/YKbYiwzMIynnOeAmmwwny0/9ds= X-Google-Smtp-Source: APXvYqz2fYffl5rhoUAO5uUdsdy6g53BxMbT6G8tKs5qwsC2tNFuCUP6oGXIhOjOgbEnNwHumg4yqQ== X-Received: by 2002:a19:9144:: with SMTP id y4mr3576418lfj.168.1573162465847; Thu, 07 Nov 2019 13:34:25 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id a22sm1490709ljn.58.2019.11.07.13.34.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Nov 2019 13:34:25 -0800 (PST) Subject: Re: svn commit: r354482 - head/sys/x86/x86 To: Colin Percival , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201911072114.xA7LExVP090362@repo.freebsd.org> <0100016e47bc3e05-560c061d-ef2e-41b1-9166-20d80cb6b81d-000000@email.amazonses.com> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <69cbaec6-5799-9640-89bd-bdb5b6ae9843@FreeBSD.org> Date: Thu, 7 Nov 2019 23:34:23 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <0100016e47bc3e05-560c061d-ef2e-41b1-9166-20d80cb6b81d-000000@email.amazonses.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 478GrM5hjSz4PVL X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.65 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.11 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[65.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; IP_SCORE(-1.12)[ip: (-0.31), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.01), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[65.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:34:28 -0000 On 07/11/2019 23:19, Colin Percival wrote: > On 2019-11-07 13:14, Andriy Gapon wrote: >> x86 stack_save_td_running() can work safely only if IPI_TRACE is a >> non-maskable interrupt. But at the moment FreeBSD/Xen does not provide >> support for the NMI delivery mode. So, mark the functionality as >> unsupported similarly to other platforms without NMI. >> [...] >> +#ifdef XENHVM > > I'm not sure this does what you intended. XENHVM simply adds *support* for > running under Xen/HVM, and it's part of the GENERIC kernel. Oh... I should not have rushed. So, I should really check for a run-time Xen marker? -- Andriy Gapon From owner-svn-src-all@freebsd.org Thu Nov 7 21:43:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE35717ACE7; Thu, 7 Nov 2019 21:43:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478H2q62w5z4Q3Q; Thu, 7 Nov 2019 21:43:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2CB11C377; Thu, 7 Nov 2019 21:43:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7LhVrw008576; Thu, 7 Nov 2019 21:43:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7LhVP1008575; Thu, 7 Nov 2019 21:43:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911072143.xA7LhVP1008575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 7 Nov 2019 21:43:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354489 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 354489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 21:43:32 -0000 Author: avg Date: Thu Nov 7 21:43:31 2019 New Revision: 354489 URL: https://svnweb.freebsd.org/changeset/base/354489 Log: revert r354482, checking for XENHVM was a wrong way of checking for Xen Modified: head/sys/x86/x86/stack_machdep.c Modified: head/sys/x86/x86/stack_machdep.c ============================================================================== --- head/sys/x86/x86/stack_machdep.c Thu Nov 7 21:31:15 2019 (r354488) +++ head/sys/x86/x86/stack_machdep.c Thu Nov 7 21:43:31 2019 (r354489) @@ -135,13 +135,6 @@ int stack_save_td_running(struct stack *st, struct thread *td) { -#ifdef XENHVM - /* - * There is no NMI support on Xen, so this code can lead to - * an inter-processor deadlock. - */ - return (EOPNOTSUPP); -#endif /* XENHVM */ #ifdef STACK THREAD_LOCK_ASSERT(td, MA_OWNED); MPASS(TD_IS_RUNNING(td)); From owner-svn-src-all@freebsd.org Thu Nov 7 22:04:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF73617B9F0 for ; Thu, 7 Nov 2019 22:04:17 +0000 (UTC) (envelope-from 0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com) Received: from a8-26.smtp-out.amazonses.com (a8-26.smtp-out.amazonses.com [54.240.8.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 478HVn0JHMz4RWy for ; Thu, 7 Nov 2019 22:04:16 +0000 (UTC) (envelope-from 0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1573164256; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=YI9I1Yryojb31ukOheTbUtalHRpGOA6nCfJOlmTg52Y=; b=PtFOsigsGOeXORz343uhsjSV4kSHB74kDbJYV/wL1Vcn4JBwW83yoFZ7t8fmfN1Y PUZe6W6f62LwP9pV3bwxdNuQlPpP7NWngPV315whyi9y2Z9rC9JUApBGaXMMesELG3o ZpWkMckXHnptJt+lgMS94/qE6XPM0nnftF5NIdQc= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1573164256; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=YI9I1Yryojb31ukOheTbUtalHRpGOA6nCfJOlmTg52Y=; b=OMOOII2WDxXh6Sk73taj2mQbQS5bWsCSUIYUfAmIVmcTNJDKe3KM8HlnPhhv81tE 1julXcVbzt6xt2aZizeUQwNLjYzJ+b4iKZiwhJDCPHhjn/iAoVh2U8pZLtlFXW4itK1 yD8y+IVCs0H9iC2B8Y5CYFhQJreXB2yWMP3k5yao= Subject: Re: svn commit: r354482 - head/sys/x86/x86 To: Andriy Gapon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201911072114.xA7LExVP090362@repo.freebsd.org> <0100016e47bc3e05-560c061d-ef2e-41b1-9166-20d80cb6b81d-000000@email.amazonses.com> <69cbaec6-5799-9640-89bd-bdb5b6ae9843@FreeBSD.org> From: Colin Percival Autocrypt: addr=cperciva@tarsnap.com; prefer-encrypt=mutual; keydata= mQGhBElrAAcRBACDfDys4ZtK+ErCJ1HAzYeteKpm3OEsvT/49AjUTLihkF79HhIKrCQU+1KC zv7BwHCMLb6hq30As9L7iFKG7n5QFLFC4Te/VcITUnWHMG/c3ViLOfJGvi+9/nOEHaM1dVJY D6tEp5yM1nHmVQpo9932j4KGuGFR0LhOK5IHXOSfGwCgxSFDPdgxe2OEjWxjGgY+oV3EafcD +JROXCTjlcQiG/OguQH4Vks3mhHfFnEppLxTkDuYgHZQiUtpcT9ssH5khgqoTyMar05OUdAj ZIhNbWDh4LgTj+7ZmvLhXT5Zxw8LX9d7T36aTB8XDQSenDqEtinMWOb0TCBBLbsB8EFG1WTT ESbZci9jJS5yhtktuZoY/eM8uXMD/3k4FWFO80VRRkELSp+XSy/VlSQjyi/rhl2nQq/oOA9F oJbDaB0yq9VNhxP+uFBzBWSqeIX0t1ZWLtNfVFr4TRP5hihI5ICrg/0OpqgisKsU2NFe9xyO hyJLYmfD8ebpDJ/9k30C7Iju9pVrwLm1QgS4S2fqJRcR+U4WbjvP7CgStCVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+iGEEExECACEFAklrALYCGwMHCwkIBwMCAQQV AggDBBYCAwECHgECF4AACgkQOM7KaQxqam6/igCgn+z2k3V5ggNppmWrZstt1U2lugsAoL7L wS9V9yLtil3oWmHtwpUqYruEuQINBElrAAcQCAD3ZLMIsP4CIDoJORg+YY0lqLVBgcnF7pFb 4Uy2+KvdWofN+DKH61rZLjgXXkNE9M4EQC1B4lGttBP8IY2gs41y3AUogGdyFbidq99rCBz7 LTsgARHwFxZoaHmXyiZLEU1QZuMqwPZV1mCviRhN5E3rRqYNXVcrnXAAuhBpvNyj/ntHvcDN 2/m+ochiuBYueU4kX3lHya7sOj+mTsndcWmQ9soOUyr8O0r/BG088bMn4qqtUw4dl5/pglXk jbl7uOOPinKf0WVd2r6M0wLPJCD4NPHrCWRLLLAjwfjrtoSRvXxDbXhCdgGBa72+K8eYLzVs hgq7tJOoBWzjVK6XRxR7AAMGB/9Mo3iJ2DxqDecd02KCB5BsFDICbJGhPltU7FwrtbC7djSb XUrwsEVLHi4st4cbdGNCWCrp0BRezXZKohKnNAPFOTK++ZfgeKxrV2sJod+Q9RILF86tQ4XF 7A7Yme5hy92t/WgiU4vc/fWbgP8gV/19f8nunaT2E9NSa70mZFjZNu4iuwThoUUO5CV3Wo0Y UISsnRK8XD1+LR3A2qVyLiFRwh/miC1hgLFCTGCQ3GLxZeZzIpYSlGdQJ0L5lixW5ZQD9r1I 8i/8zhE6qRFAM0upUMI3Gt1Oq2w03DiXrZU0Fu/R8Rm8rlnkQKA+95mRTUq1xL5P5NZIi4gJ Z569OPMFiEkEGBECAAkFAklrAAcCGwwACgkQOM7KaQxqam41igCfbaldnFTu5uAdrnrghESv EI3CAo8AoLkNMks1pThl2BJNRm4CtTK9xZeH Message-ID: <0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@email.amazonses.com> Date: Thu, 7 Nov 2019 22:04:15 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <69cbaec6-5799-9640-89bd-bdb5b6ae9843@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2019.11.07-54.240.8.26 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 478HVn0JHMz4RWy X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57 header.b=PtFOsigs; dkim=pass header.d=amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=OMOOII2W; dmarc=none; spf=pass (mx1.freebsd.org: domain of 0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com designates 54.240.8.26 as permitted sender) smtp.mailfrom=0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com X-Spamd-Result: default: False [-1.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57,amazonses.com:s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tarsnap.com]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; RCVD_IN_DNSWL_NONE(0.00)[26.8.240.54.list.dnswl.org : 127.0.15.0]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.02)[ip: (-2.12), ipnet: 54.240.8.0/21(-4.61), asn: 14618(-3.30), country: US(-0.05)]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com,0100016e47e58993-b0cc9187-5881-43ba-a775-4fc96dca975a-000000@amazonses.com]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 22:04:17 -0000 On 2019-11-07 13:34, Andriy Gapon wrote: > On 07/11/2019 23:19, Colin Percival wrote: >> On 2019-11-07 13:14, Andriy Gapon wrote: >>> x86 stack_save_td_running() can work safely only if IPI_TRACE is a >>> non-maskable interrupt. But at the moment FreeBSD/Xen does not provide >>> support for the NMI delivery mode. So, mark the functionality as >>> unsupported similarly to other platforms without NMI. >>> [...] >>> +#ifdef XENHVM >> >> I'm not sure this does what you intended. XENHVM simply adds *support* for >> running under Xen/HVM, and it's part of the GENERIC kernel. > > Oh... I should not have rushed. > So, I should really check for a run-time Xen marker? I'm guessing that you want #include ... if (vm_guest == VM_GUEST_XEN) return (EOPNOTSUPP); -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@freebsd.org Thu Nov 7 22:26:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 859F017C610; Thu, 7 Nov 2019 22:26:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478J0v2zZBz4SYr; Thu, 7 Nov 2019 22:26:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4988C1CAD1; Thu, 7 Nov 2019 22:26:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7MQtk7032609; Thu, 7 Nov 2019 22:26:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7MQtcS032608; Thu, 7 Nov 2019 22:26:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201911072226.xA7MQtcS032608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Nov 2019 22:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354490 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 22:26:55 -0000 Author: glebius Date: Thu Nov 7 22:26:54 2019 New Revision: 354490 URL: https://svnweb.freebsd.org/changeset/base/354490 Log: Remove now unused INP_INFO_RLOCK macros. Modified: head/sys/netinet/in_pcb.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Thu Nov 7 21:43:31 2019 (r354489) +++ head/sys/netinet/in_pcb.h Thu Nov 7 22:26:54 2019 (r354490) @@ -629,19 +629,14 @@ int inp_so_options(const struct inpcb *inp); #define INP_INFO_LOCK_INIT(ipi, d) \ mtx_init(&(ipi)->ipi_lock, (d), NULL, MTX_DEF| MTX_RECURSE) #define INP_INFO_LOCK_DESTROY(ipi) mtx_destroy(&(ipi)->ipi_lock) -#define INP_INFO_RLOCK_ET(ipi, et) NET_EPOCH_ENTER((et)) #define INP_INFO_WLOCK(ipi) mtx_lock(&(ipi)->ipi_lock) #define INP_INFO_TRY_WLOCK(ipi) mtx_trylock(&(ipi)->ipi_lock) #define INP_INFO_WLOCKED(ipi) mtx_owned(&(ipi)->ipi_lock) -#define INP_INFO_RUNLOCK_ET(ipi, et) NET_EPOCH_EXIT((et)) -#define INP_INFO_RUNLOCK_TP(ipi, tp) NET_EPOCH_EXIT(*(tp)->t_inpcb->inp_et) #define INP_INFO_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_lock) #define INP_INFO_LOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_lock)) -#define INP_INFO_RLOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt)) #define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_lock, MA_OWNED) #define INP_INFO_WUNLOCK_ASSERT(ipi) \ mtx_assert(&(ipi)->ipi_lock, MA_NOTOWNED) -#define INP_INFO_UNLOCK_ASSERT(ipi) MPASS(!in_epoch(net_epoch_preempt) && !mtx_owned(&(ipi)->ipi_lock)) #define INP_LIST_LOCK_INIT(ipi, d) \ rw_init_flags(&(ipi)->ipi_list_lock, (d), 0) From owner-svn-src-all@freebsd.org Thu Nov 7 22:58:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2490517D082; Thu, 7 Nov 2019 22:58:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Jj06W8Kz4Tfx; Thu, 7 Nov 2019 22:58:12 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7A01D016; Thu, 7 Nov 2019 22:58:12 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7MwC0e050275; Thu, 7 Nov 2019 22:58:12 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7MwBkh050268; Thu, 7 Nov 2019 22:58:11 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911072258.xA7MwBkh050268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 22:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 X-SVN-Commit-Revision: 354491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 22:58:13 -0000 Author: brooks Date: Thu Nov 7 22:58:10 2019 New Revision: 354491 URL: https://svnweb.freebsd.org/changeset/base/354491 Log: libcompat: build 32-bit rtld and ldd as part of "everything" Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Changes relative to r354449: Correct detection of the compiler type when bsd.compat.mk is used outside Makefile.libcompat. Previously it always matched the clang case. Set LDFLAGS including the linker emulation for mips where -m32 seems to be insufficent. Reviewed by: imp, kib (origional version in r354449) Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251 Added: head/libexec/rtld-elf32/ - copied from r354464, head/libexec/rtld-elf32/ head/usr.bin/ldd32/ - copied from r354464, head/usr.bin/ldd32/ Modified: head/Makefile.inc1 head/Makefile.libcompat head/lib/msun/src/k_sincosl.h head/libexec/Makefile head/libexec/rtld-elf/Makefile head/share/mk/bsd.compat.mk head/share/mk/src.opts.mk head/usr.bin/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 7 22:26:54 2019 (r354490) +++ head/Makefile.inc1 Thu Nov 7 22:58:10 2019 (r354491) @@ -802,11 +802,10 @@ XCFLAGS+= --sysroot=${WORLDTMP} XCFLAGS+= ${BFLAGS} .endif -.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ - ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "") +.if ${MK_LIB32} == "yes" _LIBCOMPAT= 32 .include "Makefile.libcompat" -.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != "" +.elif ${MK_LIBSOFT} == "yes" _LIBCOMPAT= SOFT .include "Makefile.libcompat" .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Thu Nov 7 22:26:54 2019 (r354490) +++ head/Makefile.libcompat Thu Nov 7 22:58:10 2019 (r354491) @@ -111,28 +111,10 @@ build${libcompat}: .PHONY .endfor ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries -.if ${libcompat} == "32" -.for _t in ${_obj} all -.if !defined(NO_RTLD) - ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ - -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} -.endif - ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ - DIRPRFX=usr.bin/ldd ${_t} -.endfor -.endif distribute${libcompat} install${libcompat}: .PHONY .for _dir in ${_LC_LIBDIRS.yes} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} .endfor -.if ${libcompat} == "32" -.if !defined(NO_RTLD) - ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \ - PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//} -.endif - ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \ - ${.TARGET:S/32$//} -.endif -.endif +.endif # !targets(__<${_this:T}>__) Modified: head/lib/msun/src/k_sincosl.h ============================================================================== --- head/lib/msun/src/k_sincosl.h Thu Nov 7 22:26:54 2019 (r354490) +++ head/lib/msun/src/k_sincosl.h Thu Nov 7 22:58:10 2019 (r354491) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Thu Nov 7 22:26:54 2019 (r354490) +++ head/libexec/Makefile Thu Nov 7 22:58:10 2019 (r354491) @@ -74,6 +74,7 @@ _tftp-proxy= tftp-proxy .if !defined(NO_PIC) && !defined(NO_RTLD) _rtld-elf= rtld-elf +SUBDIR.${MK_LIB32}+= rtld-elf32 .endif .if ${MK_RBOOTD} != "no" Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Thu Nov 7 22:26:54 2019 (r354490) +++ head/libexec/rtld-elf/Makefile Thu Nov 7 22:58:10 2019 (r354491) @@ -4,6 +4,8 @@ # linker: # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all +RTLD_ELF_DIR:= ${.PARSEDIR} + .include PACKAGE= clibs MK_PIE= no # Always position independent using local rules @@ -25,16 +27,16 @@ SRCS= \ xmalloc.c \ debug.c \ libmap.c -MAN= rtld.1 +MAN?= rtld.1 CSTD?= gnu99 CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding CFLAGS+= -I${SRCTOP}/lib/csu/common -.if exists(${.CURDIR}/${MACHINE_ARCH}) +.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH}) RTLD_ARCH= ${MACHINE_ARCH} .else RTLD_ARCH= ${MACHINE_CPUARCH} .endif -CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} +CFLAGS+= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} .if ${MACHINE_ARCH} == "powerpc64" LDFLAGS+= -nostdlib -e _rtld_start .else @@ -81,16 +83,16 @@ LIBADD+= compiler_rt .if ${MK_SYMVER} == "yes" VERSION_DEF= ${LIBCSRCDIR}/Versions.def -SYMBOL_MAPS= ${.CURDIR}/Symbol.map +SYMBOL_MAPS= ${RTLD_ELF_DIR}/Symbol.map VERSION_MAP= Version.map LDFLAGS+= -Wl,--version-script=${VERSION_MAP} -.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) -SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map +.if exists(${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map) +SYMBOL_MAPS+= ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" +.sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc" # Since moving rtld-elf to /libexec, we need to create a symlink. # Fixup the existing binary that's there so we can symlink over it. @@ -99,10 +101,12 @@ beforeinstall: -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG} .endif -.PATH: ${.CURDIR}/${RTLD_ARCH} +.PATH: ${RTLD_ELF_DIR}/${RTLD_ARCH} +.if ${.CURDIR} == ${RTLD_ELF_DIR} HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +.endif .include ${PROG_FULL}: ${VERSION_MAP} Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Thu Nov 7 22:26:54 2019 (r354490) +++ head/share/mk/bsd.compat.mk Thu Nov 7 22:58:10 2019 (r354491) @@ -6,9 +6,17 @@ __<${_this:T}>__: .if defined(_LIBCOMPAT) COMPAT_ARCH= ${TARGET_ARCH} COMPAT_CPUTYPE= ${TARGET_CPUTYPE} +.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +COMPAT_COMPILER_TYPE= gcc .else +COMPAT_COMPILER_TYPE= clang +.endif +.else COMPAT_ARCH= ${MACHINE_ARCH} COMPAT_CPUTYPE= ${CPUTYPE} +.include +COMPAT_COMPILER_TYPE=${COMPILER_TYPE} .endif # ------------------------------------------------------------------- @@ -20,14 +28,14 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif -.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.if ${COMPAT_COMPILER_TYPE} == gcc .else LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" +LIB32_MACHINE= i386 +LIB32_MACHINE_ARCH= i386 +LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2" LIB32WMAKEFLAGS= \ AS="${XAS} --32" \ LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" @@ -40,14 +48,14 @@ LIB32CPUFLAGS= -mcpu=powerpc LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif LIB32CPUFLAGS+= -m32 -LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc +LIB32_MACHINE= powerpc +LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" .elif ${COMPAT_ARCH:Mmips64*} != "" HAS_COMPAT=32 -.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ - (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.if ${COMPAT_COMPILER_TYPE} == gcc .if empty(COMPAT_CPUTYPE) LIB32CPUFLAGS= -march=mips3 .else @@ -61,12 +69,15 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif .endif LIB32CPUFLAGS+= -mabi=32 -LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips +LIB32_MACHINE= mips +LIB32_MACHINE_ARCH= mips .if ${COMPAT_ARCH:Mmips64el*} != "" -LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd" +_EMULATION= elf32ltsmip_fbsd .else -LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd" +_EMULATION= elf32btsmip_fbsd .endif +LIB32WMAKEFLAGS= LD="${XLD} -m ${_EMULATION}" +LIB32LDFLAGS= -Wl,-m${_EMULATION} .endif LIB32WMAKEFLAGS+= NM="${XNM}" @@ -82,7 +93,9 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT HAS_COMPAT=SOFT LIBSOFTCFLAGS= -DCOMPAT_SOFTFP LIBSOFTCPUFLAGS= -mfloat-abi=softfp -LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${COMPAT_ARCH} +LIBSOFT_MACHINE= arm +LIBSOFT_MACHINE_ARCH= ${COMPAT_ARCH} +LIBSOFTWMAKEENV= CPUTYPE=soft LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP .endif @@ -114,8 +127,8 @@ _LIBCOMPAT:= ${WANT_COMPAT} # Generic code for each type. # Set defaults based on type. libcompat= ${_LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \ - WMAKEFLAGS WMAKE +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ + _MACHINE _MACHINE_ARCH WMAKEENV WMAKEFLAGS WMAKE .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${_LIBCOMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} @@ -131,6 +144,9 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ --sysroot=${LIBCOMPATTMP} \ ${BFLAGS} +LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE} +LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH} + # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} @@ -139,6 +155,9 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} CFLAGS+= ${LIBCOMPATCFLAGS} +LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS} +MACHINE= ${LIBCOMPAT_MACHINE} +MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH} .endif .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Nov 7 22:26:54 2019 (r354490) +++ head/share/mk/src.opts.mk Thu Nov 7 22:58:10 2019 (r354491) @@ -126,7 +126,6 @@ __DEFAULT_YES_OPTIONS = \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ - LIB32 \ LIBPTHREAD \ LIBTHR \ LLVM_COV \ @@ -357,6 +356,13 @@ BROKEN_OPTIONS+=LLDB __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC +.endif +# LIB32 is supported on amd64, mips64, and powerpc64 +.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH:Mmips64*} || \ + ${MACHINE_ARCH} == "powerpc64") +__DEFAULT_YES_OPTIONS+=LIB32 +.else +BROKEN_OPTIONS+=LIB32 .endif # Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Nov 7 22:26:54 2019 (r354490) +++ head/usr.bin/Makefile Thu Nov 7 22:58:10 2019 (r354491) @@ -226,6 +226,7 @@ SUBDIR.${MK_KDUMP}+= truss SUBDIR.${MK_KERBEROS_SUPPORT}+= compile_et SUBDIR.${MK_LDNS_UTILS}+= drill SUBDIR.${MK_LDNS_UTILS}+= host +SUBDIR.${MK_LIB32}+= ldd32 SUBDIR.${MK_LOCATE}+= locate # XXX msgs? SUBDIR.${MK_MAIL}+= biff From owner-svn-src-all@freebsd.org Thu Nov 7 23:27:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAB2117DB7C; Thu, 7 Nov 2019 23:27:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KMH4nLFz4VlD; Thu, 7 Nov 2019 23:27:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 831391D56F; Thu, 7 Nov 2019 23:27:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NRt2g067637; Thu, 7 Nov 2019 23:27:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NRt5l067636; Thu, 7 Nov 2019 23:27:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072327.xA7NRt5l067636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354492 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:27:55 -0000 Author: markj Date: Thu Nov 7 23:27:54 2019 New Revision: 354492 URL: https://svnweb.freebsd.org/changeset/base/354492 Log: iwm: Fix style in the TX path. Also ensure that the htole* macros are applied correctly when specifying the segment length and upper address bits. No functional change intended (unless you use iwm(4) on a big-endian machine). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 22:58:10 2019 (r354491) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:27:54 2019 (r354492) @@ -3568,7 +3568,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie tid = 0; ring = &sc->txq[ac]; desc = &ring->desc[ring->cur]; - memset(desc, 0, sizeof(*desc)); data = &ring->data[ring->cur]; /* Fill out iwm_tx_cmd to send to the firmware */ @@ -3607,17 +3606,15 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie ieee80211_radiotap_tx(vap, m); } - - totlen = m->m_pkthdr.len; - flags = 0; + totlen = m->m_pkthdr.len; if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= IWM_TX_CMD_FLG_ACK; } - if (type == IEEE80211_FC0_TYPE_DATA - && (totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) - && !IEEE80211_IS_MULTICAST(wh->i_addr1)) { + if (type == IEEE80211_FC0_TYPE_DATA && + totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold && + !IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= IWM_TX_CMD_FLG_PROT_REQUIRE; } @@ -3661,7 +3658,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie tx->dram_msb_ptr = iwm_get_dma_hi_addr(data->scratch_paddr); /* Copy 802.11 header in TX command. */ - memcpy(((uint8_t *)tx) + sizeof(*tx), wh, hdrlen); + memcpy((uint8_t *)tx + sizeof(*tx), wh, hdrlen); flags |= IWM_TX_CMD_FLG_BT_DIS | IWM_TX_CMD_FLG_SEQ_CTL; @@ -3715,23 +3712,24 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie ); /* Fill TX descriptor. */ + memset(desc, 0, sizeof(*desc)); desc->num_tbs = 2 + nsegs; desc->tbs[0].lo = htole32(data->cmd_paddr); - desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) | - (TB0_SIZE << 4); + desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) | + (TB0_SIZE << 4)); desc->tbs[1].lo = htole32(data->cmd_paddr + TB0_SIZE); - desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) | - ((sizeof(struct iwm_cmd_header) + sizeof(*tx) - + hdrlen + pad - TB0_SIZE) << 4); + desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) | + ((sizeof(struct iwm_cmd_header) + sizeof(*tx) + + hdrlen + pad - TB0_SIZE) << 4)); /* Other DMA segments are for data payload. */ for (i = 0; i < nsegs; i++) { seg = &segs[i]; - desc->tbs[i+2].lo = htole32(seg->ds_addr); - desc->tbs[i+2].hi_n_len = \ - htole16(iwm_get_dma_hi_addr(seg->ds_addr)) - | ((seg->ds_len) << 4); + desc->tbs[i + 2].lo = htole32(seg->ds_addr); + desc->tbs[i + 2].hi_n_len = + htole16(iwm_get_dma_hi_addr(seg->ds_addr)) | + (seg->ds_len << 4); } bus_dmamap_sync(ring->data_dmat, data->map, From owner-svn-src-all@freebsd.org Thu Nov 7 23:29:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7F5017DC04; Thu, 7 Nov 2019 23:29:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KNX4yCHz4Vt8; Thu, 7 Nov 2019 23:29:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D5D41D570; Thu, 7 Nov 2019 23:29:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NT0wE067733; Thu, 7 Nov 2019 23:29:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NT0EK067732; Thu, 7 Nov 2019 23:29:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072329.xA7NT0EK067732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354493 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:29:00 -0000 Author: markj Date: Thu Nov 7 23:29:00 2019 New Revision: 354493 URL: https://svnweb.freebsd.org/changeset/base/354493 Log: iwm: Remove a couple of unused fields from the softc. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwmvar.h ============================================================================== --- head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:27:54 2019 (r354492) +++ head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:29:00 2019 (r354493) @@ -459,8 +459,6 @@ struct iwm_softc { struct iwm_rx_ring rxq; int qfullmsk; - int sc_sf_state; - /* ICT table. */ struct iwm_dma_info ict_dma; int ict_cur; @@ -525,8 +523,6 @@ struct iwm_softc { struct iwm_notif_statistics_v10 sc_stats; int sc_noise; - - caddr_t sc_drvbpf; struct iwm_rx_radiotap_header sc_rxtap; struct iwm_tx_radiotap_header sc_txtap; From owner-svn-src-all@freebsd.org Thu Nov 7 23:29:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 793B517DC90; Thu, 7 Nov 2019 23:29:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KP22cvyz4W1m; Thu, 7 Nov 2019 23:29:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D58C1D571; Thu, 7 Nov 2019 23:29:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NTQGp067793; Thu, 7 Nov 2019 23:29:26 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NTPkK067790; Thu, 7 Nov 2019 23:29:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072329.xA7NTPkK067790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354494 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:29:26 -0000 Author: markj Date: Thu Nov 7 23:29:25 2019 New Revision: 354494 URL: https://svnweb.freebsd.org/changeset/base/354494 Log: iwm: Simplify fw_has_{api,capa}(). No functional change intended. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:00 2019 (r354493) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:25 2019 (r354494) @@ -4442,8 +4442,7 @@ static boolean_t iwm_mvm_is_lar_supported(struct iwm_softc *sc) { boolean_t nvm_lar = sc->nvm_data->lar_enabled; - boolean_t tlv_lar = fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT); + boolean_t tlv_lar = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT); if (iwm_lar_disable) return FALSE; @@ -4461,10 +4460,8 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc) static boolean_t iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc) { - return fw_has_api(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || - fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); + return iwm_fw_has_api(sc, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || + iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC); } static int @@ -4484,8 +4481,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch int n_channels; uint16_t mcc; #endif - int resp_v2 = fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); + int resp_v2 = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2); if (!iwm_mvm_is_lar_supported(sc)) { IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n", @@ -4646,7 +4642,7 @@ iwm_init_hw(struct iwm_softc *sc) if ((error = iwm_send_update_mcc_cmd(sc, "ZZ")) != 0) goto error; - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { if ((error = iwm_mvm_config_umac_scan(sc)) != 0) goto error; } @@ -6183,7 +6179,7 @@ iwm_scan_start(struct ieee80211com *ic) device_printf(sc->sc_dev, "%s: Previous scan not completed yet\n", __func__); } - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) error = iwm_mvm_umac_scan(sc); else error = iwm_mvm_lmac_scan(sc); Modified: head/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:29:00 2019 (r354493) +++ head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:29:25 2019 (r354494) @@ -215,8 +215,7 @@ static inline boolean_t iwm_mvm_rrm_scan_needed(struct iwm_softc *sc) { /* require rrm scan whenever the fw supports it */ - return fw_has_capa(&sc->sc_fw.ucode_capa, - IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT); + return iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT); } #ifdef IWM_DEBUG @@ -251,7 +250,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc * /* If this happens, the firmware has mistakenly sent an LMAC * notification during UMAC scans -- warn and ignore it. */ - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { device_printf(sc->sc_dev, "%s: Mistakenly got LMAC notification during UMAC scan\n", __func__); @@ -866,7 +865,7 @@ iwm_mvm_scan_stop_wait(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n"); - if (fw_has_capa(&sc->sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) ret = iwm_mvm_umac_scan_abort(sc); else ret = iwm_mvm_lmac_scan_abort(sc); Modified: head/sys/dev/iwm/if_iwmvar.h ============================================================================== --- head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:29:00 2019 (r354493) +++ head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:29:25 2019 (r354494) @@ -165,20 +165,6 @@ struct iwm_ucode_capabilities { uint8_t enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)]; }; -static inline int -fw_has_api(const struct iwm_ucode_capabilities *capabilities, - unsigned int api) -{ - return isset(capabilities->enabled_api, api); -} - -static inline int -fw_has_capa(const struct iwm_ucode_capabilities *capabilities, - unsigned int capa) -{ - return isset(capabilities->enabled_capa, capa); -} - /* one for each uCode image (inst/data, init/runtime/wowlan) */ struct iwm_fw_desc { const void *data; /* vmalloc'ed data */ @@ -576,3 +562,15 @@ struct iwm_softc { #define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) + +static inline bool +iwm_fw_has_api(struct iwm_softc *sc, unsigned int api) +{ + return isset(sc->sc_fw.ucode_capa.enabled_api, api); +} + +static inline bool +iwm_fw_has_capa(struct iwm_softc *sc, unsigned int capa) +{ + return isset(sc->sc_fw.ucode_capa.enabled_capa, capa); +} From owner-svn-src-all@freebsd.org Thu Nov 7 23:29:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CFCB17DD19; Thu, 7 Nov 2019 23:29:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KPM73BDz4W8M; Thu, 7 Nov 2019 23:29:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6E5E1D572; Thu, 7 Nov 2019 23:29:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NTh2o067851; Thu, 7 Nov 2019 23:29:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NTh3H067850; Thu, 7 Nov 2019 23:29:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072329.xA7NTh3H067850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354495 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:29:44 -0000 Author: markj Date: Thu Nov 7 23:29:43 2019 New Revision: 354495 URL: https://svnweb.freebsd.org/changeset/base/354495 Log: iwm: Call iwm_dev_check() earlier in iwm_attach(). This ensures that the driver softc reflects device capabilities as early as possible, for use by device initialization code that is conditional on certain capabilities. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:25 2019 (r354494) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:43 2019 (r354495) @@ -5743,8 +5743,6 @@ iwm_pci_detach(device_t dev) rman_get_rid(sc->sc_mem), sc->sc_mem); } - - static int iwm_attach(device_t dev) { @@ -5761,6 +5759,10 @@ iwm_attach(device_t dev) callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); + error = iwm_dev_check(dev); + if (error != 0) + goto fail; + sc->sc_notif_wait = iwm_notification_wait_init(sc); if (sc->sc_notif_wait == NULL) { device_printf(dev, "failed to init notification wait struct\n"); @@ -5785,11 +5787,6 @@ iwm_attach(device_t dev) goto fail; sc->sc_wantresp = -1; - - /* Match device id */ - error = iwm_dev_check(dev); - if (error != 0) - goto fail; sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV); /* From owner-svn-src-all@freebsd.org Thu Nov 7 23:29:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3B5717DD90; Thu, 7 Nov 2019 23:29:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KPf3rgJz4WGm; Thu, 7 Nov 2019 23:29:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66A9A1D573; Thu, 7 Nov 2019 23:29:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NTw2J067902; Thu, 7 Nov 2019 23:29:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NTw4f067901; Thu, 7 Nov 2019 23:29:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072329.xA7NTw4f067901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354496 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:29:58 -0000 Author: markj Date: Thu Nov 7 23:29:57 2019 New Revision: 354496 URL: https://svnweb.freebsd.org/changeset/base/354496 Log: iwm: Avoid calling iwm_start() each time a descriptor is reclaimed. Only perform the call when a qfull bit transitions. While here, avoid assignments in declarations in iwm_mvm_rx_tx_cmd(). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:43 2019 (r354495) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:57 2019 (r354496) @@ -3337,15 +3337,22 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct static void iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { - struct iwm_cmd_header *cmd_hdr = &pkt->hdr; - int idx = cmd_hdr->idx; - int qid = cmd_hdr->qid; - struct iwm_tx_ring *ring = &sc->txq[qid]; - struct iwm_tx_data *txd = &ring->data[idx]; - struct iwm_node *in = txd->in; - struct mbuf *m = txd->m; - int status; + struct iwm_cmd_header *cmd_hdr; + struct iwm_tx_ring *ring; + struct iwm_tx_data *txd; + struct iwm_node *in; + struct mbuf *m; + int idx, qid, qmsk, status; + cmd_hdr = &pkt->hdr; + idx = cmd_hdr->idx; + qid = cmd_hdr->qid; + + ring = &sc->txq[qid]; + txd = &ring->data[idx]; + in = txd->in; + m = txd->m; + KASSERT(txd->done == 0, ("txd not done")); KASSERT(txd->in != NULL, ("txd without node")); KASSERT(txd->m != NULL, ("txd without mbuf")); @@ -3366,11 +3373,11 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_ ieee80211_tx_complete(&in->in_ni, m, status); - if (--ring->queued < IWM_TX_RING_LOMARK) { - sc->qfullmsk &= ~(1 << ring->qid); - if (sc->qfullmsk == 0) { + qmsk = 1 << qid; + if (--ring->queued < IWM_TX_RING_LOMARK && (sc->qfullmsk & qmsk) != 0) { + sc->qfullmsk &= ~qmsk; + if (sc->qfullmsk == 0) iwm_start(sc); - } } } From owner-svn-src-all@freebsd.org Thu Nov 7 23:33:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DFAB17E055; Thu, 7 Nov 2019 23:33:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KVH1nL6z4Wfv; Thu, 7 Nov 2019 23:33:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 209791D72A; Thu, 7 Nov 2019 23:33:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NXxd6073490; Thu, 7 Nov 2019 23:33:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NXwMU073488; Thu, 7 Nov 2019 23:33:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072333.xA7NXwMU073488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354497 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:33:59 -0000 Author: markj Date: Thu Nov 7 23:33:58 2019 New Revision: 354497 URL: https://svnweb.freebsd.org/changeset/base/354497 Log: iwm: Define a name for TLV 48. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:29:57 2019 (r354496) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:33:58 2019 (r354497) @@ -793,7 +793,7 @@ iwm_read_firmware(struct iwm_softc *sc) break; } - case 48: /* undocumented TLV */ + case IWM_UCODE_TLV_CMD_VERSIONS: case IWM_UCODE_TLV_SDIO_ADMA_ADDR: case IWM_UCODE_TLV_FW_GSCAN_CAPA: /* ignore, not used by current driver */ Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:29:57 2019 (r354496) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:33:58 2019 (r354497) @@ -933,6 +933,7 @@ enum iwm_ucode_tlv_type { IWM_UCODE_TLV_FW_DBG_DEST = 38, IWM_UCODE_TLV_FW_DBG_CONF = 39, IWM_UCODE_TLV_FW_DBG_TRIGGER = 40, + IWM_UCODE_TLV_CMD_VERSIONS = 48, IWM_UCODE_TLV_FW_GSCAN_CAPA = 50, IWM_UCODE_TLV_FW_MEM_SEG = 51, }; From owner-svn-src-all@freebsd.org Thu Nov 7 23:34:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98F1D17E0C3; Thu, 7 Nov 2019 23:34:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KVY3ZGwz4WnD; Thu, 7 Nov 2019 23:34:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0F01D72B; Thu, 7 Nov 2019 23:34:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NYDWN073545; Thu, 7 Nov 2019 23:34:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NYD9G073544; Thu, 7 Nov 2019 23:34:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072334.xA7NYD9G073544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354498 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:34:13 -0000 Author: markj Date: Thu Nov 7 23:34:12 2019 New Revision: 354498 URL: https://svnweb.freebsd.org/changeset/base/354498 Log: iwm: Sync the TLV API enum with iwlwifi. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:33:58 2019 (r354497) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:34:12 2019 (r354498) @@ -635,6 +635,40 @@ P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAS * longer than the passive one, which is essential for fragmented scan. * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params + * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format + * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan + * iteration complete notification, and the timestamp reported for RX + * received during scan, are reported in TSF of the mac specified in the + * scan request. + * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of + * ADD_MODIFY_STA_KEY_API_S_VER_2. + * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement. + * @IWM_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2 + * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used + * @IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field + * indicating low latency direction. + * @IWM_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is + * deprecated. + * @IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8 + * of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8 + * @IWM_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS + * @IWM_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of + * the REDUCE_TX_POWER_CMD. + * @IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short + * version of the beacon notification. + * @IWM_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of + * BEACON_FILTER_CONFIG_API_S_VER_4. + * @IWM_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of + * REGULATORY_NVM_GET_INFO_RSP_API_S. + * @IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of + * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S. + * @IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of + * SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of + * SCAN_OFFLOAD_PROFILES_QUERY_RSP_S. + * @IWM_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of + * STA_CONTEXT_DOT11AX_API_S + * @IWM_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar + * version tables. * * @IWM_NUM_UCODE_TLV_API: number of bits used */ @@ -642,12 +676,35 @@ enum iwm_ucode_tlv_api { IWM_UCODE_TLV_API_FRAGMENTED_SCAN = 8, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE = 9, IWM_UCODE_TLV_API_LQ_SS_PARAMS = 18, + IWM_UCODE_TLV_API_NEW_VERSION = 20, + IWM_UCODE_TLV_API_SCAN_TSF_REPORT = 28, + IWM_UCODE_TLV_API_TKIP_MIC_KEYS = 29, + IWM_UCODE_TLV_API_STA_TYPE = 30, + IWM_UCODE_TLV_API_NAN2_VER2 = 31, + IWM_UCODE_TLV_API_ADAPTIVE_DWELL = 32, + IWM_UCODE_TLV_API_OCE = 33, + IWM_UCODE_TLV_API_NEW_BEACON_TEMPLATE = 34, + IWM_UCODE_TLV_API_NEW_RX_STATS = 35, + IWM_UCODE_TLV_API_WOWLAN_KEY_MATERIAL = 36, + IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY = 38, + IWM_UCODE_TLV_API_DEPRECATE_TTAK = 41, + IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = 42, + IWM_UCODE_TLV_API_FRAG_EBS = 44, + IWM_UCODE_TLV_API_REDUCE_TX_POWER = 45, + IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF = 46, + IWM_UCODE_TLV_API_BEACON_FILTER_V4 = 47, + IWM_UCODE_TLV_API_REGULATORY_NVM_INFO = 48, + IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ = 49, + IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS = 50, + IWM_UCODE_TLV_API_MBSSID_HE = 52, + IWM_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE = 53, + IWM_UCODE_TLV_API_FTM_RTT_ACCURACY = 54, + IWM_UCODE_TLV_API_SAR_TABLE_VER = 55, + IWM_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = 57, + IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER = 58, - IWM_NUM_UCODE_TLV_API = 32 + IWM_NUM_UCODE_TLV_API = 128, }; - -#define IWM_UCODE_TLV_API_BITS \ - "\020\10FRAGMENTED_SCAN\11WIFI_MCC_UPDATE\16WIDE_CMD_HDR\22LQ_SS_PARAMS\30EXT_SCAN_PRIO\33TX_POWER_CHAIN" /** * enum iwm_ucode_tlv_capa - ucode capabilities From owner-svn-src-all@freebsd.org Thu Nov 7 23:34:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77D5B17E13A; Thu, 7 Nov 2019 23:34:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KVs2XC9z4Ww0; Thu, 7 Nov 2019 23:34:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 011641D72D; Thu, 7 Nov 2019 23:34:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NYST0073602; Thu, 7 Nov 2019 23:34:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NYSJh073600; Thu, 7 Nov 2019 23:34:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072334.xA7NYSJh073600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:34:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354499 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:34:29 -0000 Author: markj Date: Thu Nov 7 23:34:28 2019 New Revision: 354499 URL: https://svnweb.freebsd.org/changeset/base/354499 Log: iwm: Add a few _prph functions needed for 9000-series chips. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c head/sys/dev/iwm/if_iwm_pcie_trans.h Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:34:12 2019 (r354498) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:34:28 2019 (r354499) @@ -185,6 +185,27 @@ iwm_write_prph(struct iwm_softc *sc, uint32_t addr, ui IWM_WRITE(sc, IWM_HBUS_TARG_PRPH_WDAT, val); } +void +iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, uint64_t val) +{ + iwm_write_prph(sc, (uint32_t)addr, val & 0xffffffff); + iwm_write_prph(sc, (uint32_t)addr + 4, val >> 32); +} + +int +iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, uint32_t mask, + int timeout) +{ + do { + if ((iwm_read_prph(sc, addr) & mask) == (bits & mask)) + return (0); + DELAY(10); + timeout -= 10; + } while (timeout > 0); + + return (ETIMEDOUT); +} + #ifdef IWM_DEBUG /* iwlwifi: pcie/trans.c */ int Modified: head/sys/dev/iwm/if_iwm_pcie_trans.h ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.h Thu Nov 7 23:34:12 2019 (r354498) +++ head/sys/dev/iwm/if_iwm_pcie_trans.h Thu Nov 7 23:34:28 2019 (r354499) @@ -106,6 +106,10 @@ extern uint32_t iwm_read_prph(struct iwm_softc *sc, uint32_t addr); extern void iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val); +extern void iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, + uint64_t val); +extern int iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, + uint32_t mask, int timeout); extern int iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int dwords); extern int iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf, int dwords); From owner-svn-src-all@freebsd.org Thu Nov 7 23:34:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 069F317E1C8; Thu, 7 Nov 2019 23:34:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KW563Dhz4X3X; Thu, 7 Nov 2019 23:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2EAD1D72E; Thu, 7 Nov 2019 23:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NYfWE073658; Thu, 7 Nov 2019 23:34:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NYfiC073657; Thu, 7 Nov 2019 23:34:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072334.xA7NYfiC073657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354500 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:34:42 -0000 Author: markj Date: Thu Nov 7 23:34:41 2019 New Revision: 354500 URL: https://svnweb.freebsd.org/changeset/base/354500 Log: iwm: Add 9000-series RX register definitions. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:34:28 2019 (r354499) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:34:41 2019 (r354500) @@ -1527,6 +1527,52 @@ static inline unsigned int IWM_FH_MEM_CBBC_QUEUE(unsig #define IWM_FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 +/* 9000 rx series registers */ + +#define IWM_RFH_Q0_FRBDCB_BA_LSB 0xa08000 +#define IWM_RFH_Q_FRBDCB_BA_LSB (IWM_RFH_Q0_FRBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_FRBDCB_WIDX 0xa08080 +#define IWM_RFH_Q_FRBDCB_WIDX (IWM_RFH_Q0_FRBDCB_WIDX + (q) * 4) +/* Write index table - shadow registers */ +#define IWM_RFH_Q0_FRBDCB_WIDX_TRG 0x1c80 +#define IWM_RFH_Q_FRBDCB_WIDX_TRG (IWM_RFH_Q0_FRBDCB_WIDX_TRG + (q) * 4) +/* Read index table */ +#define IWM_RFH_Q0_FRBDCB_RIDX 0xa080c0 +#define IWM_RFH_Q_FRBDCB_RIDX (IWM_RFH_Q0_FRBDCB_RIDX + (q) * 4) +/* Used list table */ +#define IWM_RFH_Q0_URBDCB_BA_LSB 0xa08100 +#define IWM_RFH_Q_URBDCB_BA_LSB (IWM_RFH_Q0_URBDCB_BA_LSB + (q) * 8) +/* Write index table */ +#define IWM_RFH_Q0_URBDCB_WIDX 0xa08180 +#define IWM_RFH_Q_URBDCB_WIDX (IWM_RFH_Q0_URBDCB_WIDX + (q) * 4) +/* stts */ +#define IWM_RFH_Q0_URBD_STTS_WPTR_LSB 0xa08200 +#define IWM_RFH_Q_URBD_STTS_WPTR_LSB (IWM_RFH_Q0_URBD_STTS_WPTR_LSB + (q) * 8) + +#define IWM_RFH_GEN_STATUS 0xa09808 +#define IWM_RXF_DMA_IDLE 0x80000000 + +/* DMA configuration */ +#define IWM_RFH_RXF_DMA_CFG 0xa09820 +#define IWM_RFH_RXF_DMA_RB_SIZE_1K 0x00010000 +#define IWM_RFH_RXF_DMA_RB_SIZE_2K 0x00020000 +#define IWM_RFH_RXF_DMA_RB_SIZE_4K 0x00040000 +#define IWM_RFH_RXF_DMA_RBDCB_SIZE_512 0x00900000 +#define IWM_RFH_RXF_DMA_MIN_RB_4_8 0x03000000 +#define IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK 0x04000000 +#define IWM_RFH_DMA_EN_ENABLE_VAL 0x80000000 + +#define IWM_RFH_GEN_CFG 0xa09800 +#define IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP 0x00000001 +#define IWM_RFH_GEN_CFG_RFH_DMA_SNOOP 0x00000002 +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128 0x00000010 +#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 0x00000000 + +#define IWM_RFH_RXF_RXQ_ACTIVE 0xa0980c + +/* end of 9000 rx series registers */ + /* TFDB Area - TFDs buffer table */ #define IWM_FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) #define IWM_FH_TFDIB_LOWER_BOUND (IWM_FH_MEM_LOWER_BOUND + 0x900) From owner-svn-src-all@freebsd.org Thu Nov 7 23:35:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B76217E257; Thu, 7 Nov 2019 23:35:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KWV1mfYz4XBK; Thu, 7 Nov 2019 23:35:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 217221D72F; Thu, 7 Nov 2019 23:35:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NZ20S073730; Thu, 7 Nov 2019 23:35:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NZ1Va073727; Thu, 7 Nov 2019 23:35:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072335.xA7NZ1Va073727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354501 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:35:02 -0000 Author: markj Date: Thu Nov 7 23:35:01 2019 New Revision: 354501 URL: https://svnweb.freebsd.org/changeset/base/354501 Log: iwm: Add a device family definition for 9000 chips. Convert existing device family checks to avoid assuming that the device family is always one of IWM_DEVICE_FAMILY_7000 or _8000. Submitted by: lwhsu, Guo Wen Jun MFC after: 2 weeks Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_config.h head/sys/dev/iwm/if_iwm_pcie_trans.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:34:41 2019 (r354500) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:01 2019 (r354501) @@ -1651,7 +1651,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t iwm_nic_unlock(sc); /* Enable L1-Active */ - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { iwm_clear_bits_prph(sc, IWM_APMG_PCIDEV_STT_REG, IWM_APMG_PCIDEV_STT_VAL_L1_ACT_DIS); } @@ -2069,7 +2069,7 @@ static int iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw, const uint16_t *phy_sku) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_SKU); return le32_to_cpup((const uint32_t *)(phy_sku + IWM_SKU_8000)); @@ -2078,7 +2078,7 @@ iwm_get_sku(const struct iwm_softc *sc, const uint16_t static int iwm_get_nvm_version(const struct iwm_softc *sc, const uint16_t *nvm_sw) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_NVM_VERSION); else return le32_to_cpup((const uint32_t *)(nvm_sw + @@ -2089,7 +2089,7 @@ static int iwm_get_radio_cfg(const struct iwm_softc *sc, const uint16_t *nvm_sw, const uint16_t *phy_sku) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_RADIO_CFG); return le32_to_cpup((const uint32_t *)(phy_sku + IWM_RADIO_CFG_8000)); @@ -2100,7 +2100,7 @@ iwm_get_n_hw_addrs(const struct iwm_softc *sc, const u { int n_hw_addr; - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) return le16_to_cpup(nvm_sw + IWM_N_HW_ADDRS); n_hw_addr = le32_to_cpup((const uint32_t *)(nvm_sw + IWM_N_HW_ADDRS_8000)); @@ -2112,7 +2112,7 @@ static void iwm_set_radio_cfg(const struct iwm_softc *sc, struct iwm_nvm_data *data, uint32_t radio_cfg) { - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { data->radio_cfg_type = IWM_NVM_RF_CFG_TYPE_MSK(radio_cfg); data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK(radio_cfg); data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK(radio_cfg); @@ -2138,7 +2138,7 @@ iwm_set_hw_address(struct iwm_softc *sc, struct iwm_nv iwm_set_hw_address_from_csr(sc, data); } else #endif - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { const uint8_t *hw_addr = (const uint8_t *)(nvm_hw + IWM_HW_ADDR); /* The byte order is little endian 16 bit, meaning 214365 */ @@ -2170,7 +2170,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc, uint32_t sku, radio_cfg; uint16_t lar_config; - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { data = malloc(sizeof(*data) + IWM_NUM_CHANNELS * sizeof(uint16_t), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -2194,7 +2194,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc, data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw); - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { + /* TODO: use IWL_NVM_EXT */ uint16_t lar_offset = data->nvm_version < 0xE39 ? IWM_NVM_LAR_OFFSET_8000_OLD : IWM_NVM_LAR_OFFSET_8000; @@ -2242,7 +2243,7 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iw "Can't parse empty OTP/NVM sections\n"); return NULL; } - } else if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + } else if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { /* SW and REGULATORY sections are mandatory */ if (!sections[IWM_NVM_SECTION_TYPE_SW].data || !sections[IWM_NVM_SECTION_TYPE_REGULATORY].data) { @@ -2672,7 +2673,7 @@ iwm_start_fw(struct iwm_softc *sc, const struct iwm_fw IWM_WRITE(sc, IWM_CSR_UCODE_DRV_GP1_CLR, IWM_CSR_UCODE_SW_BIT_RFKILL); /* Load the given image to the HW */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) ret = iwm_pcie_load_given_ucode_8000(sc, fw); else ret = iwm_pcie_load_given_ucode(sc, fw); @@ -2823,7 +2824,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm_softc *sc, IWM_MVM_UCODE_ALIVE_TIMEOUT); IWM_LOCK(sc); if (error) { - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { uint32_t a = 0x5a5a5a5a, b = 0x5a5a5a5a; if (iwm_nic_lock(sc)) { a = iwm_read_prph(sc, IWM_SB_CPU_1_STATUS); @@ -4458,7 +4459,7 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc) * Enable LAR only if it is supported by the FW (TLV) && * enabled in the NVM */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) return nvm_lar && tlv_lar; else return tlv_lar; @@ -5802,7 +5803,7 @@ iwm_attach(device_t dev) * "dash" value). To keep hw_rev backwards compatible - we'll store it * in the old format. */ - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) { int ret; uint32_t hw_step; Modified: head/sys/dev/iwm/if_iwm_config.h ============================================================================== --- head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:34:41 2019 (r354500) +++ head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:35:01 2019 (r354501) @@ -78,6 +78,7 @@ enum iwm_device_family { IWM_DEVICE_FAMILY_UNDEFINED, IWM_DEVICE_FAMILY_7000, IWM_DEVICE_FAMILY_8000, + IWM_DEVICE_FAMILY_9000, }; #define IWM_DEFAULT_MAX_TX_POWER 22 Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:34:41 2019 (r354500) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:35:01 2019 (r354501) @@ -282,7 +282,7 @@ iwm_nic_lock(struct iwm_softc *sc) IWM_SETBITS(sc, IWM_CSR_GP_CNTRL, IWM_CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) + if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) DELAY(2); if (iwm_poll_bit(sc, IWM_CSR_GP_CNTRL, @@ -475,7 +475,7 @@ iwm_apm_init(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_RESET, "iwm apm start\n"); /* Disable L0S exit timer (platform NMI Work/Around) */ - if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) { + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { IWM_SETBITS(sc, IWM_CSR_GIO_CHICKEN_BITS, IWM_CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); } From owner-svn-src-all@freebsd.org Thu Nov 7 23:35:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3701D17E302; Thu, 7 Nov 2019 23:35:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KWm0nXLz4XJx; Thu, 7 Nov 2019 23:35:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3F621D730; Thu, 7 Nov 2019 23:35:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NZFV7073786; Thu, 7 Nov 2019 23:35:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NZF05073785; Thu, 7 Nov 2019 23:35:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072335.xA7NZF05073785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354502 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:35:16 -0000 Author: markj Date: Thu Nov 7 23:35:15 2019 New Revision: 354502 URL: https://svnweb.freebsd.org/changeset/base/354502 Log: iwm: Use the same delays as iwlwifi when resetting the device. This is required for initialization to succeed for newer device families. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_pcie_trans.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:01 2019 (r354501) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:15 2019 (r354502) @@ -1315,12 +1315,14 @@ iwm_stop_device(struct iwm_softc *sc) /* Stop the device, and put it in low power state */ iwm_apm_stop(sc); - /* Upon stop, the APM issues an interrupt if HW RF kill is set. - * Clean again the interrupt here + /* stop and reset the on-board processor */ + IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); + DELAY(5000); + + /* + * Upon stop, the APM issues an interrupt if HW RF kill is set. */ iwm_disable_interrupts(sc); - /* stop and reset the on-board processor */ - IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); /* * Even if we stop the HW, we still want the RF kill Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:35:01 2019 (r354501) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:35:15 2019 (r354502) @@ -611,7 +611,7 @@ iwm_start_hw(struct iwm_softc *sc) /* Reset the entire device */ IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET); - DELAY(10); + DELAY(5000); if ((error = iwm_apm_init(sc)) != 0) return error; From owner-svn-src-all@freebsd.org Thu Nov 7 23:35:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E6E217E396; Thu, 7 Nov 2019 23:35:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KX21Sbtz4XRc; Thu, 7 Nov 2019 23:35:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 143EF1D731; Thu, 7 Nov 2019 23:35:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NZTcj073838; Thu, 7 Nov 2019 23:35:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NZTDE073836; Thu, 7 Nov 2019 23:35:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072335.xA7NZTDE073836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354503 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:35:30 -0000 Author: markj Date: Thu Nov 7 23:35:29 2019 New Revision: 354503 URL: https://svnweb.freebsd.org/changeset/base/354503 Log: iwm: Sync the firmware tx_cmd descriptor fields with iwlwifi. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:15 2019 (r354502) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:29 2019 (r354503) @@ -3656,7 +3656,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie } else pad = 0; - tx->driver_txop = 0; tx->next_frame_len = 0; tx->len = htole16(totlen); Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:35:15 2019 (r354502) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:35:29 2019 (r354503) @@ -4465,8 +4465,7 @@ struct iwm_tx_cmd { uint8_t initial_rate_index; uint8_t reserved2; uint8_t key[16]; - uint16_t next_frame_flags; - uint16_t reserved3; + uint32_t reserved3; uint32_t life_time; uint32_t dram_lsb_ptr; uint8_t dram_msb_ptr; @@ -4474,7 +4473,7 @@ struct iwm_tx_cmd { uint8_t data_retry_limit; uint8_t tid_tspec; uint16_t pm_frame_timeout; - uint16_t driver_txop; + uint16_t reserved4; uint8_t payload[0]; struct ieee80211_frame hdr[0]; } __packed; /* IWM_TX_CMD_API_S_VER_3 */ From owner-svn-src-all@freebsd.org Thu Nov 7 23:35:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4071117E435; Thu, 7 Nov 2019 23:35:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KXX0lxBz4XZX; Thu, 7 Nov 2019 23:35:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5E311D732; Thu, 7 Nov 2019 23:35:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NZtiC073902; Thu, 7 Nov 2019 23:35:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NZsWZ073897; Thu, 7 Nov 2019 23:35:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072335.xA7NZsWZ073897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354504 - in head/sys: dev/iwm modules/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: dev/iwm modules/iwm X-SVN-Commit-Revision: 354504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:35:56 -0000 Author: markj Date: Thu Nov 7 23:35:54 2019 New Revision: 354504 URL: https://svnweb.freebsd.org/changeset/base/354504 Log: iwm: Add device configuration definitions for 9000-series chips. Match such chips using the device ID. We should really be checking the subdevice as well, since a smaller number of 9460 and 9560 devices actually belong to a new series of devices and require different firmware, but that will require some extra logic in iwm_attach(). Submitted by: lwhsu, Guo Wen Jun MFC after: 2 weeks Added: head/sys/dev/iwm/if_iwm_9000.c (contents, props changed) head/sys/dev/iwm/if_iwm_9260.c (contents, props changed) Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_config.h head/sys/modules/iwm/Makefile Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:29 2019 (r354503) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:35:54 2019 (r354504) @@ -5624,6 +5624,9 @@ iwm_intr(void *arg) #define PCI_PRODUCT_INTEL_WL_8260_1 0x24f3 #define PCI_PRODUCT_INTEL_WL_8260_2 0x24f4 #define PCI_PRODUCT_INTEL_WL_8265_1 0x24fd +#define PCI_PRODUCT_INTEL_WL_9560_1 0x9df0 +#define PCI_PRODUCT_INTEL_WL_9560_2 0xa370 +#define PCI_PRODUCT_INTEL_WL_9260_1 0x2526 static const struct iwm_devices { uint16_t device; @@ -5641,6 +5644,9 @@ static const struct iwm_devices { { PCI_PRODUCT_INTEL_WL_8260_1, &iwm8260_cfg }, { PCI_PRODUCT_INTEL_WL_8260_2, &iwm8260_cfg }, { PCI_PRODUCT_INTEL_WL_8265_1, &iwm8265_cfg }, + { PCI_PRODUCT_INTEL_WL_9560_1, &iwm9560_cfg }, + { PCI_PRODUCT_INTEL_WL_9560_2, &iwm9560_cfg }, + { PCI_PRODUCT_INTEL_WL_9260_1, &iwm9260_cfg }, }; static int Added: head/sys/dev/iwm/if_iwm_9000.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iwm/if_iwm_9000.c Thu Nov 7 23:35:54 2019 (r354504) @@ -0,0 +1,95 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name 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) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" +#include "opt_iwm.h" + +#include + +#include "if_iwm_config.h" + +#define IWM9000_FW "iwm9000fw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_9000 10 + +#define IWM_DEVICE_9000_COMMON \ + .device_family = IWM_DEVICE_FAMILY_9000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_9000 + +const struct iwm_cfg iwm9560_cfg = { + .name = "Intel(R) Dual Band Wireless AC 9560", + .fw_name = IWM9000_FW, + IWM_DEVICE_9000_COMMON, + .host_interrupt_operation_mode = 0, +}; Added: head/sys/dev/iwm/if_iwm_9260.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iwm/if_iwm_9260.c Thu Nov 7 23:35:54 2019 (r354504) @@ -0,0 +1,95 @@ +/*- + * Based on BSD-licensed source modules in the Linux iwlwifi driver, + * which were used as the reference documentation for this implementation. + * + ****************************************************************************** + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, + * USA + * + * The full GNU General Public License is included in this distribution + * in the file called COPYING. + * + * Contact Information: + * Intel Linux Wireless + * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + * + * BSD LICENSE + * + * Copyright(c) 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name 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) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" +#include "opt_iwm.h" + +#include + +#include "if_iwm_config.h" + +#define IWM9260_FW "iwm9260fw" + +#define IWM_NVM_HW_SECTION_NUM_FAMILY_9260 10 + +#define IWM_DEVICE_9260_COMMON \ + .device_family = IWM_DEVICE_FAMILY_9000, \ + .eeprom_size = IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000, \ + .nvm_hw_section_num = IWM_NVM_HW_SECTION_NUM_FAMILY_9260 + +const struct iwm_cfg iwm9260_cfg = { + .name = "Intel(R) Dual Band Wireless AC 9260", + .fw_name = IWM9260_FW, + IWM_DEVICE_9260_COMMON, + .host_interrupt_operation_mode = 0, +}; Modified: head/sys/dev/iwm/if_iwm_config.h ============================================================================== --- head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:35:29 2019 (r354503) +++ head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:35:54 2019 (r354504) @@ -151,5 +151,7 @@ extern const struct iwm_cfg iwm7265_cfg; extern const struct iwm_cfg iwm7265d_cfg; extern const struct iwm_cfg iwm8260_cfg; extern const struct iwm_cfg iwm8265_cfg; +extern const struct iwm_cfg iwm9560_cfg; +extern const struct iwm_cfg iwm9260_cfg; #endif /* __IWM_CONFIG_H__ */ Modified: head/sys/modules/iwm/Makefile ============================================================================== --- head/sys/modules/iwm/Makefile Thu Nov 7 23:35:29 2019 (r354503) +++ head/sys/modules/iwm/Makefile Thu Nov 7 23:35:54 2019 (r354504) @@ -7,7 +7,8 @@ KMOD= if_iwm SRCS= if_iwm.c if_iwm_binding.c if_iwm_util.c if_iwm_phy_db.c SRCS+= if_iwm_mac_ctxt.c if_iwm_phy_ctxt.c if_iwm_time_event.c SRCS+= if_iwm_power.c if_iwm_scan.c if_iwm_led.c if_iwm_notif_wait.c -SRCS+= if_iwm_7000.c if_iwm_8000.c if_iwm_fw.c if_iwm_sta.c if_iwm_sf.c +SRCS+= if_iwm_7000.c if_iwm_8000.c if_iwm_9000.c if_iwm_fw.c if_iwm_9260.c +SRCS+= if_iwm_sta.c if_iwm_sf.c # bus layer SRCS+= if_iwm_pcie_trans.c SRCS+= device_if.h bus_if.h pci_if.h opt_wlan.h opt_iwm.h From owner-svn-src-all@freebsd.org Thu Nov 7 23:36:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E387B17E4DA; Thu, 7 Nov 2019 23:36:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KXq5mqXz4XjH; Thu, 7 Nov 2019 23:36:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A97B31D733; Thu, 7 Nov 2019 23:36:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NaBP5073962; Thu, 7 Nov 2019 23:36:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NaBbd073959; Thu, 7 Nov 2019 23:36:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072336.xA7NaBbd073959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354505 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:36:12 -0000 Author: markj Date: Thu Nov 7 23:36:10 2019 New Revision: 354505 URL: https://svnweb.freebsd.org/changeset/base/354505 Log: iwm: Define the mqrx_supported capability. The firmware for 9000-series and newer devices has a different receive API which supports multiple queues. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm_9000.c head/sys/dev/iwm/if_iwm_9260.c head/sys/dev/iwm/if_iwm_config.h Modified: head/sys/dev/iwm/if_iwm_9000.c ============================================================================== --- head/sys/dev/iwm/if_iwm_9000.c Thu Nov 7 23:35:54 2019 (r354504) +++ head/sys/dev/iwm/if_iwm_9000.c Thu Nov 7 23:36:10 2019 (r354505) @@ -92,4 +92,6 @@ const struct iwm_cfg iwm9560_cfg = { .fw_name = IWM9000_FW, IWM_DEVICE_9000_COMMON, .host_interrupt_operation_mode = 0, + .mqrx_supported = 1, + .integrated = 1, }; Modified: head/sys/dev/iwm/if_iwm_9260.c ============================================================================== --- head/sys/dev/iwm/if_iwm_9260.c Thu Nov 7 23:35:54 2019 (r354504) +++ head/sys/dev/iwm/if_iwm_9260.c Thu Nov 7 23:36:10 2019 (r354505) @@ -92,4 +92,5 @@ const struct iwm_cfg iwm9260_cfg = { .fw_name = IWM9260_FW, IWM_DEVICE_9260_COMMON, .host_interrupt_operation_mode = 0, + .mqrx_supported = 1, }; Modified: head/sys/dev/iwm/if_iwm_config.h ============================================================================== --- head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:35:54 2019 (r354504) +++ head/sys/dev/iwm/if_iwm_config.h Thu Nov 7 23:36:10 2019 (r354505) @@ -131,13 +131,15 @@ enum iwm_nvm_type { */ struct iwm_cfg { const char *name; - const char *fw_name; - uint16_t eeprom_size; - enum iwm_device_family device_family; - int host_interrupt_operation_mode; - uint8_t nvm_hw_section_num; - int apmg_wake_up_wa; - enum iwm_nvm_type nvm_type; + const char *fw_name; + uint16_t eeprom_size; + enum iwm_device_family device_family; + int host_interrupt_operation_mode; + int mqrx_supported; + int integrated; + uint8_t nvm_hw_section_num; + int apmg_wake_up_wa; + enum iwm_nvm_type nvm_type; }; /* From owner-svn-src-all@freebsd.org Thu Nov 7 23:36:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4817B17E554; Thu, 7 Nov 2019 23:36:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KY60rRcz4Xqs; Thu, 7 Nov 2019 23:36:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3F671D734; Thu, 7 Nov 2019 23:36:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NaPlX074017; Thu, 7 Nov 2019 23:36:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NaPb5074015; Thu, 7 Nov 2019 23:36:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072336.xA7NaPb5074015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354506 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:36:26 -0000 Author: markj Date: Thu Nov 7 23:36:25 2019 New Revision: 354506 URL: https://svnweb.freebsd.org/changeset/base/354506 Log: iwm: Explicitly enable MSI on newer chipsets. 9000-series chips implement support for MSI-X interrupts and disable MSI by default. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:36:10 2019 (r354505) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:36:25 2019 (r354506) @@ -616,6 +616,10 @@ iwm_start_hw(struct iwm_softc *sc) if ((error = iwm_apm_init(sc)) != 0) return error; + /* On newer chipsets MSI is disabled by default. */ + if (sc->cfg->mqrx_supported) + iwm_write_prph(sc, IWM_UREG_CHICK, IWM_UREG_CHICK_MSI_ENABLE); + iwm_enable_rfkill_int(sc); iwm_check_rfkill(sc); Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:36:10 2019 (r354505) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:36:25 2019 (r354506) @@ -457,6 +457,10 @@ enum iwm_secure_boot_status_reg { #define IWM_LMPM_CHICK 0xa01ff8 #define IWM_LMPM_CHICK_EXTENDED_ADDR_SPACE 0x01 +#define IWM_UREG_CHICK 0xa05c00 +#define IWM_UREG_CHICK_MSI_ENABLE 0x01000000 +#define IWM_UREG_CHICK_MSIX_ENABLE 0x02000000 + #define IWM_FH_TCSR_0_REG0 (0x1D00) /* From owner-svn-src-all@freebsd.org Thu Nov 7 23:36:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3F5C17E612; Thu, 7 Nov 2019 23:36:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KYV4PQBz4Xyt; Thu, 7 Nov 2019 23:36:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B1741D735; Thu, 7 Nov 2019 23:36:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NakG5074071; Thu, 7 Nov 2019 23:36:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NakMT074070; Thu, 7 Nov 2019 23:36:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072336.xA7NakMT074070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354507 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:36:46 -0000 Author: markj Date: Thu Nov 7 23:36:46 2019 New Revision: 354507 URL: https://svnweb.freebsd.org/changeset/base/354507 Log: iwm: Enable all 31 tx queues. For now iwm only ever uses queue 0 and the management queue, but my 9560 raises a software error interrupt during initialization if this flag is not set. iwlwifi sets it for all 7000- and 8000-series hardware, so we might as well do it unconditionally. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:36:25 2019 (r354506) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:36:46 2019 (r354507) @@ -1468,7 +1468,9 @@ iwm_nic_tx_init(struct iwm_softc *sc) (unsigned long) (txq->desc_dma.paddr >> 8)); } - iwm_write_prph(sc, IWM_SCD_GP_CTRL, IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE); + iwm_set_bits_prph(sc, IWM_SCD_GP_CTRL, + IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE | + IWM_SCD_GP_CTRL_ENABLE_31_QUEUES); iwm_nic_unlock(sc); From owner-svn-src-all@freebsd.org Thu Nov 7 23:37:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F420B17E68C; Thu, 7 Nov 2019 23:37:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KYq6wPLz4Y6X; Thu, 7 Nov 2019 23:37:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0F201D736; Thu, 7 Nov 2019 23:37:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Nb38I074135; Thu, 7 Nov 2019 23:37:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Nb3Zg074130; Thu, 7 Nov 2019 23:37:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072337.xA7Nb3Zg074130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354508 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:37:04 -0000 Author: markj Date: Thu Nov 7 23:37:02 2019 New Revision: 354508 URL: https://svnweb.freebsd.org/changeset/base/354508 Log: iwm: Implement the new receive path. This is the multiqueue receive code required for 9000-series chips. Note that we still only configure a single RX queue for now. Multiqueue support will require MSI-X configuration and a scheme for managing a global pool of RX buffers. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_pcie_trans.c head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:36:46 2019 (r354507) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:02 2019 (r354508) @@ -322,16 +322,14 @@ static int iwm_mvm_load_ucode_wait_alive(struct iwm_so static int iwm_run_init_mvm_ucode(struct iwm_softc *, int); static int iwm_mvm_config_ltr(struct iwm_softc *sc); static int iwm_rx_addbuf(struct iwm_softc *, int, int); -static int iwm_mvm_get_signal_strength(struct iwm_softc *, - struct iwm_rx_phy_info *); static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); static int iwm_get_noise(struct iwm_softc *, const struct iwm_mvm_statistics_rx_non_phy *); static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, struct iwm_rx_packet *); -static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *, - uint32_t, boolean_t); +static bool iwm_mvm_rx_mpdu(struct iwm_softc *, struct mbuf *, + uint32_t, bool); static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, struct iwm_rx_packet *, struct iwm_node *); @@ -929,19 +927,28 @@ static int iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) { bus_size_t size; - int i, error; + size_t descsz; + int count, i, error; ring->cur = 0; + if (sc->cfg->mqrx_supported) { + count = IWM_RX_MQ_RING_COUNT; + descsz = sizeof(uint64_t); + } else { + count = IWM_RX_LEGACY_RING_COUNT; + descsz = sizeof(uint32_t); + } /* Allocate RX descriptors (256-byte aligned). */ - size = IWM_RX_RING_COUNT * sizeof(uint32_t); - error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->desc_dma, size, 256); + size = count * descsz; + error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->free_desc_dma, size, + 256); if (error != 0) { device_printf(sc->sc_dev, "could not allocate RX ring DMA memory\n"); goto fail; } - ring->desc = ring->desc_dma.vaddr; + ring->desc = ring->free_desc_dma.vaddr; /* Allocate RX status area (16-byte aligned). */ error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->stat_dma, @@ -953,6 +960,17 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ } ring->stat = ring->stat_dma.vaddr; + if (sc->cfg->mqrx_supported) { + size = count * sizeof(uint32_t); + error = iwm_dma_contig_alloc(sc->sc_dmat, &ring->used_desc_dma, + size, 256); + if (error != 0) { + device_printf(sc->sc_dev, + "could not allocate RX ring DMA memory\n"); + goto fail; + } + } + /* Create RX buffer DMA tag. */ error = bus_dma_tag_create(sc->sc_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -972,10 +990,11 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ __func__, error); goto fail; } + /* * Allocate and map RX buffers. */ - for (i = 0; i < IWM_RX_RING_COUNT; i++) { + for (i = 0; i < count; i++) { struct iwm_rx_data *data = &ring->data[i]; error = bus_dmamap_create(ring->data_dmat, 0, &data->map); if (error != 0) { @@ -1013,12 +1032,16 @@ iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ static void iwm_free_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring) { - int i; + int count, i; - iwm_dma_contig_free(&ring->desc_dma); + iwm_dma_contig_free(&ring->free_desc_dma); iwm_dma_contig_free(&ring->stat_dma); + iwm_dma_contig_free(&ring->used_desc_dma); - for (i = 0; i < IWM_RX_RING_COUNT; i++) { + count = sc->cfg->mqrx_supported ? IWM_RX_MQ_RING_COUNT : + IWM_RX_LEGACY_RING_COUNT; + + for (i = 0; i < count; i++) { struct iwm_rx_data *data = &ring->data[i]; if (data->m != NULL) { @@ -1377,13 +1400,62 @@ iwm_mvm_nic_config(struct iwm_softc *sc) } static int -iwm_nic_rx_init(struct iwm_softc *sc) +iwm_nic_rx_mq_init(struct iwm_softc *sc) { - /* - * Initialize RX ring. This is from the iwn driver. - */ - memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat)); + int enabled; + if (!iwm_nic_lock(sc)) + return EBUSY; + + /* Stop RX DMA. */ + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, 0); + /* Disable RX used and free queue operation. */ + iwm_write_prph(sc, IWM_RFH_RXF_RXQ_ACTIVE, 0); + + iwm_write_prph64(sc, IWM_RFH_Q0_FRBDCB_BA_LSB, + sc->rxq.free_desc_dma.paddr); + iwm_write_prph64(sc, IWM_RFH_Q0_URBDCB_BA_LSB, + sc->rxq.used_desc_dma.paddr); + iwm_write_prph64(sc, IWM_RFH_Q0_URBD_STTS_WPTR_LSB, + sc->rxq.stat_dma.paddr); + iwm_write_prph(sc, IWM_RFH_Q0_FRBDCB_WIDX, 0); + iwm_write_prph(sc, IWM_RFH_Q0_FRBDCB_RIDX, 0); + iwm_write_prph(sc, IWM_RFH_Q0_URBDCB_WIDX, 0); + + /* We configure only queue 0 for now. */ + enabled = ((1 << 0) << 16) | (1 << 0); + + /* Enable RX DMA, 4KB buffer size. */ + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, + IWM_RFH_DMA_EN_ENABLE_VAL | + IWM_RFH_RXF_DMA_RB_SIZE_4K | + IWM_RFH_RXF_DMA_MIN_RB_4_8 | + IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK | + IWM_RFH_RXF_DMA_RBDCB_SIZE_512); + + /* Enable RX DMA snooping. */ + iwm_write_prph(sc, IWM_RFH_GEN_CFG, + IWM_RFH_GEN_CFG_RFH_DMA_SNOOP | + IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP | + (sc->cfg->integrated ? IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 : + IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128)); + + /* Enable the configured queue(s). */ + iwm_write_prph(sc, IWM_RFH_RXF_RXQ_ACTIVE, enabled); + + iwm_nic_unlock(sc); + + IWM_WRITE_1(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_TIMEOUT_DEF); + + IWM_WRITE(sc, IWM_RFH_Q0_FRBDCB_WIDX_TRG, 8); + + return (0); +} + +static int +iwm_nic_rx_legacy_init(struct iwm_softc *sc) +{ + /* Stop Rx DMA */ iwm_pcie_rx_stop(sc); @@ -1398,7 +1470,8 @@ iwm_nic_rx_init(struct iwm_softc *sc) /* Set physical address of RX ring (256-byte aligned). */ IWM_WRITE(sc, - IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG, sc->rxq.desc_dma.paddr >> 8); + IWM_FH_RSCSR_CHNL0_RBDCB_BASE_REG, + sc->rxq.free_desc_dma.paddr >> 8); /* Set physical address of RX status (16-byte aligned). */ IWM_WRITE(sc, @@ -1427,20 +1500,23 @@ iwm_nic_rx_init(struct iwm_softc *sc) if (sc->cfg->host_interrupt_operation_mode) IWM_SETBITS(sc, IWM_CSR_INT_COALESCING, IWM_HOST_INT_OPER_MODE); - /* - * Thus sayeth el jefe (iwlwifi) via a comment: - * - * This value should initially be 0 (before preparing any - * RBs), should be 8 after preparing the first 8 RBs (for example) - */ - IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, 8); - iwm_nic_unlock(sc); + IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, 8); + return 0; } static int +iwm_nic_rx_init(struct iwm_softc *sc) +{ + if (sc->cfg->mqrx_supported) + return iwm_nic_rx_mq_init(sc); + else + return iwm_nic_rx_legacy_init(sc); +} + +static int iwm_nic_tx_init(struct iwm_softc *sc) { int qid; @@ -3030,46 +3106,16 @@ iwm_rx_addbuf(struct iwm_softc *sc, int size, int idx) /* Update RX descriptor. */ KASSERT((seg.ds_addr & 255) == 0, ("seg.ds_addr not aligned")); - ring->desc[idx] = htole32(seg.ds_addr >> 8); - bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, + if (sc->cfg->mqrx_supported) + ((uint64_t *)ring->desc)[idx] = htole64(seg.ds_addr); + else + ((uint32_t *)ring->desc)[idx] = htole32(seg.ds_addr >> 8); + bus_dmamap_sync(ring->free_desc_dma.tag, ring->free_desc_dma.map, BUS_DMASYNC_PREWRITE); return 0; } -/* iwlwifi: mvm/rx.c */ -/* - * iwm_mvm_get_signal_strength - use new rx PHY INFO API - * values are reported by the fw as positive values - need to negate - * to obtain their dBM. Account for missing antennas by replacing 0 - * values by -256dBm: practically 0 power and a non-feasible 8 bit value. - */ -static int -iwm_mvm_get_signal_strength(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info) -{ - int energy_a, energy_b, energy_c, max_energy; - uint32_t val; - - val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_ENERGY_ANT_ABC_IDX]); - energy_a = (val & IWM_RX_INFO_ENERGY_ANT_A_MSK) >> - IWM_RX_INFO_ENERGY_ANT_A_POS; - energy_a = energy_a ? -energy_a : -256; - energy_b = (val & IWM_RX_INFO_ENERGY_ANT_B_MSK) >> - IWM_RX_INFO_ENERGY_ANT_B_POS; - energy_b = energy_b ? -energy_b : -256; - energy_c = (val & IWM_RX_INFO_ENERGY_ANT_C_MSK) >> - IWM_RX_INFO_ENERGY_ANT_C_POS; - energy_c = energy_c ? -energy_c : -256; - max_energy = MAX(energy_a, energy_b); - max_energy = MAX(max_energy, energy_c); - - IWM_DPRINTF(sc, IWM_DEBUG_RECV, - "energy In A %d B %d C %d , and max %d\n", - energy_a, energy_b, energy_c, max_energy); - - return max_energy; -} - static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { @@ -3123,19 +3169,65 @@ iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, str sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); } +/* iwlwifi: mvm/rx.c */ /* + * iwm_mvm_get_signal_strength - use new rx PHY INFO API + * values are reported by the fw as positive values - need to negate + * to obtain their dBM. Account for missing antennas by replacing 0 + * values by -256dBm: practically 0 power and a non-feasible 8 bit value. + */ +static int +iwm_mvm_rx_get_signal_strength(struct iwm_softc *sc, + struct iwm_rx_phy_info *phy_info) +{ + int energy_a, energy_b, energy_c, max_energy; + uint32_t val; + + val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_ENERGY_ANT_ABC_IDX]); + energy_a = (val & IWM_RX_INFO_ENERGY_ANT_A_MSK) >> + IWM_RX_INFO_ENERGY_ANT_A_POS; + energy_a = energy_a ? -energy_a : -256; + energy_b = (val & IWM_RX_INFO_ENERGY_ANT_B_MSK) >> + IWM_RX_INFO_ENERGY_ANT_B_POS; + energy_b = energy_b ? -energy_b : -256; + energy_c = (val & IWM_RX_INFO_ENERGY_ANT_C_MSK) >> + IWM_RX_INFO_ENERGY_ANT_C_POS; + energy_c = energy_c ? -energy_c : -256; + max_energy = MAX(energy_a, energy_b); + max_energy = MAX(max_energy, energy_c); + + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "energy In A %d B %d C %d , and max %d\n", + energy_a, energy_b, energy_c, max_energy); + + return max_energy; +} + +static int +iwm_mvm_rxmq_get_signal_strength(struct iwm_softc *sc, + struct iwm_rx_mpdu_desc *desc) +{ + int energy_a, energy_b; + + energy_a = desc->v1.energy_a; + energy_b = desc->v1.energy_b; + energy_a = energy_a ? -energy_a : -256; + energy_b = energy_b ? -energy_b : -256; + return MAX(energy_a, energy_b); +} + +/* * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * * Handles the actual data of the Rx packet from the fw */ -static boolean_t +static bool iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, - boolean_t stolen) + bool stolen) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_frame *wh; - struct ieee80211_node *ni; struct ieee80211_rx_stats rxs; struct iwm_rx_phy_info *phy_info; struct iwm_rx_mpdu_res_start *rx_res; @@ -3154,17 +3246,17 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * device_printf(sc->sc_dev, "dsp size out of range [0,20]: %d\n", phy_info->cfg_phy_cnt); - goto fail; + return false; } if (!(rx_pkt_status & IWM_RX_MPDU_RES_STATUS_CRC_OK) || !(rx_pkt_status & IWM_RX_MPDU_RES_STATUS_OVERRUN_OK)) { IWM_DPRINTF(sc, IWM_DEBUG_RECV, "Bad CRC or FIFO: 0x%08X.\n", rx_pkt_status); - goto fail; + return false; } - rssi = iwm_mvm_get_signal_strength(sc, phy_info); + rssi = iwm_mvm_rx_get_signal_strength(sc, phy_info); /* Map it to relative value */ rssi = rssi - sc->sc_noise; @@ -3173,7 +3265,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * if (!stolen && iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) { device_printf(sc->sc_dev, "%s: unable to add more buffers\n", __func__); - goto fail; + return false; } m->m_data = pkt->data + sizeof(*rx_res); @@ -3182,8 +3274,6 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: rssi=%d, noise=%d\n", __func__, rssi, sc->sc_noise); - ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); - IWM_DPRINTF(sc, IWM_DEBUG_RECV, "%s: phy_info: channel=%d, flags=0x%08x\n", __func__, @@ -3206,11 +3296,8 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * /* rssi is in 1/2db units */ rxs.c_rssi = rssi * 2; rxs.c_nf = sc->sc_noise; - if (ieee80211_add_rx_params(m, &rxs) == 0) { - if (ni) - ieee80211_free_node(ni); - goto fail; - } + if (ieee80211_add_rx_params(m, &rxs) == 0) + return false; if (ieee80211_radiotap_active_vap(vap)) { struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap; @@ -3244,6 +3331,139 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * } } + return true; +} + +static bool +iwm_mvm_rx_mpdu_mq(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, + bool stolen) +{ + struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211_frame *wh; + struct ieee80211_rx_stats rxs; + struct iwm_rx_mpdu_desc *desc; + struct iwm_rx_packet *pkt; + int rssi; + uint32_t hdrlen, len, rate_n_flags; + uint16_t phy_info; + uint8_t channel; + + pkt = mtodo(m, offset); + desc = (void *)pkt->data; + + if (!(desc->status & htole16(IWM_RX_MPDU_RES_STATUS_CRC_OK)) || + !(desc->status & htole16(IWM_RX_MPDU_RES_STATUS_OVERRUN_OK))) { + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "Bad CRC or FIFO: 0x%08X.\n", desc->status); + return false; + } + + channel = desc->v1.channel; + len = le16toh(desc->mpdu_len); + phy_info = le16toh(desc->phy_info); + rate_n_flags = desc->v1.rate_n_flags; + + wh = mtodo(m, sizeof(*desc)); + m->m_data = pkt->data + sizeof(*desc); + m->m_pkthdr.len = m->m_len = len; + m->m_len = len; + + /* Account for padding following the frame header. */ + if ((desc->mac_flags2 & IWM_RX_MPDU_MFLG2_PAD)) { + hdrlen = ieee80211_anyhdrsize(wh); + memmove(mtodo(m, 2), mtodo(m, 0), hdrlen); + m->m_data = mtodo(m, 2); + wh = mtod(m, struct ieee80211_frame *); + } + + /* Map it to relative value */ + rssi = iwm_mvm_rxmq_get_signal_strength(sc, desc); + rssi = rssi - sc->sc_noise; + + /* replenish ring for the buffer we're going to feed to the sharks */ + if (!stolen && iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0) { + device_printf(sc->sc_dev, "%s: unable to add more buffers\n", + __func__); + return false; + } + + IWM_DPRINTF(sc, IWM_DEBUG_RECV, + "%s: rssi=%d, noise=%d\n", __func__, rssi, sc->sc_noise); + + /* + * Populate an RX state struct with the provided information. + */ + bzero(&rxs, sizeof(rxs)); + rxs.r_flags |= IEEE80211_R_IEEE | IEEE80211_R_FREQ; + rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; + rxs.c_ieee = channel; + rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, + channel <= 14 ? IEEE80211_CHAN_2GHZ : IEEE80211_CHAN_5GHZ); + + /* rssi is in 1/2db units */ + rxs.c_rssi = rssi * 2; + rxs.c_nf = sc->sc_noise; + if (ieee80211_add_rx_params(m, &rxs) == 0) + return false; + + if (ieee80211_radiotap_active_vap(vap)) { + struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap; + + tap->wr_flags = 0; + if ((phy_info & IWM_RX_MPDU_PHY_SHORT_PREAMBLE) != 0) + tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + tap->wr_chan_freq = htole16(rxs.c_freq); + /* XXX only if ic->ic_curchan->ic_ieee == rxs.c_ieee */ + tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); + tap->wr_dbm_antsignal = (int8_t)rssi; + tap->wr_dbm_antnoise = (int8_t)sc->sc_noise; + tap->wr_tsft = desc->v1.gp2_on_air_rise; + switch ((rate_n_flags & 0xff)) { + /* CCK rates. */ + case 10: tap->wr_rate = 2; break; + case 20: tap->wr_rate = 4; break; + case 55: tap->wr_rate = 11; break; + case 110: tap->wr_rate = 22; break; + /* OFDM rates. */ + case 0xd: tap->wr_rate = 12; break; + case 0xf: tap->wr_rate = 18; break; + case 0x5: tap->wr_rate = 24; break; + case 0x7: tap->wr_rate = 36; break; + case 0x9: tap->wr_rate = 48; break; + case 0xb: tap->wr_rate = 72; break; + case 0x1: tap->wr_rate = 96; break; + case 0x3: tap->wr_rate = 108; break; + /* Unknown rate: should not happen. */ + default: tap->wr_rate = 0; + } + } + + return true; +} + +static bool +iwm_mvm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset, + bool stolen) +{ + struct ieee80211com *ic; + struct ieee80211_frame *wh; + struct ieee80211_node *ni; + bool ret; + + ic = &sc->sc_ic; + + ret = sc->cfg->mqrx_supported ? + iwm_mvm_rx_mpdu_mq(sc, m, offset, stolen) : + iwm_mvm_rx_rx_mpdu(sc, m, offset, stolen); + if (!ret) { + counter_u64_add(ic->ic_ierrors, 1); + return (ret); + } + + wh = mtod(m, struct ieee80211_frame *); + ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); + IWM_UNLOCK(sc); if (ni != NULL) { IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m); @@ -3255,11 +3475,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc, struct mbuf * } IWM_LOCK(sc); - return TRUE; - -fail: - counter_u64_add(ic->ic_ierrors, 1); - return FALSE; + return true; } static int @@ -5153,7 +5369,7 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) nextpkt->hdr.idx == 0) || (nextpkt->len_n_flags == htole32(IWM_FH_RSCSR_FRAME_INVALID))) { - if (iwm_mvm_rx_rx_mpdu(sc, m, offset, stolen)) { + if (iwm_mvm_rx_mpdu(sc, m, offset, stolen)) { stolen = FALSE; /* Make sure we abort the loop */ nextoff = maxoff; @@ -5164,14 +5380,14 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) /* * Use m_copym instead of m_split, because that * makes it easier to keep a valid rx buffer in - * the ring, when iwm_mvm_rx_rx_mpdu() fails. + * the ring, when iwm_mvm_rx_mpdu() fails. * * We need to start m_copym() at offset 0, to get the * M_PKTHDR flag preserved. */ m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (m1) { - if (iwm_mvm_rx_rx_mpdu(sc, m1, offset, stolen)) + if (iwm_mvm_rx_mpdu(sc, m1, offset, stolen)) stolen = TRUE; else m_freem(m1); @@ -5420,11 +5636,21 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) static void iwm_notif_intr(struct iwm_softc *sc) { + int count; + uint32_t wreg; uint16_t hw; bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map, BUS_DMASYNC_POSTREAD); + if (sc->cfg->mqrx_supported) { + count = IWM_RX_MQ_RING_COUNT; + wreg = IWM_RFH_Q0_FRBDCB_WIDX_TRG; + } else { + count = IWM_RX_LEGACY_RING_COUNT; + wreg = IWM_FH_RSCSR_CHNL0_WPTR; + } + hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff; /* @@ -5441,7 +5667,7 @@ iwm_notif_intr(struct iwm_softc *sc) "%s: hw = %d cur = %d\n", __func__, hw, ring->cur); iwm_handle_rxb(sc, data->m); - ring->cur = (ring->cur + 1) % IWM_RX_RING_COUNT; + ring->cur = (ring->cur + 1) % count; } /* @@ -5450,8 +5676,8 @@ iwm_notif_intr(struct iwm_softc *sc) * Seems like the hardware gets upset unless we align * the write by 8?? */ - hw = (hw == 0) ? IWM_RX_RING_COUNT - 1 : hw - 1; - IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_WPTR, rounddown2(hw, 8)); + hw = (hw == 0) ? count - 1 : hw - 1; + IWM_WRITE(sc, wreg, rounddown2(hw, 8)); } static void Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:36:46 2019 (r354507) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:37:02 2019 (r354508) @@ -638,13 +638,21 @@ iwm_set_pwr(struct iwm_softc *sc) int iwm_pcie_rx_stop(struct iwm_softc *sc) { - int ret = 0; + int ret; + + ret = 0; if (iwm_nic_lock(sc)) { - IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - ret = iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG, - IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - 1000); + if (sc->cfg->mqrx_supported) { + iwm_write_prph(sc, IWM_RFH_RXF_DMA_CFG, 0); + ret = iwm_poll_prph(sc, IWM_RFH_GEN_STATUS, + IWM_RXF_DMA_IDLE, IWM_RXF_DMA_IDLE, 1000); + } else { + IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); + ret = iwm_poll_bit(sc, IWM_FH_MEM_RSSR_RX_STATUS_REG, + IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, + IWM_FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, + 1000); + } iwm_nic_unlock(sc); } return ret; Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:36:46 2019 (r354507) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:37:02 2019 (r354508) @@ -2907,6 +2907,69 @@ enum iwm_mvm_rx_status { IWM_RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000), }; +enum iwm_rx_mpdu_mac_flags1 { + IWM_RX_MPDU_MFLG1_ADDRTYPE_MASK = 0x03, + IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0, + IWM_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3, +}; + +enum iwm_rx_mpdu_mac_flags2 { + IWM_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f, + IWM_RX_MPDU_MFLG2_PAD = 0x20, + IWM_RX_MPDU_MFLG2_AMSDU = 0x40, +}; + +enum iwm_rx_mpdu_phy_info { + IWM_RX_MPDU_PHY_AMPDU = (1 << 5), + IWM_RX_MPDU_PHY_AMPDU_TOGGLE = (1 << 6), + IWM_RX_MPDU_PHY_SHORT_PREAMBLE = (1 << 7), + IWM_RX_MPDU_PHY_NCCK_ADDTL_NTFY = (1 << 7), + IWM_RX_MPDU_PHY_TSF_OVERLOAD = (1 << 8), +}; + +struct iwm_rx_mpdu_desc_v1 { + union { + uint32_t rss_hash; + uint32_t phy_data2; + }; + union { + uint32_t filter_match; + uint32_t phy_data3; + }; + uint32_t rate_n_flags; + uint8_t energy_a; + uint8_t energy_b; + uint8_t channel; + uint8_t mac_context; + uint32_t gp2_on_air_rise; + union { + uint64_t tsf_on_air_rise; + struct { + uint32_t phy_data0; + uint32_t phy_data1; + }; + }; +} __packed; + +struct iwm_rx_mpdu_desc { + uint16_t mpdu_len; + uint8_t mac_flags1; + uint8_t mac_flags2; + uint8_t amsdu_info; + uint16_t phy_info; + uint8_t mac_phy_idx; + uint16_t raw_csum; + union { + uint16_t l3l4_flags; + uint16_t phy_data4; + }; + uint16_t status; + uint8_t hash_filter; + uint8_t sta_id_flags; + uint32_t reorder_data; + struct iwm_rx_mpdu_desc_v1 v1; +} __packed; + /** * struct iwm_radio_version_notif - information on the radio version * ( IWM_RADIO_VERSION_NOTIFICATION = 0x68 ) Modified: head/sys/dev/iwm/if_iwmvar.h ============================================================================== --- head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:36:46 2019 (r354507) +++ head/sys/dev/iwm/if_iwmvar.h Thu Nov 7 23:37:02 2019 (r354508) @@ -285,11 +285,12 @@ struct iwm_tx_ring { int cur; }; -#define IWM_RX_RING_COUNT 256 -/* Linux driver optionally uses 8k buffer */ +#define IWM_RX_LEGACY_RING_COUNT 256 +#define IWM_RX_MQ_RING_COUNT 512 + #define IWM_RBUF_SIZE 4096 -#define IWM_MAX_SCATTER 20 +#define IWM_MAX_SCATTER 20 struct iwm_rx_data { struct mbuf *m; @@ -297,12 +298,13 @@ struct iwm_rx_data { }; struct iwm_rx_ring { - struct iwm_dma_info desc_dma; + struct iwm_dma_info free_desc_dma; + struct iwm_dma_info used_desc_dma; struct iwm_dma_info stat_dma; struct iwm_dma_info buf_dma; - uint32_t *desc; + void *desc; struct iwm_rb_status *stat; - struct iwm_rx_data data[IWM_RX_RING_COUNT]; + struct iwm_rx_data data[512]; bus_dmamap_t spare_map; /* for iwm_rx_addbuf() */ bus_dma_tag_t data_dmat; int cur; From owner-svn-src-all@freebsd.org Thu Nov 7 23:37:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC69A17E724; Thu, 7 Nov 2019 23:37:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KZ54Bw9z4YFN; Thu, 7 Nov 2019 23:37:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 725771D739; Thu, 7 Nov 2019 23:37:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NbHF9074188; Thu, 7 Nov 2019 23:37:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NbHvn074187; Thu, 7 Nov 2019 23:37:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072337.xA7NbHvn074187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354509 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:37:17 -0000 Author: markj Date: Thu Nov 7 23:37:17 2019 New Revision: 354509 URL: https://svnweb.freebsd.org/changeset/base/354509 Log: iwm: Fix scheduler configuration for aux and cmd queue configuration. - Configure the scheduler only for the management queue. - Fix a bug when enabling the schduler: the queues are specified using a bitmask. - Fix style in the area. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:02 2019 (r354508) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:17 2019 (r354509) @@ -1583,25 +1583,31 @@ iwm_nic_init(struct iwm_softc *sc) int iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) { + int qmsk; + + qmsk = 1 << qid; + if (!iwm_nic_lock(sc)) { - device_printf(sc->sc_dev, - "%s: cannot enable txq %d\n", - __func__, - qid); + device_printf(sc->sc_dev, "%s: cannot enable txq %d\n", + __func__, qid); return EBUSY; } IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, qid << 8 | 0); if (qid == IWM_MVM_CMD_QUEUE) { - /* unactivate before configuration */ + /* Disable the scheduler. */ + iwm_write_prph(sc, IWM_SCD_EN_CTRL, 0); + + /* Stop the TX queue prior to configuration. */ iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid), - (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) - | (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); + (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) | + (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); iwm_nic_unlock(sc); - iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, (1 << qid)); + /* Disable aggregations for this queue. */ + iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, qmsk); if (!iwm_nic_lock(sc)) { device_printf(sc->sc_dev, @@ -1611,7 +1617,8 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q iwm_write_prph(sc, IWM_SCD_QUEUE_RDPTR(qid), 0); iwm_nic_unlock(sc); - iwm_write_mem32(sc, sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0); + iwm_write_mem32(sc, + sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0); /* Set scheduler window size and frame limit. */ iwm_write_mem32(sc, sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid) + @@ -1631,6 +1638,9 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q (fifo << IWM_SCD_QUEUE_STTS_REG_POS_TXF) | (1 << IWM_SCD_QUEUE_STTS_REG_POS_WSL) | IWM_SCD_QUEUE_STTS_REG_MSK); + + /* Enable the scheduler for this queue. */ + iwm_write_prph(sc, IWM_SCD_EN_CTRL, qmsk); } else { struct iwm_scd_txq_cfg_cmd cmd; int error; @@ -1656,9 +1666,6 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q if (!iwm_nic_lock(sc)) return EBUSY; } - - iwm_write_prph(sc, IWM_SCD_EN_CTRL, - iwm_read_prph(sc, IWM_SCD_EN_CTRL) | qid); iwm_nic_unlock(sc); From owner-svn-src-all@freebsd.org Thu Nov 7 23:37:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8681617E7B7; Thu, 7 Nov 2019 23:37:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KZM2yQ2z4YNR; Thu, 7 Nov 2019 23:37:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48CDE1D73B; Thu, 7 Nov 2019 23:37:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NbVo3074240; Thu, 7 Nov 2019 23:37:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NbVTn074239; Thu, 7 Nov 2019 23:37:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072337.xA7NbVTn074239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354510 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:37:31 -0000 Author: markj Date: Thu Nov 7 23:37:30 2019 New Revision: 354510 URL: https://svnweb.freebsd.org/changeset/base/354510 Log: iwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi. Do not configure bluetooth on newer chips, it causes firmware panics. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:17 2019 (r354509) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:30 2019 (r354510) @@ -3002,6 +3002,15 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn goto error; } + if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) { + ret = iwm_send_bt_init_conf(sc); + if (ret) { + device_printf(sc->sc_dev, + "failed to send bt coex configuration: %d\n", ret); + goto error; + } + } + if (justnvm) { /* Read nvm */ ret = iwm_nvm_init(sc); @@ -3010,13 +3019,6 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn goto error; } IEEE80211_ADDR_COPY(sc->sc_ic.ic_macaddr, sc->nvm_data->hw_addr); - goto error; - } - - ret = iwm_send_bt_init_conf(sc); - if (ret) { - device_printf(sc->sc_dev, - "failed to send bt coex configuration: %d\n", ret); goto error; } From owner-svn-src-all@freebsd.org Thu Nov 7 23:37:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6861E17E855; Thu, 7 Nov 2019 23:37:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KZr26Dhz4YWR; Thu, 7 Nov 2019 23:37:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BC391D73C; Thu, 7 Nov 2019 23:37:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Nbuqc074300; Thu, 7 Nov 2019 23:37:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NbtDe074298; Thu, 7 Nov 2019 23:37:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072337.xA7NbtDe074298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354511 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:37:56 -0000 Author: markj Date: Thu Nov 7 23:37:55 2019 New Revision: 354511 URL: https://svnweb.freebsd.org/changeset/base/354511 Log: iwm: Update the station add command for the new RX API. The firmware expects a new version of the add-station command in 9000-series chips. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm_sta.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm_sta.c ============================================================================== --- head/sys/dev/iwm/if_iwm_sta.c Thu Nov 7 23:37:30 2019 (r354510) +++ head/sys/dev/iwm/if_iwm_sta.c Thu Nov 7 23:37:55 2019 (r354511) @@ -138,13 +138,8 @@ __FBSDID("$FreeBSD$"); static inline int iwm_mvm_add_sta_cmd_size(struct iwm_softc *sc) { -#ifdef notyet - return iwm_mvm_has_new_rx_api(mvm) ? - sizeof(struct iwm_mvm_add_sta_cmd) : - sizeof(struct iwm_mvm_add_sta_cmd_v7); -#else - return sizeof(struct iwm_mvm_add_sta_cmd); -#endif + return sc->cfg->mqrx_supported ? sizeof(struct iwm_mvm_add_sta_cmd) : + sizeof(struct iwm_mvm_add_sta_cmd_v7); } /* send station add/update command to firmware */ @@ -318,7 +313,7 @@ iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee802 static int iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, - const uint8_t *addr, uint16_t mac_id, uint16_t color) + const uint8_t *addr, uint16_t mac_id, uint16_t color) { struct iwm_mvm_add_sta_cmd cmd; int ret; @@ -327,6 +322,8 @@ iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struc memset(&cmd, 0, sizeof(cmd)); cmd.sta_id = sta->sta_id; cmd.mac_id_n_color = htole32(IWM_FW_CMD_ID_AND_COLOR(mac_id, color)); + if (sta->sta_id == IWM_AUX_STA_ID && sc->cfg->mqrx_supported) + cmd.station_type = IWM_STA_AUX_ACTIVITY; cmd.tfd_queue_msk = htole32(sta->tfd_queue_msk); cmd.tid_disable_tx = htole16(0xffff); @@ -362,7 +359,8 @@ iwm_mvm_add_aux_sta(struct iwm_softc *sc) sc->sc_aux_sta.tfd_queue_msk = (1 << IWM_MVM_AUX_QUEUE); /* Map Aux queue to fifo - needs to happen before adding Aux station */ - ret = iwm_enable_txq(sc, 0, IWM_MVM_AUX_QUEUE, IWM_MVM_TX_FIFO_MCAST); + ret = iwm_enable_txq(sc, IWM_AUX_STA_ID, IWM_MVM_AUX_QUEUE, + IWM_MVM_TX_FIFO_MCAST); if (ret) return ret; Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:37:30 2019 (r354510) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:37:55 2019 (r354511) @@ -5806,30 +5806,34 @@ struct iwm_mvm_keyinfo { #define IWM_ADD_STA_BAID_SHIFT 8 /** - * struct iwm_mvm_add_sta_cmd - Add/modify a station in the fw's sta table. + * struct iwl_mvm_add_sta_cmd_v7 - Add/modify a station in the fw's sta table. * ( REPLY_ADD_STA = 0x18 ) - * @add_modify: 1: modify existing, 0: add new station - * @awake_acs: + * @add_modify: see &enum iwl_sta_mode + * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD) * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable - * AMPDU for tid x. Set %IWM_STA_MODIFY_TID_DISABLE_TX to change this field. - * @mac_id_n_color: the Mac context this station belongs to - * @addr[IEEE80211_ADDR_LEN]: station's MAC address + * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. + * @mac_id_n_color: the Mac context this station belongs to, + * see &enum iwl_ctxt_id_and_color + * @addr: station's MAC address + * @reserved2: reserved * @sta_id: index of station in uCode's station table - * @modify_mask: IWM_STA_MODIFY_*, selects which parameters to modify vs. leave + * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave * alone. 1 - modify, 0 - don't change. - * @station_flags: look at %iwm_sta_flags - * @station_flags_msk: what of %station_flags have changed + * @reserved3: reserved + * @station_flags: look at &enum iwl_sta_flags + * @station_flags_msk: what of %station_flags have changed, + * also &enum iwl_sta_flags * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) - * Set %IWM_STA_MODIFY_ADD_BA_TID to use this field, and also set + * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set * add_immediate_ba_ssn. * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx) - * Set %IWM_STA_MODIFY_REMOVE_BA_TID to use this field + * Set %STA_MODIFY_REMOVE_BA_TID to use this field * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with * add_immediate_ba_tid. * @sleep_tx_count: number of packets to transmit to station even though it is * asleep. Used to synchronise PS-poll and u-APSD responses while ucode * keeps track of STA sleep state. - * @sleep_state_flags: Look at %iwm_sta_sleep_flag. + * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag. * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP * mac-addr. * @beamform_flags: beam forming controls @@ -5837,12 +5841,12 @@ struct iwm_mvm_keyinfo { * * The device contains an internal table of per-station information, with info * on security keys, aggregation parameters, and Tx rates for initial Tx - * attempt and any retries (set by IWM_REPLY_TX_LINK_QUALITY_CMD). + * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD). * * ADD_STA sets up the table entry for one station, either creating a new * entry, or modifying a pre-existing one. */ -struct iwm_mvm_add_sta_cmd { +struct iwm_mvm_add_sta_cmd_v7 { uint8_t add_modify; uint8_t awake_acs; uint16_t tid_disable_tx; @@ -5863,6 +5867,97 @@ struct iwm_mvm_add_sta_cmd { uint16_t beamform_flags; uint32_t tfd_queue_msk; } __packed; /* ADD_STA_CMD_API_S_VER_7 */ + +/** + * enum iwm_sta_type - FW station types + * ( REPLY_ADD_STA = 0x18 ) + * @IWM_STA_LINK: Link station - normal RX and TX traffic. + * @IWM_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons + * and probe responses. + * @IWM_STA_MULTICAST: multicast traffic, + * @IWM_STA_TDLS_LINK: TDLS link station + * @IWM_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on). + */ +enum iwm_sta_type { + IWM_STA_LINK, + IWM_STA_GENERAL_PURPOSE, + IWM_STA_MULTICAST, + IWM_STA_TDLS_LINK, + IWM_STA_AUX_ACTIVITY, +}; + +/** + * struct iwm_mvm_add_sta_cmd - Add/modify a station in the fw's sta table. + * ( REPLY_ADD_STA = 0x18 ) + * @add_modify: see &enum iwm_sta_mode + * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD) + * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable + * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. + * @mac_id_n_color: the Mac context this station belongs to, + * see &enum iwl_ctxt_id_and_color + * @addr: station's MAC address + * @reserved2: reserved + * @sta_id: index of station in uCode's station table + * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave + * alone. 1 - modify, 0 - don't change. + * @reserved3: reserved + * @station_flags: look at &enum iwm_sta_flags + * @station_flags_msk: what of %station_flags have changed, + * also &enum iwm_sta_flags + * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) + * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set + * add_immediate_ba_ssn. + * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx) + * Set %STA_MODIFY_REMOVE_BA_TID to use this field + * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with + * add_immediate_ba_tid. + * @sleep_tx_count: number of packets to transmit to station even though it is + * asleep. Used to synchronise PS-poll and u-APSD responses while ucode + * keeps track of STA sleep state. + * @station_type: type of this station. See &enum iwl_sta_type. + * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag. + * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP + * mac-addr. + * @beamform_flags: beam forming controls + * @tfd_queue_msk: tfd queues used by this station. + * Obselete for new TX API (9 and above). + * @rx_ba_window: aggregation window size + * @sp_length: the size of the SP in actual number of frames + * @uapsd_acs: 4 LS bits are trigger enabled ACs, 4 MS bits are the deliver + * enabled ACs. + * + * The device contains an internal table of per-station information, with info + * on security keys, aggregation parameters, and Tx rates for initial Tx + * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD). + * + * ADD_STA sets up the table entry for one station, either creating a new + * entry, or modifying a pre-existing one. + */ +struct iwm_mvm_add_sta_cmd { + uint8_t add_modify; + uint8_t awake_acs; + uint16_t tid_disable_tx; + uint32_t mac_id_n_color; + uint8_t addr[IEEE80211_ADDR_LEN]; /* _STA_ID_MODIFY_INFO_API_S_VER_1 */ + uint16_t reserved2; + uint8_t sta_id; + uint8_t modify_mask; + uint16_t reserved3; + uint32_t station_flags; + uint32_t station_flags_msk; + uint8_t add_immediate_ba_tid; + uint8_t remove_immediate_ba_tid; + uint16_t add_immediate_ba_ssn; + uint16_t sleep_tx_count; + uint8_t sleep_state_flags; + uint8_t station_type; + uint16_t assoc_id; + uint16_t beamform_flags; + uint32_t tfd_queue_msk; + uint16_t rx_ba_window; + uint8_t sp_length; + uint8_t uapsd_acs; +} __packed; /* ADD_STA_CMD_API_S_VER_10 */ /** * struct iwm_mvm_add_sta_key_cmd - add/modify sta key From owner-svn-src-all@freebsd.org Thu Nov 7 23:38:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F14BA17E8F3; Thu, 7 Nov 2019 23:38:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KbF5z5sz4YfC; Thu, 7 Nov 2019 23:38:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE3941D73D; Thu, 7 Nov 2019 23:38:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NcH3C074359; Thu, 7 Nov 2019 23:38:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NcHG4074358; Thu, 7 Nov 2019 23:38:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072338.xA7NcHG4074358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354512 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:38:18 -0000 Author: markj Date: Thu Nov 7 23:38:17 2019 New Revision: 354512 URL: https://svnweb.freebsd.org/changeset/base/354512 Log: iwm: Use antenna B for TX on 9000-series chips. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:37:55 2019 (r354511) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:38:17 2019 (r354512) @@ -3768,7 +3768,10 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node ); /* XXX TODO: hard-coded TX antenna? */ - rate_flags = 1 << IWM_RATE_MCS_ANT_POS; + if (sc->cfg->device_family == IWM_DEVICE_FAMILY_9000) + rate_flags = IWM_RATE_MCS_ANT_B_MSK; + else + rate_flags = IWM_RATE_MCS_ANT_A_MSK; if (IWM_RIDX_IS_CCK(ridx)) rate_flags |= IWM_RATE_MCS_CCK_MSK; tx->rate_n_flags = htole32(rate_flags | rinfo->plcp); From owner-svn-src-all@freebsd.org Thu Nov 7 23:38:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87E9717E975; Thu, 7 Nov 2019 23:38:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Kbd31MBz4Yn1; Thu, 7 Nov 2019 23:38:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB421D73F; Thu, 7 Nov 2019 23:38:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NcbWj074416; Thu, 7 Nov 2019 23:38:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NcaTS074414; Thu, 7 Nov 2019 23:38:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072338.xA7NcaTS074414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354513 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:38:37 -0000 Author: markj Date: Thu Nov 7 23:38:36 2019 New Revision: 354513 URL: https://svnweb.freebsd.org/changeset/base/354513 Log: iwm: Set flag for pad bytes in offload_assist. Though we don't otherwise use firmware's offload capabilities, we need to set this flag when the MAC header's size isn't a multiple of four. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:38:17 2019 (r354512) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:38:36 2019 (r354513) @@ -3882,11 +3882,12 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie if (hdrlen & 3) { /* First segment length must be a multiple of 4. */ flags |= IWM_TX_CMD_FLG_MH_PAD; + tx->offload_assist |= htole16(1 << IWM_TX_CMD_OFFLD_PAD); pad = 4 - (hdrlen & 3); - } else + } else { + tx->offload_assist = 0; pad = 0; - - tx->next_frame_len = 0; + } tx->len = htole16(totlen); tx->tid_tspec = tid; Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:38:17 2019 (r354512) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:38:36 2019 (r354513) @@ -4477,13 +4477,41 @@ enum iwm_tx_pm_timeouts { #define IWM_BAR_DFAULT_RETRY_LIMIT 60 #define IWM_LOW_RETRY_LIMIT 7 +/** + * enum iwm_tx_offload_assist_flags_pos - set %iwm_tx_cmd offload_assist values + * @IWM_TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words) + * from mac header end. For normal case it is 4 words for SNAP. + * note: tx_cmd, mac header and pad are not counted in the offset. + * This is used to help the offload in case there is tunneling such as + * IPv6 in IPv4, in such case the ip header offset should point to the + * inner ip header and IPv4 checksum of the external header should be + * calculated by driver. + * @IWM_TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum + * @IWM_TX_CMD_OFFLD_L3_EN: enable IP header checksum + * @IWM_TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV + * field. Doesn't include the pad. + * @IWM_TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for + * alignment + * @IWM_TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU + */ +enum iwm_tx_offload_assist_flags_pos { + IWM_TX_CMD_OFFLD_IP_HDR = 0, + IWM_TX_CMD_OFFLD_L4_EN = 6, + IWM_TX_CMD_OFFLD_L3_EN = 7, + IWM_TX_CMD_OFFLD_MH_SIZE = 8, + IWM_TX_CMD_OFFLD_PAD = 13, + IWM_TX_CMD_OFFLD_AMSDU = 14, +}; + +#define IWM_TX_CMD_OFFLD_MH_MASK 0x1f +#define IWM_TX_CMD_OFFLD_IP_HDR_MASK 0x3f + /* TODO: complete documentation for try_cnt and btkill_cnt */ /** * struct iwm_tx_cmd - TX command struct to FW * ( IWM_TX_CMD = 0x1c ) * @len: in bytes of the payload, see below for details - * @next_frame_len: same as len, but for next frame (0 if not applicable) - * Used for fragmentation and bursting, but not in 11n aggregation. + * @offload_assist: TX offload configuration * @tx_flags: combination of IWM_TX_CMD_FLG_* * @rate_n_flags: rate for *all* Tx attempts, if IWM_TX_CMD_FLG_STA_RATE_MSK is * cleared. Combination of IWM_RATE_MCS_* @@ -4519,7 +4547,7 @@ enum iwm_tx_pm_timeouts { */ struct iwm_tx_cmd { uint16_t len; - uint16_t next_frame_len; + uint16_t offload_assist; uint32_t tx_flags; struct { uint8_t try_cnt; From owner-svn-src-all@freebsd.org Thu Nov 7 23:38:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD88F17E9E6; Thu, 7 Nov 2019 23:38:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Kbs4Dy2z4YvP; Thu, 7 Nov 2019 23:38:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 748261D740; Thu, 7 Nov 2019 23:38:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NcnOb074467; Thu, 7 Nov 2019 23:38:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Ncnrh074466; Thu, 7 Nov 2019 23:38:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072338.xA7Ncnrh074466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354514 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:38:49 -0000 Author: markj Date: Thu Nov 7 23:38:49 2019 New Revision: 354514 URL: https://svnweb.freebsd.org/changeset/base/354514 Log: iwm: Use the default station for all transmits. This is what iwlwifi seems to do, and the previous behaviour triggered firmware panics during transmit on a 9560. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:38:36 2019 (r354513) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:38:49 2019 (r354514) @@ -3858,11 +3858,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie flags |= IWM_TX_CMD_FLG_PROT_REQUIRE; } - if (IEEE80211_IS_MULTICAST(wh->i_addr1) || - type != IEEE80211_FC0_TYPE_DATA) - tx->sta_id = sc->sc_aux_sta.sta_id; - else - tx->sta_id = IWM_STATION_ID; + tx->sta_id = IWM_STATION_ID; if (type == IEEE80211_FC0_TYPE_MGT) { uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; From owner-svn-src-all@freebsd.org Thu Nov 7 23:39:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9567717EA8E; Thu, 7 Nov 2019 23:39:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Kc93TZ7z4Z3J; Thu, 7 Nov 2019 23:39:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A6A81D741; Thu, 7 Nov 2019 23:39:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Nd5OY074526; Thu, 7 Nov 2019 23:39:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7Nd4bv074524; Thu, 7 Nov 2019 23:39:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072339.xA7Nd4bv074524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354515 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354515 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:39:05 -0000 Author: markj Date: Thu Nov 7 23:39:04 2019 New Revision: 354515 URL: https://svnweb.freebsd.org/changeset/base/354515 Log: iwm: Implement support for scans with "adaptive" dwell time. This is required by 9000-series firmware. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm_scan.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:38:49 2019 (r354514) +++ head/sys/dev/iwm/if_iwm_scan.c Thu Nov 7 23:39:04 2019 (r354515) @@ -580,6 +580,29 @@ iwm_mvm_scan_use_ebs(struct iwm_softc *sc) sc->last_ebs_successful); } +static int +iwm_mvm_scan_size(struct iwm_softc *sc) +{ + int base_size; + + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) { + if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) + base_size = IWM_SCAN_REQ_UMAC_SIZE_V7; + else + base_size = IWM_SCAN_REQ_UMAC_SIZE_V1; + + return base_size + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels + + sizeof(struct iwm_scan_req_umac_tail); + } else { + return sizeof(struct iwm_scan_req_lmac) + + sizeof(struct iwm_scan_channel_cfg_lmac) * + sc->sc_fw.ucode_capa.n_scan_channels + + sizeof(struct iwm_scan_probe_req); + } +} + int iwm_mvm_umac_scan(struct iwm_softc *sc) { @@ -593,13 +616,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) struct iwm_scan_req_umac *req; struct iwm_scan_req_umac_tail *tail; size_t req_len; - uint8_t i, nssid; + uint16_t general_flags; + uint8_t channel_flags, i, nssid; int ret; - req_len = sizeof(struct iwm_scan_req_umac) + - (sizeof(struct iwm_scan_channel_cfg_umac) * - sc->sc_fw.ucode_capa.n_scan_channels) + - sizeof(struct iwm_scan_req_umac_tail); + req_len = iwm_mvm_scan_size(sc); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO); @@ -611,28 +632,58 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); - /* These timings correspond to iwlwifi's UNASSOC scan. */ - req->active_dwell = 10; - req->passive_dwell = 110; - req->fragmented_dwell = 44; - req->extended_dwell = 90; - req->max_out_time = 0; - req->suspend_time = 0; + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); - req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + general_flags = IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | + IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE; + if (!iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL; + if (iwm_mvm_rrm_scan_needed(sc)) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED; + if (nssid != 0) + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT; + else + general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE; + + channel_flags = 0; + if (iwm_mvm_scan_use_ebs(sc)) + channel_flags = IWM_SCAN_CHANNEL_FLAG_EBS | + IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE | + IWM_SCAN_CHANNEL_FLAG_CACHE_ADD; + + req->general_flags = htole16(general_flags); req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); - nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); - req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_umac *)req->data, nssid); + /* These timings correspond to iwlwifi's UNASSOC scan. */ + if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) { + req->v7.active_dwell = 10; + req->v7.passive_dwell = 110; + req->v7.fragmented_dwell = 44; + req->v7.adwell_default_n_aps_social = 10; + req->v7.adwell_default_n_aps = 2; + req->v7.adwell_max_budget = htole16(300); + req->v7.scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + req->v7.channel.flags = channel_flags; + req->v7.channel.count = iwm_mvm_umac_scan_fill_channels(sc, + (struct iwm_scan_channel_cfg_umac *)req->v7.data, nssid); - req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | - IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | - IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL); + tail = (void *)((char *)&req->v7.data + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels); + } else { + req->v1.active_dwell = 10; + req->v1.passive_dwell = 110; + req->v1.fragmented_dwell = 44; + req->v1.extended_dwell = 90; + req->v1.scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + req->v1.channel.flags = channel_flags; + req->v1.channel.count = iwm_mvm_umac_scan_fill_channels(sc, + (struct iwm_scan_channel_cfg_umac *)req->v1.data, nssid); - tail = (void *)((char *)&req->data + - sizeof(struct iwm_scan_channel_cfg_umac) * - sc->sc_fw.ucode_capa.n_scan_channels); + tail = (void *)((char *)&req->v1.data + + sizeof(struct iwm_scan_channel_cfg_umac) * + sc->sc_fw.ucode_capa.n_scan_channels); + } /* Check if we're doing an active directed scan. */ for (i = 0; i < nssid; i++) { @@ -643,21 +694,7 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) tail->direct_scan[i].len); /* XXX debug */ } - if (nssid != 0) { - req->general_flags |= - htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); - } else - req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); - if (iwm_mvm_scan_use_ebs(sc)) - req->channel_flags = IWM_SCAN_CHANNEL_FLAG_EBS | - IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE | - IWM_SCAN_CHANNEL_FLAG_CACHE_ADD; - - if (iwm_mvm_rrm_scan_needed(sc)) - req->general_flags |= - htole32(IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED); - ret = iwm_mvm_fill_probe_req(sc, &tail->preq); if (ret) { free(req, M_DEVBUF); @@ -694,9 +731,7 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); - req_len = sizeof(struct iwm_scan_req_lmac) + - (sizeof(struct iwm_scan_channel_cfg_lmac) * - sc->sc_fw.ucode_capa.n_scan_channels) + sizeof(struct iwm_scan_probe_req); + req_len = iwm_mvm_scan_size(sc); if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE) return ENOMEM; req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO); Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:38:49 2019 (r354514) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:39:04 2019 (r354515) @@ -5488,21 +5488,44 @@ struct iwm_scan_req_umac_tail { } __packed; /** + * struct iwm_scan_uma_chan_param + * @flags: channel flags &enum iwm_scan_channel_flags + * @count: num of channels in scan request + * @reserved: for future use and alignment + */ +struct iwm_scan_umac_chan_param { + uint8_t flags; + uint8_t count; + uint16_t reserved; +} __packed; + +/** * struct iwm_scan_req_umac * @flags: &enum iwm_umac_scan_flags * @uid: scan id, &enum iwm_umac_scan_uid_offsets * @ooc_priority: out of channel priority - &enum iwm_scan_priority * @general_flags: &enum iwm_umac_scan_general_flags + * @scan_start_mac_id: report the scan start TSF time according to this mac TSF * @extended_dwell: dwell time for channels 1, 6 and 11 - * @active_dwell: dwell time for active scan - * @passive_dwell: dwell time for passive scan + * @active_dwell: dwell time for active scan per LMAC + * @passive_dwell: dwell time for passive scan per LMAC * @fragmented_dwell: dwell time for fragmented passive scan - * @max_out_time: max out of serving channel time - * @suspend_time: max suspend time - * @scan_priority: scan internal prioritization &enum iwm_scan_priority - * @channel_flags: &enum iwm_scan_channel_flags - * @n_channels: num of channels in scan request + * @adwell_default_n_aps: for adaptive dwell the default number of APs + * per channel + * @adwell_default_n_aps_social: for adaptive dwell the default + * number of APs per social (1,6,11) channel + * @general_flags2: &enum iwl_umac_scan_general_flags2 + * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added + * to total scan time + * @max_out_time: max out of serving channel time, per LMAC - for CDB there + * are 2 LMACs + * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs + * @scan_priority: scan internal prioritization &enum iwl_scan_priority + * @num_of_fragments: Number of fragments needed for full coverage per band. + * Relevant only for fragmented scan. + * @channel: &struct iwl_scan_umac_chan_param * @reserved: for future use and alignment + * @reserved3: for future use and alignment * @data: &struct iwm_scan_channel_cfg_umac and * &struct iwm_scan_req_umac_tail */ @@ -5510,21 +5533,40 @@ struct iwm_scan_req_umac { uint32_t flags; uint32_t uid; uint32_t ooc_priority; - /* SCAN_GENERAL_PARAMS_API_S_VER_1 */ - uint32_t general_flags; - uint8_t extended_dwell; - uint8_t active_dwell; - uint8_t passive_dwell; - uint8_t fragmented_dwell; - uint32_t max_out_time; - uint32_t suspend_time; - uint32_t scan_priority; - /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */ - uint8_t channel_flags; - uint8_t n_channels; - uint16_t reserved; - uint8_t data[]; -} __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */ + uint16_t general_flags; + uint8_t reserved; + uint8_t scan_start_mac_id; + union { + struct { + uint8_t extended_dwell; + uint8_t active_dwell; + uint8_t passive_dwell; + uint8_t fragmented_dwell; + uint32_t max_out_time; + uint32_t suspend_time; + uint32_t scan_priority; + struct iwm_scan_umac_chan_param channel; + uint8_t data[]; + } v1; + struct { + uint8_t active_dwell; + uint8_t passive_dwell; + uint8_t fragmented_dwell; + uint8_t adwell_default_n_aps; + uint8_t adwell_default_n_aps_social; + uint8_t reserved3; + uint16_t adwell_max_budget; + uint32_t max_out_time[2]; + uint32_t suspend_time[2]; + uint32_t scan_priority; + struct iwm_scan_umac_chan_param channel; + uint8_t data[]; + } v7; + }; +} __packed; + +#define IWM_SCAN_REQ_UMAC_SIZE_V7 48 +#define IWM_SCAN_REQ_UMAC_SIZE_V1 36 /** * struct iwm_umac_scan_abort From owner-svn-src-all@freebsd.org Thu Nov 7 23:39:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C434717EB2D; Thu, 7 Nov 2019 23:39:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KcQ4ksYz4Z9s; Thu, 7 Nov 2019 23:39:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 871C81D742; Thu, 7 Nov 2019 23:39:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NdIEp074589; Thu, 7 Nov 2019 23:39:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NdHK3074585; Thu, 7 Nov 2019 23:39:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072339.xA7NdHK3074585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354516 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 354516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:39:18 -0000 Author: markj Date: Thu Nov 7 23:39:17 2019 New Revision: 354516 URL: https://svnweb.freebsd.org/changeset/base/354516 Log: iwm: Sync device initialization and reset code with iwlwifi. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_pcie_trans.c head/sys/dev/iwm/if_iwmreg.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:39:04 2019 (r354515) +++ head/sys/dev/iwm/if_iwm.c Thu Nov 7 23:39:17 2019 (r354516) @@ -1353,6 +1353,8 @@ iwm_stop_device(struct iwm_softc *sc) */ iwm_enable_rfkill_int(sc); iwm_check_rfkill(sc); + + iwm_prepare_card_hw(sc); } /* iwlwifi: mvm/ops.c */ @@ -1381,7 +1383,15 @@ iwm_mvm_nic_config(struct iwm_softc *sc) reg_val |= radio_cfg_step << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_STEP; reg_val |= radio_cfg_dash << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; - IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG, reg_val); + IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG, + IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH | + IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH | + IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE | + IWM_CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | + IWM_CSR_HW_IF_CONFIG_REG_BIT_MAC_SI | + reg_val); IWM_DPRINTF(sc, IWM_DEBUG_RESET, "Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type, Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c ============================================================================== --- head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:39:04 2019 (r354515) +++ head/sys/dev/iwm/if_iwm_pcie_trans.c Thu Nov 7 23:39:17 2019 (r354516) @@ -346,6 +346,8 @@ iwm_enable_rfkill_int(struct iwm_softc *sc) { sc->sc_intmask = IWM_CSR_INT_BIT_RF_KILL; IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask); + IWM_SETBITS(sc, IWM_CSR_GP_CNTRL, + IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN); } int @@ -404,7 +406,9 @@ iwm_prepare_card_hw(struct iwm_softc *sc) if (iwm_set_hw_ready(sc)) goto out; - DELAY(100); + IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + DELAY(1000); /* If HW is not ready, prepare the conditions to check again */ IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG, @@ -590,6 +594,16 @@ iwm_apm_init(struct iwm_softc *sc) void iwm_apm_stop(struct iwm_softc *sc) { + IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG, + IWM_CSR_HW_IF_CONFIG_REG_PREPARE | + IWM_CSR_HW_IF_CONFIG_REG_ENABLE_PME); + DELAY(1000); + IWM_CLRBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG, + IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED); + DELAY(5000); + /* stop device's busmaster DMA activity */ IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_STOP_MASTER); @@ -597,6 +611,14 @@ iwm_apm_stop(struct iwm_softc *sc) IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, 100)) device_printf(sc->sc_dev, "timeout waiting for master\n"); + + /* + * Clear "initialization complete" bit to move adapter from + * D0A* (powered-up Active) --> D0U* (Uninitialized) state. + */ + IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL, + IWM_CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + IWM_DPRINTF(sc, IWM_DEBUG_TRANS, "%s: iwm apm stop\n", __func__); } Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:39:04 2019 (r354515) +++ head/sys/dev/iwm/if_iwmreg.h Thu Nov 7 23:39:17 2019 (r354516) @@ -289,7 +289,7 @@ #define IWM_CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) #define IWM_CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) -#define IWM_CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) +#define IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN (0x04000000) #define IWM_CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) From owner-svn-src-all@freebsd.org Thu Nov 7 23:39:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 757E117EBBB; Thu, 7 Nov 2019 23:39:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Kck2YQZz4ZJb; Thu, 7 Nov 2019 23:39:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23AEE1D743; Thu, 7 Nov 2019 23:39:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NdYW1074642; Thu, 7 Nov 2019 23:39:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NdXDj074640; Thu, 7 Nov 2019 23:39:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911072339.xA7NdXDj074640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 7 Nov 2019 23:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354517 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:39:34 -0000 Author: markj Date: Thu Nov 7 23:39:33 2019 New Revision: 354517 URL: https://svnweb.freebsd.org/changeset/base/354517 Log: Update iwm and iwmfw man pages with info about 9000-series chips. Thanks to bapt, bz, cem, woodsb02, Neel Chauhan and Salvador Martínez Mármol for helping test the initial 9000-series support. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/iwm.4 head/share/man/man4/iwmfw.4 Modified: head/share/man/man4/iwm.4 ============================================================================== --- head/share/man/man4/iwm.4 Thu Nov 7 23:39:17 2019 (r354516) +++ head/share/man/man4/iwm.4 Thu Nov 7 23:39:33 2019 (r354517) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWM 4 .Os .Sh NAME @@ -51,6 +51,8 @@ Choose one from: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Or you can use @@ -71,6 +73,8 @@ iwm7260fw_load="YES" iwm7265fw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION The @@ -84,6 +88,10 @@ driver provides support for: .It Intel Dual Band Wireless AC 7260 .It Intel Dual Band Wireless AC 7265 .It Intel Dual Band Wireless AC 8260 +.It Intel Dual Band Wireless AC 9260 +.It Intel Dual Band Wireless AC 9270 +.It Intel Dual Band Wireless AC 946X +.It Intel Dual Band Wireless AC 9560 .El .Pp .Nm Modified: head/share/man/man4/iwmfw.4 ============================================================================== --- head/share/man/man4/iwmfw.4 Thu Nov 7 23:39:17 2019 (r354516) +++ head/share/man/man4/iwmfw.4 Thu Nov 7 23:39:33 2019 (r354517) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWMFW 4 .Os .Sh NAME @@ -48,10 +48,12 @@ of the following: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place one of the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent iwm3160fw_load="YES" @@ -61,13 +63,14 @@ iwm7265fw_load="YES" iwm7265Dfw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, and 8260 series of -IEEE 802.11n/11ac adapters. -It may be -statically linked into the kernel, or loaded as a module. +Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, +9000 and 9260 series of IEEE 802.11n/11ac adapters. +It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO .Xr iwm 4 , .Xr firmware 9 From owner-svn-src-all@freebsd.org Thu Nov 7 23:50:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15D1717EFD0; Thu, 7 Nov 2019 23:50:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478KsP6vYcz4ZmL; Thu, 7 Nov 2019 23:50:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0DF01D920; Thu, 7 Nov 2019 23:50:33 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NoXkQ080524; Thu, 7 Nov 2019 23:50:33 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NoXS3080523; Thu, 7 Nov 2019 23:50:33 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911072350.xA7NoXS3080523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 23:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354518 - head X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354518 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:50:34 -0000 Author: brooks Date: Thu Nov 7 23:50:33 2019 New Revision: 354518 URL: https://svnweb.freebsd.org/changeset/base/354518 Log: Fix the ARCH check for LIB32 from Makefile.inc1. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 7 23:39:33 2019 (r354517) +++ head/Makefile.inc1 Thu Nov 7 23:50:33 2019 (r354518) @@ -803,6 +803,7 @@ XCFLAGS+= ${BFLAGS} .endif .if ${MK_LIB32} == "yes" +.error WTF _LIBCOMPAT= 32 .include "Makefile.libcompat" .elif ${MK_LIBSOFT} == "yes" From owner-svn-src-all@freebsd.org Thu Nov 7 23:54:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15DBD17F25E; Thu, 7 Nov 2019 23:54:41 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Ky86Pxxz4bBr; Thu, 7 Nov 2019 23:54:40 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFD9D1DADD; Thu, 7 Nov 2019 23:54:40 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7Nse4m086074; Thu, 7 Nov 2019 23:54:40 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NseBO086072; Thu, 7 Nov 2019 23:54:40 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911072354.xA7NseBO086072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 7 Nov 2019 23:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354519 - in head: . share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . share/mk X-SVN-Commit-Revision: 354519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:54:41 -0000 Author: brooks Date: Thu Nov 7 23:54:40 2019 New Revision: 354519 URL: https://svnweb.freebsd.org/changeset/base/354519 Log: Revert r354518 and commit the intented fix rather than the diagnostic check. This fixes the definition of MK_LIB32 in Makefile.inc1. Modified: head/Makefile.inc1 head/share/mk/src.opts.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Nov 7 23:50:33 2019 (r354518) +++ head/Makefile.inc1 Thu Nov 7 23:54:40 2019 (r354519) @@ -803,7 +803,6 @@ XCFLAGS+= ${BFLAGS} .endif .if ${MK_LIB32} == "yes" -.error WTF _LIBCOMPAT= 32 .include "Makefile.libcompat" .elif ${MK_LIBSOFT} == "yes" Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Nov 7 23:50:33 2019 (r354518) +++ head/share/mk/src.opts.mk Thu Nov 7 23:54:40 2019 (r354519) @@ -358,8 +358,7 @@ __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC .endif # LIB32 is supported on amd64, mips64, and powerpc64 -.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH:Mmips64*} || \ - ${MACHINE_ARCH} == "powerpc64") +.if (${__T} == "amd64" || ${__T:Mmips64*} || ${__T} == "powerpc64") __DEFAULT_YES_OPTIONS+=LIB32 .else BROKEN_OPTIONS+=LIB32 From owner-svn-src-all@freebsd.org Thu Nov 7 23:57:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B762017F599; Thu, 7 Nov 2019 23:57:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478L1m4R9Yz4bLx; Thu, 7 Nov 2019 23:57:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B6271DAE1; Thu, 7 Nov 2019 23:57:48 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA7NvmZ1086277; Thu, 7 Nov 2019 23:57:48 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA7NvmSv086276; Thu, 7 Nov 2019 23:57:48 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911072357.xA7NvmSv086276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 7 Nov 2019 23:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354520 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 354520 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 23:57:48 -0000 Author: lwhsu Date: Thu Nov 7 23:57:48 2019 New Revision: 354520 URL: https://svnweb.freebsd.org/changeset/base/354520 Log: Get the fix in back by reverting the part accidentally included in r354491. This brings back r354467. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/lib/msun/src/k_sincosl.h Modified: head/lib/msun/src/k_sincosl.h ============================================================================== --- head/lib/msun/src/k_sincosl.h Thu Nov 7 23:54:40 2019 (r354519) +++ head/lib/msun/src/k_sincosl.h Thu Nov 7 23:57:48 2019 (r354520) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-all@freebsd.org Fri Nov 8 00:01:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A78817F705; Fri, 8 Nov 2019 00:01:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478L6B2jgvz4bZD; Fri, 8 Nov 2019 00:01:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 401331DC4C; Fri, 8 Nov 2019 00:01:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA801c7V089615; Fri, 8 Nov 2019 00:01:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA801cel089614; Fri, 8 Nov 2019 00:01:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911080001.xA801cel089614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 8 Nov 2019 00:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354521 - head X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 00:01:38 -0000 Author: markj Date: Fri Nov 8 00:01:37 2019 New Revision: 354521 URL: https://svnweb.freebsd.org/changeset/base/354521 Log: Document iwm(4) support for 9000-series devices. Sponsored by: The FreeBSD Foundation Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Thu Nov 7 23:57:48 2019 (r354520) +++ head/RELNOTES Fri Nov 8 00:01:37 2019 (r354521) @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r354517: + iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices. + r354269: sqlite3 is updated to sqlite3-3.30.1. From owner-svn-src-all@freebsd.org Fri Nov 8 01:13:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D61971A1D38; Fri, 8 Nov 2019 01:13:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Mhm5Hn4z4fFg; Fri, 8 Nov 2019 01:13:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 996E21E8FA; Fri, 8 Nov 2019 01:13:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA81DCxe032932; Fri, 8 Nov 2019 01:13:12 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA81DC5L032931; Fri, 8 Nov 2019 01:13:12 GMT (envelope-from np@FreeBSD.org) Message-Id: <201911080113.xA81DC5L032931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 8 Nov 2019 01:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354522 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 354522 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 01:13:12 -0000 Author: np Date: Fri Nov 8 01:13:12 2019 New Revision: 354522 URL: https://svnweb.freebsd.org/changeset/base/354522 Log: cxgbe(4): Query Vdd from the firmware if its last known value is 0. TVSENSE may not be ready by the time t4_fw_initialize returns and the firmware returns 0 if the driver asks for the Vdd before the sensor is ready. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Nov 8 00:01:37 2019 (r354521) +++ head/sys/dev/cxgbe/t4_main.c Fri Nov 8 01:13:12 2019 (r354522) @@ -656,6 +656,7 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS); static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); +static int sysctl_vdd(SYSCTL_HANDLER_ARGS); static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); @@ -6153,8 +6154,8 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", "microprocessor load averages (debug firmwares only)"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, - &sc->params.core_vdd, 0, "core Vdd (in mV)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "core_vdd", CTLTYPE_INT | + CTLFLAG_RD, sc, 0, sysctl_vdd, "I", "core Vdd (in mV)"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus", CTLTYPE_STRING | CTLFLAG_RD, sc, LOCAL_CPUS, @@ -7292,6 +7293,31 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) rc = sysctl_handle_int(oidp, &t, 0, req); return (rc); +} + +static int +sysctl_vdd(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int rc; + uint32_t param, val; + + if (sc->params.core_vdd == 0) { + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, + "t4vdd"); + if (rc) + return (rc); + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_VDD); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + sc->params.core_vdd = val; + } + + return (sysctl_handle_int(oidp, &sc->params.core_vdd, 0, req)); } static int From owner-svn-src-all@freebsd.org Fri Nov 8 03:14:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75E551A51F1; Fri, 8 Nov 2019 03:14:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478QNH2VD9z3Hgf; Fri, 8 Nov 2019 03:14:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 391641FE9B; Fri, 8 Nov 2019 03:14:07 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA83E7rI004517; Fri, 8 Nov 2019 03:14:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA83E7GO004516; Fri, 8 Nov 2019 03:14:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911080314.xA83E7GO004516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 8 Nov 2019 03:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354523 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 03:14:07 -0000 Author: brooks Date: Fri Nov 8 03:14:06 2019 New Revision: 354523 URL: https://svnweb.freebsd.org/changeset/base/354523 Log: Turn the error about a lack of LIBCOMPAT into a warning. Add some diagnostic output. This works around the fact that buildworld calls cleandir in libexec with the wrong MACHINE_ARCH (i386 on amd64) when the OBJ directory is empty. Reported by: bdragon, jkim Modified: head/share/mk/bsd.compat.mk Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Fri Nov 8 01:13:12 2019 (r354522) +++ head/share/mk/bsd.compat.mk Fri Nov 8 03:14:06 2019 (r354523) @@ -103,7 +103,7 @@ LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP # In the program linking case, select LIBCOMPAT .if defined(NEED_COMPAT) .ifndef HAS_COMPAT -.error NEED_COMPAT defined, but no LIBCOMPAT is available +.warning NEED_COMPAT defined, but no LIBCOMPAT is available (COMPAT_ARCH == ${COMPAT_ARCH} .elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any" .error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT ($HAS_COMPAT) .elif ${NEED_COMPAT} == "any" From owner-svn-src-all@freebsd.org Fri Nov 8 03:27:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60FD71A555C; Fri, 8 Nov 2019 03:27:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478QhF1njXz3JDW; Fri, 8 Nov 2019 03:27:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 207782007A; Fri, 8 Nov 2019 03:27:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA83RvEB010607; Fri, 8 Nov 2019 03:27:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA83Rvur010606; Fri, 8 Nov 2019 03:27:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911080327.xA83Rvur010606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 8 Nov 2019 03:27:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354524 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354524 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 03:27:57 -0000 Author: kevans Date: Fri Nov 8 03:27:56 2019 New Revision: 354524 URL: https://svnweb.freebsd.org/changeset/base/354524 Log: bcm2835_dma: Mark IRQs shareable On the RPi4, some of these IRQs are shared. Start moving toward a mode where we accept that shared IRQs happen and simply ignore interrupts that are seemingly for no reason. I would like to be more verbose here, but my 30-minute assessment of the current world order is that mapping a resource/rid to an actual IRQ number (as found in FDT) data is not a simple matter. Determining if more than one handler is attached to an IRQ is closer to feasible, but it's unclear which way is the cleaner path. Beyond that, we're only really using it to be slightly more verbose when something's going wrong, so for now just suppress and drop a complaint-comment. This was originally submitted (via freebsd-arm@) by Robert Crowston; the additional verbosity was dropped by kevans@. Submitted by: Robert Crowston Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Nov 8 03:14:06 2019 (r354523) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Nov 8 03:27:56 2019 (r354524) @@ -619,18 +619,18 @@ bcm_dma_intr(void *arg) /* my interrupt? */ cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch)); - if (!(cs & (CS_INT | CS_ERR))) { - device_printf(sc->sc_dev, - "unexpected DMA intr CH=%d, CS=%x\n", ch->ch, cs); + /* + * Is it an active channel? Our diagnostics could be better here, but + * it's not necessarily an easy task to resolve a rid/resource to an + * actual irq number. We'd want to do this to set a flag indicating + * whether the irq is shared or not, so we know to complain. + */ + if (!(ch->flags & BCM_DMA_CH_USED)) return; - } - /* running? */ - if (!(ch->flags & BCM_DMA_CH_USED)) { - device_printf(sc->sc_dev, - "unused DMA intr CH=%d, CS=%x\n", ch->ch, cs); + /* Again, we can't complain here. The same logic applies. */ + if (!(cs & (CS_INT | CS_ERR))) return; - } if (cs & CS_ERR) { debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch)); @@ -715,7 +715,7 @@ bcm_dma_attach(device_t dev) continue; sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->sc_irq[rid] == NULL) { device_printf(dev, "cannot allocate interrupt\n"); err = ENXIO; From owner-svn-src-all@freebsd.org Fri Nov 8 03:36:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABB851A58CF; Fri, 8 Nov 2019 03:36:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Qsw3mwRz3Jvt; Fri, 8 Nov 2019 03:36:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6418B2023F; Fri, 8 Nov 2019 03:36:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA83aKux016535; Fri, 8 Nov 2019 03:36:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA83aJZQ016532; Fri, 8 Nov 2019 03:36:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911080336.xA83aJZQ016532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 8 Nov 2019 03:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354525 - in head/sys/powerpc: include mpc85xx ofw powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include mpc85xx ofw powerpc X-SVN-Commit-Revision: 354525 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 03:36:20 -0000 Author: jhibbits Date: Fri Nov 8 03:36:19 2019 New Revision: 354525 URL: https://svnweb.freebsd.org/changeset/base/354525 Log: powerpc/mpc85xx: Add MSI support for Freescale PowerPC SoCs Freescale SoCs use a set of IRQs at the high end of the OpenPIC IRQ list, not counted in the NIRQs of the Feature reporting register. Some SoCs include a MSI inbound window in the PCIe controller configuration registers as well, but some don't. Currently, this only handles the SoCs *with* the MSI window. There are 256 MSIs per MSI bank (32 per MSI IRQ, 8 IRQs per MSI bank). The P5020 has 3 banks, yielding up to 768 MSIs; older SoCs have only one bank. Modified: head/sys/powerpc/include/openpicvar.h head/sys/powerpc/mpc85xx/pci_mpc85xx.c head/sys/powerpc/ofw/openpic_ofw.c head/sys/powerpc/powerpc/openpic.c Modified: head/sys/powerpc/include/openpicvar.h ============================================================================== --- head/sys/powerpc/include/openpicvar.h Fri Nov 8 03:27:56 2019 (r354524) +++ head/sys/powerpc/include/openpicvar.h Fri Nov 8 03:36:19 2019 (r354525) @@ -35,6 +35,7 @@ #define OPENPIC_IRQMAX 256 /* h/w allows more */ #define OPENPIC_QUIRK_SINGLE_BIND 1 /* Bind interrupts to only 1 CPU */ +#define OPENPIC_QUIRK_HIDDEN_IRQS 2 /* May have IRQs beyond FRR[NIRQ] */ /* Names match the macros in openpicreg.h. */ struct openpic_timer { Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Fri Nov 8 03:27:56 2019 (r354524) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Fri Nov 8 03:36:19 2019 (r354525) @@ -51,8 +51,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include @@ -67,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" #include "pcib_if.h" +#include "pic_if.h" #include #include @@ -80,6 +83,12 @@ __FBSDID("$FreeBSD$"); #define REG_CFG_DATA 0x0004 #define REG_INT_ACK 0x0008 +#define REG_PEX_IP_BLK_REV1 0x0bf8 +#define IP_MJ_M 0x0000ff00 +#define IP_MJ_S 8 +#define IP_MN_M 0x000000ff +#define IP_MN_S 0 + #define REG_POTAR(n) (0x0c00 + 0x20 * (n)) #define REG_POTEAR(n) (0x0c04 + 0x20 * (n)) #define REG_POWBAR(n) (0x0c08 + 0x20 * (n)) @@ -89,6 +98,12 @@ __FBSDID("$FreeBSD$"); #define REG_PIWBAR(n) (0x0e08 - 0x20 * (n)) #define REG_PIWBEAR(n) (0x0e0c - 0x20 * (n)) #define REG_PIWAR(n) (0x0e10 - 0x20 * (n)) +#define PIWAR_EN 0x80000000 +#define PIWAR_PF 0x40000000 +#define PIWAR_TRGT_M 0x00f00000 +#define PIWAR_TRGT_S 20 +#define PIWAR_TRGT_CCSR 0xe +#define PIWAR_TRGT_LOCAL 0xf #define REG_PEX_MES_DR 0x0020 #define REG_PEX_MES_IER 0x0028 @@ -123,10 +138,14 @@ __FBSDID("$FreeBSD$"); #define DEVFN(b, s, f) ((b << 16) | (s << 8) | f) +#define FSL_NUM_MSIS 256 /* 8 registers of 32 bits (8 hardware IRQs) */ + struct fsl_pcib_softc { struct ofw_pci_softc pci_sc; device_t sc_dev; struct mtx sc_cfg_mtx; + int sc_ip_maj; + int sc_ip_min; int sc_iomem_target; bus_addr_t sc_iomem_start, sc_iomem_end; @@ -151,6 +170,14 @@ struct fsl_pcib_err_dr { uint32_t err_dr_mask; }; +struct fsl_msi_map { + SLIST_ENTRY(fsl_msi_map) slist; + uint32_t irq_base; + bus_addr_t target; +}; + +SLIST_HEAD(msi_head, fsl_msi_map) fsl_msis = SLIST_HEAD_INITIALIZER(msi_head); + static const struct fsl_pcib_err_dr pci_err[] = { {"ME", REG_PEX_ERR_DR_ME}, {"PCT", REG_PEX_ERR_DR_PCT}, @@ -195,7 +222,17 @@ static int fsl_pcib_maxslots(device_t); static uint32_t fsl_pcib_read_config(device_t, u_int, u_int, u_int, u_int, int); static void fsl_pcib_write_config(device_t, u_int, u_int, u_int, u_int, uint32_t, int); +static int fsl_pcib_alloc_msi(device_t dev, device_t child, + int count, int maxcount, int *irqs); +static int fsl_pcib_release_msi(device_t dev, device_t child, + int count, int *irqs); +static int fsl_pcib_alloc_msix(device_t dev, device_t child, int *irq); +static int fsl_pcib_release_msix(device_t dev, device_t child, int irq); +static int fsl_pcib_map_msi(device_t dev, device_t child, + int irq, uint64_t *addr, uint32_t *data); +static vmem_t *msi_vmem; /* Global MSI vmem, holds all MSI ranges. */ + /* * Bus interface definitions. */ @@ -209,6 +246,11 @@ static device_method_t fsl_pcib_methods[] = { DEVMETHOD(pcib_maxslots, fsl_pcib_maxslots), DEVMETHOD(pcib_read_config, fsl_pcib_read_config), DEVMETHOD(pcib_write_config, fsl_pcib_write_config), + DEVMETHOD(pcib_alloc_msi, fsl_pcib_alloc_msi), + DEVMETHOD(pcib_release_msi, fsl_pcib_release_msi), + DEVMETHOD(pcib_alloc_msix, fsl_pcib_alloc_msix), + DEVMETHOD(pcib_release_msix, fsl_pcib_release_msix), + DEVMETHOD(pcib_map_msi, fsl_pcib_map_msi), DEVMETHOD_END }; @@ -272,7 +314,7 @@ fsl_pcib_attach(device_t dev) { struct fsl_pcib_softc *sc; phandle_t node; - uint32_t cfgreg, brctl; + uint32_t cfgreg, brctl, ipreg; int error, rid; uint8_t ltssm, capptr; @@ -290,6 +332,9 @@ fsl_pcib_attach(device_t dev) sc->sc_bsh = rman_get_bushandle(sc->sc_res); sc->sc_busnr = 0; + ipreg = bus_read_4(sc->sc_res, REG_PEX_IP_BLK_REV1); + sc->sc_ip_min = (ipreg & IP_MN_M) >> IP_MN_S; + sc->sc_ip_maj = (ipreg & IP_MJ_M) >> IP_MJ_S; mtx_init(&sc->sc_cfg_mtx, "pcicfg", NULL, MTX_SPIN); cfgreg = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_VENDOR, 2); @@ -533,14 +578,16 @@ fsl_pcib_inbound(struct fsl_pcib_softc *sc, int wnd, i KASSERT(wnd > 0, ("%s: inbound window 0 is invalid", __func__)); + attr = PIWAR_EN; + switch (tgt) { - /* XXX OCP85XX_TGTIF_RAM2, OCP85XX_TGTIF_RAM_INTL should be handled */ - case OCP85XX_TGTIF_RAM1_85XX: - case OCP85XX_TGTIF_RAM1_QORIQ: - attr = 0xa0f55000 | (ffsl(size) - 2); + case -1: + attr &= ~PIWAR_EN; break; + case PIWAR_TRGT_LOCAL: + attr |= (ffsl(size) - 2); default: - attr = 0; + attr |= (tgt << PIWAR_TRGT_S); break; } tar = start >> 12; @@ -702,8 +749,209 @@ fsl_pcib_decode_win(phandle_t node, struct fsl_pcib_so fsl_pcib_inbound(sc, 1, -1, 0, 0, 0); fsl_pcib_inbound(sc, 2, -1, 0, 0, 0); - fsl_pcib_inbound(sc, 3, OCP85XX_TGTIF_RAM1, 0, - 2U * 1024U * 1024U * 1024U, 0); + fsl_pcib_inbound(sc, 3, PIWAR_TRGT_LOCAL, 0, + ptoa(Maxmem), 0); + /* Direct-map the CCSR for MSIs. */ + /* Freescale PCIe 2.x has a dedicated MSI window. */ + /* inbound window 8 makes it hit 0xD00 offset, the MSI window. */ + if (sc->sc_ip_maj >= 2) + fsl_pcib_inbound(sc, 8, PIWAR_TRGT_CCSR, ccsrbar_pa, + ccsrbar_size, ccsrbar_pa); + else + fsl_pcib_inbound(sc, 1, PIWAR_TRGT_CCSR, ccsrbar_pa, + ccsrbar_size, ccsrbar_pa); + return (0); } + +static int fsl_pcib_alloc_msi(device_t dev, device_t child, + int count, int maxcount, int *irqs) +{ + struct fsl_pcib_softc *sc; + vmem_addr_t start; + int err, i; + + sc = device_get_softc(dev); + if (msi_vmem == NULL) + return (ENODEV); + + err = vmem_xalloc(msi_vmem, count, powerof2(count), 0, 0, + VMEM_ADDR_MIN, VMEM_ADDR_MAX, M_BESTFIT | M_WAITOK, &start); + + if (err) + return (err); + + for (i = 0; i < count; i++) + irqs[i] = start + i; + + return (0); +} + +static int fsl_pcib_release_msi(device_t dev, device_t child, + int count, int *irqs) +{ + if (msi_vmem == NULL) + return (ENODEV); + + vmem_xfree(msi_vmem, irqs[0], count); + return (0); +} + +static int fsl_pcib_alloc_msix(device_t dev, device_t child, int *irq) +{ + return (fsl_pcib_alloc_msi(dev, child, 1, 1, irq)); +} + +static int fsl_pcib_release_msix(device_t dev, device_t child, int irq) +{ + return (fsl_pcib_release_msi(dev, child, 1, &irq)); +} + +static int fsl_pcib_map_msi(device_t dev, device_t child, + int irq, uint64_t *addr, uint32_t *data) +{ + struct fsl_msi_map *mp; + + SLIST_FOREACH(mp, &fsl_msis, slist) { + if (irq >= mp->irq_base && irq < mp->irq_base + FSL_NUM_MSIS) + break; + } + + if (mp == NULL) + return (ENODEV); + + *data = (irq & 255); + *addr = ccsrbar_pa + mp->target; + + return (0); +} + + +/* + * Linux device trees put the msi@ as children of the SoC, with ranges based + * on the CCSR. Since rman doesn't permit overlapping or sub-ranges between + * devices (bus_space_subregion(9) could do it, but let's not touch the PIC + * driver just to allocate a subregion for a sibling driver). This driver will + * use ccsr_write() and ccsr_read() instead. + */ + +#define FSL_NUM_IRQS 8 +#define FSL_NUM_MSI_PER_IRQ 32 +#define FSL_MSI_TARGET 0x140 + +struct fsl_msi_softc { + vm_offset_t sc_base; + vm_offset_t sc_target; + int sc_msi_base_irq; + struct fsl_msi_map sc_map; + struct fsl_msi_irq { + /* This struct gets passed as the filter private data. */ + struct fsl_msi_softc *sc_ptr; /* Pointer back to softc. */ + struct resource *res; + int irq; + void *cookie; + int vectors[FSL_NUM_MSI_PER_IRQ]; + vm_offset_t reg; + } sc_msi_irq[FSL_NUM_IRQS]; +}; + +static int +fsl_msi_intr_filter(void *priv) +{ + struct fsl_msi_irq *data = priv; + uint32_t reg; + int i; + + reg = ccsr_read4(ccsrbar_va + data->reg); + i = 0; + while (reg != 0) { + if (reg & 1) + powerpc_dispatch_intr(data->vectors[i], NULL); + reg >>= 1; + i++; + } + + return (FILTER_HANDLED); +} + +static int +fsl_msi_probe(device_t dev) +{ + if (!ofw_bus_is_compatible(dev, "fsl,mpic-msi")) + return (ENXIO); + + device_set_desc(dev, "Freescale MSI"); + + return (BUS_PROBE_DEFAULT); +} + +static int +fsl_msi_attach(device_t dev) +{ + struct fsl_msi_softc *sc; + struct fsl_msi_irq *irq; + int i; + + sc = device_get_softc(dev); + + if (msi_vmem == NULL) + msi_vmem = vmem_create("MPIC MSI", 0, 0, 1, 1, M_BESTFIT | M_WAITOK); + + /* Manually play with resource entries. */ + sc->sc_base = bus_get_resource_start(dev, SYS_RES_MEMORY, 0); + sc->sc_map.target = bus_get_resource_start(dev, SYS_RES_MEMORY, 1); + + if (sc->sc_map.target == 0) + sc->sc_map.target = sc->sc_base + FSL_MSI_TARGET; + + for (i = 0; i < FSL_NUM_IRQS; i++) { + irq = &sc->sc_msi_irq[i]; + irq->irq = i; + irq->reg = sc->sc_base + 16 * i; + irq->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &irq->irq, RF_ACTIVE); + bus_setup_intr(dev, irq->res, INTR_TYPE_MISC | INTR_MPSAFE, + fsl_msi_intr_filter, NULL, irq, &irq->cookie); + } + sc->sc_map.irq_base = powerpc_register_pic(dev, ofw_bus_get_node(dev), + FSL_NUM_MSIS, 0, 0); + + /* Let vmem and the IRQ subsystem work their magic for allocations. */ + vmem_add(msi_vmem, sc->sc_map.irq_base, FSL_NUM_MSIS, M_WAITOK); + + SLIST_INSERT_HEAD(&fsl_msis, &sc->sc_map, slist); + + return (0); +} + +static void +fsl_msi_enable(device_t dev, u_int irq, u_int vector, void **priv) +{ + struct fsl_msi_softc *sc; + struct fsl_msi_irq *irqd; + + sc = device_get_softc(dev); + + irqd = &sc->sc_msi_irq[irq / FSL_NUM_MSI_PER_IRQ]; + irqd->vectors[irq % FSL_NUM_MSI_PER_IRQ] = vector; +} + +static device_method_t fsl_msi_methods[] = { + DEVMETHOD(device_probe, fsl_msi_probe), + DEVMETHOD(device_attach, fsl_msi_attach), + + DEVMETHOD(pic_enable, fsl_msi_enable), + DEVMETHOD_END +}; + +static devclass_t fsl_msi_devclass; + +static driver_t fsl_msi_driver = { + "fsl_msi", + fsl_msi_methods, + sizeof(struct fsl_msi_softc) +}; + +EARLY_DRIVER_MODULE(fsl_msi, simplebus, fsl_msi_driver, fsl_msi_devclass, 0, 0, + BUS_PASS_INTERRUPT + 1); Modified: head/sys/powerpc/ofw/openpic_ofw.c ============================================================================== --- head/sys/powerpc/ofw/openpic_ofw.c Fri Nov 8 03:27:56 2019 (r354524) +++ head/sys/powerpc/ofw/openpic_ofw.c Fri Nov 8 03:36:19 2019 (r354525) @@ -139,8 +139,10 @@ openpic_ofw_attach(device_t dev) OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1) xref = node; - if (ofw_bus_is_compatible(dev, "fsl,mpic")) + if (ofw_bus_is_compatible(dev, "fsl,mpic")) { sc->sc_quirks = OPENPIC_QUIRK_SINGLE_BIND; + sc->sc_quirks |= OPENPIC_QUIRK_HIDDEN_IRQS; + } return (openpic_common_attach(dev, xref)); } Modified: head/sys/powerpc/powerpc/openpic.c ============================================================================== --- head/sys/powerpc/powerpc/openpic.c Fri Nov 8 03:27:56 2019 (r354524) +++ head/sys/powerpc/powerpc/openpic.c Fri Nov 8 03:36:19 2019 (r354525) @@ -52,6 +52,8 @@ #include "pic_if.h" +#define OPENPIC_NIPIS 4 + devclass_t openpic_devclass; /* @@ -182,6 +184,14 @@ openpic_common_attach(device_t dev, uint32_t node) "Version %s, supports %d CPUs and %d irqs\n", sc->sc_version, sc->sc_ncpu, sc->sc_nirq); + /* + * Allow more IRQs than what the PIC says it handles. Some Freescale PICs + * have MSIs that show up above the PIC's self-described 196 IRQs + * (P5020 starts MSI IRQs at 224). + */ + if (sc->sc_quirks & OPENPIC_QUIRK_HIDDEN_IRQS) + sc->sc_nirq = OPENPIC_IRQMAX - OPENPIC_NIPIS; + for (cpu = 0; cpu < sc->sc_ncpu; cpu++) openpic_write(sc, OPENPIC_PCPU_TPR(cpu), 15); @@ -196,7 +206,7 @@ openpic_common_attach(device_t dev, uint32_t node) } /* Reset and disable all IPIs. */ - for (ipi = 0; ipi < 4; ipi++) { + for (ipi = 0; ipi < OPENPIC_NIPIS; ipi++) { x = sc->sc_nirq + ipi; x |= OPENPIC_IMASK; x |= 15 << OPENPIC_PRIORITY_SHIFT; @@ -221,7 +231,7 @@ openpic_common_attach(device_t dev, uint32_t node) for (cpu = 0; cpu < sc->sc_ncpu; cpu++) openpic_write(sc, OPENPIC_PCPU_TPR(cpu), 0); - powerpc_register_pic(dev, node, sc->sc_nirq, 4, FALSE); + powerpc_register_pic(dev, node, sc->sc_nirq, OPENPIC_NIPIS, FALSE); /* If this is not a cascaded PIC, it must be the root PIC */ if (sc->sc_intr == NULL) @@ -411,7 +421,7 @@ openpic_suspend(device_t dev) sc = device_get_softc(dev); sc->sc_saved_config = bus_read_4(sc->sc_memr, OPENPIC_CONFIG); - for (i = 0; i < 4; i++) { + for (i = 0; i < OPENPIC_NIPIS; i++) { sc->sc_saved_ipis[i] = bus_read_4(sc->sc_memr, OPENPIC_IPI_VECTOR(i)); } @@ -442,7 +452,7 @@ openpic_resume(device_t dev) sc = device_get_softc(dev); sc->sc_saved_config = bus_read_4(sc->sc_memr, OPENPIC_CONFIG); - for (i = 0; i < 4; i++) { + for (i = 0; i < OPENPIC_NIPIS; i++) { bus_write_4(sc->sc_memr, OPENPIC_IPI_VECTOR(i), sc->sc_saved_ipis[i]); } From owner-svn-src-all@freebsd.org Fri Nov 8 03:45:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 775F61A5DAA; Fri, 8 Nov 2019 03:45:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478R4B2CVBz3Kcq; Fri, 8 Nov 2019 03:45:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F36320409; Fri, 8 Nov 2019 03:45:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA83jErf022219; Fri, 8 Nov 2019 03:45:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA83jDhk022217; Fri, 8 Nov 2019 03:45:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911080345.xA83jDhk022217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 8 Nov 2019 03:45:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354526 - in head/sys/powerpc: booke include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: booke include X-SVN-Commit-Revision: 354526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 03:45:14 -0000 Author: jhibbits Date: Fri Nov 8 03:45:13 2019 New Revision: 354526 URL: https://svnweb.freebsd.org/changeset/base/354526 Log: powerpc/booke: Make the TLB save area and mask match Since TLB_MAXNEST is 3, the insert mask should only be 2 bits. Given that 2 bits counts to 4, and that we already have plenty of space wasted in padding, make the nest level 4 to match the mask. Modified: head/sys/powerpc/booke/trap_subr.S head/sys/powerpc/include/pcpu.h Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Fri Nov 8 03:36:19 2019 (r354525) +++ head/sys/powerpc/booke/trap_subr.S Fri Nov 8 03:45:13 2019 (r354526) @@ -365,14 +365,14 @@ ld %r30, (TLBSAVE_BOOKE_R30)(br); \ ld %r31, (TLBSAVE_BOOKE_R31)(br); #define TLB_NEST(outr,inr) \ - rlwinm outr, inr, 7, 22, 24; /* 8 x TLBSAVE_LEN */ + rlwinm outr, inr, 7, 23, 24; /* 8 x TLBSAVE_LEN */ #else #define TLB_SAVE_REGS(br) \ stmw %r20, TLBSAVE_BOOKE_R20(br) #define TLB_RESTORE_REGS(br) \ lmw %r20, TLBSAVE_BOOKE_R20(br) #define TLB_NEST(outr,inr) \ - rlwinm outr, inr, 6, 23, 25; /* 4 x TLBSAVE_LEN */ + rlwinm outr, inr, 6, 24, 25; /* 4 x TLBSAVE_LEN */ #endif #define TLB_PROLOG \ mtspr SPR_SPRG4, %r1; /* Save SP */ \ Modified: head/sys/powerpc/include/pcpu.h ============================================================================== --- head/sys/powerpc/include/pcpu.h Fri Nov 8 03:36:19 2019 (r354525) +++ head/sys/powerpc/include/pcpu.h Fri Nov 8 03:45:13 2019 (r354526) @@ -77,14 +77,14 @@ struct pvo_entry; #endif #define BOOKE_CRITSAVE_LEN (CPUSAVE_LEN + 2) -#define BOOKE_TLB_MAXNEST 3 +#define BOOKE_TLB_MAXNEST 4 #define BOOKE_TLB_SAVELEN 16 #define BOOKE_TLBSAVE_LEN (BOOKE_TLB_SAVELEN * BOOKE_TLB_MAXNEST) #ifdef __powerpc64__ #define BOOKE_PCPU_PAD 901 #else -#define BOOKE_PCPU_PAD 429 +#define BOOKE_PCPU_PAD 365 #endif #define PCPU_MD_BOOKE_FIELDS \ register_t critsave[BOOKE_CRITSAVE_LEN]; \ From owner-svn-src-all@freebsd.org Fri Nov 8 04:26:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D62A81A6A92; Fri, 8 Nov 2019 04:26:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Rzb5Kj6z3MSf; Fri, 8 Nov 2019 04:26:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B31E20B25; Fri, 8 Nov 2019 04:26:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA84QJKG046506; Fri, 8 Nov 2019 04:26:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA84QJrM046505; Fri, 8 Nov 2019 04:26:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201911080426.xA84QJrM046505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 8 Nov 2019 04:26:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354527 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 354527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 04:26:19 -0000 Author: jhibbits Date: Fri Nov 8 04:26:19 2019 New Revision: 354527 URL: https://svnweb.freebsd.org/changeset/base/354527 Log: powerpc/booke: Only handle kernel page faults in KVA range The memory range between VM_MAXUSER_ADDRESS and VM_MIN_KERNEL_ADDRESS is reserved for devices currently, which are always mapped in TLB1, and therefore do not exist in the kernel page table. Any page fault in this range is therefore automatically a fatal fault. Modified: head/sys/powerpc/booke/trap_subr.S Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Fri Nov 8 03:45:13 2019 (r354526) +++ head/sys/powerpc/booke/trap_subr.S Fri Nov 8 04:26:19 2019 (r354527) @@ -713,6 +713,15 @@ INTERRUPT(int_data_tlb_error) mtcr %r21 bt 17, search_failed /* check MSR[PR] */ +#ifdef __powerpc64__ + srdi %r21, %r31, 48 + cmpldi cr0, %r21, VM_MIN_KERNEL_ADDRESS@highest +#else + lis %r21, VM_MIN_KERNEL_ADDRESS@h + cmplw cr0, %r31, %r21 +#endif + blt search_failed + search_kernel_pmap: /* Load r26 with kernel_pmap address */ bl 1f From owner-svn-src-all@freebsd.org Fri Nov 8 06:40:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 504C61A8CB4; Fri, 8 Nov 2019 06:40:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478VyB1SWHz3xJ1; Fri, 8 Nov 2019 06:40:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13E3922210; Fri, 8 Nov 2019 06:40:18 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA86eHNW022708; Fri, 8 Nov 2019 06:40:17 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA86eHMw022707; Fri, 8 Nov 2019 06:40:17 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911080640.xA86eHMw022707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 8 Nov 2019 06:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354528 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 354528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 06:40:18 -0000 Author: rmacklem Date: Fri Nov 8 06:40:17 2019 New Revision: 354528 URL: https://svnweb.freebsd.org/changeset/base/354528 Log: Fix the man page to correctly describe the use of the "len" argument. The man page incorrectly described the use of the"len" argument, which is updated to the number of bytes copied and not reduced by the number of bytes copied. This is a content change. Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 ============================================================================== --- head/share/man/man9/VOP_COPY_FILE_RANGE.9 Fri Nov 8 04:26:19 2019 (r354527) +++ head/share/man/man9/VOP_COPY_FILE_RANGE.9 Fri Nov 8 06:40:17 2019 (r354528) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2019 +.Dd November 7, 2019 .Dt VOP_COPY_FILE_RANGE 9 .Os .Sh NAME @@ -60,7 +60,7 @@ The vnode of the output file. .It Fa outoff A pointer to the file offset for the output file. .It Fa len -A pointer to the number of bytes to be copied. +A pointer to the byte count for the copy. .It Fa flags Flags, should be set to 0 for now. .It Fa incred @@ -89,11 +89,11 @@ The .Fa len argument points to the location that stores the number of bytes to be copied. -It should be reduced by the number of bytes copied, which implies that -the value pointed to by +Upon a successful return .Fa len -will normally be zero for a non-error return. -However, a copy of fewer bytes than requested is permitted. +will be updated to the number of bytes actually copied. +Normally, this will be the number of bytes requested to be copied, +however a copy of fewer bytes than requested is permitted. .Sh LOCKS The vnode are unlocked on entry and must be unlocked on return. The byte ranges for both From owner-svn-src-all@freebsd.org Fri Nov 8 07:35:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 468291A9CE0; Fri, 8 Nov 2019 07:35:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478X9x14jPz40WW; Fri, 8 Nov 2019 07:35:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08DEE22C9B; Fri, 8 Nov 2019 07:35:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA87ZWpE057290; Fri, 8 Nov 2019 07:35:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA87ZW8G057289; Fri, 8 Nov 2019 07:35:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911080735.xA87ZW8G057289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Nov 2019 07:35:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354529 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 07:35:33 -0000 Author: avg Date: Fri Nov 8 07:35:32 2019 New Revision: 354529 URL: https://svnweb.freebsd.org/changeset/base/354529 Log: MFC r354069: owc_gpiobus_read_data: disable preemption earlier Modified: stable/12/sys/dev/ow/owc_gpiobus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/owc_gpiobus.c ============================================================================== --- stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 06:40:17 2019 (r354528) +++ stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 07:35:32 2019 (r354529) @@ -279,6 +279,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * if (error != 0) return (error); + critical_enter(); + /* Force low for t_lowr microseconds */ then = sbinuptime(); OUTPIN(sc); @@ -291,7 +293,6 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * * master's pushing the line low. */ INPIN(sc); - critical_enter(); do { now = sbinuptime(); GETPIN(sc, &sample); From owner-svn-src-all@freebsd.org Fri Nov 8 07:36:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9F091A9DA8; Fri, 8 Nov 2019 07:36:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478XCR4XxMz40fL; Fri, 8 Nov 2019 07:36:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 806D722C9D; Fri, 8 Nov 2019 07:36:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA87ap8d057409; Fri, 8 Nov 2019 07:36:51 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA87apnD057408; Fri, 8 Nov 2019 07:36:51 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911080736.xA87apnD057408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Nov 2019 07:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354530 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 07:36:51 -0000 Author: avg Date: Fri Nov 8 07:36:51 2019 New Revision: 354530 URL: https://svnweb.freebsd.org/changeset/base/354530 Log: MFC r354076: owc_gpiobus_read_data: compare times in sbintime_t units Modified: stable/12/sys/dev/ow/owc_gpiobus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/owc_gpiobus.c ============================================================================== --- stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 07:35:32 2019 (r354529) +++ stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 07:36:51 2019 (r354530) @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * do { now = sbinuptime(); GETPIN(sc, &sample); - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); critical_exit(); - if (sbttons(now - then) < t->t_rdv * 1000) + if (now - then < t->t_rdv * SBT_1US) *bit = 1; else *bit = 0; @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while ((now - then) / SBT_1US < t->t_slot); + } while (now - then < t->t_slot * SBT_1US); RELBUS(sc); From owner-svn-src-all@freebsd.org Fri Nov 8 07:38:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 244021A9E97; Fri, 8 Nov 2019 07:38:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478XFR09Krz40pD; Fri, 8 Nov 2019 07:38:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDAC622C9F; Fri, 8 Nov 2019 07:38:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA87cY1N057565; Fri, 8 Nov 2019 07:38:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA87cYqk057564; Fri, 8 Nov 2019 07:38:34 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911080738.xA87cYqk057564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Nov 2019 07:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354531 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 07:38:35 -0000 Author: avg Date: Fri Nov 8 07:38:34 2019 New Revision: 354531 URL: https://svnweb.freebsd.org/changeset/base/354531 Log: MFC r354077,r354078: owc_gpiobus_read_data: add recovery time to the read slot Modified: stable/12/sys/dev/ow/owc_gpiobus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/owc_gpiobus.c ============================================================================== --- stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 07:36:51 2019 (r354530) +++ stable/12/sys/dev/ow/owc_gpiobus.c Fri Nov 8 07:38:34 2019 (r354531) @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while (now - then < t->t_slot * SBT_1US); + } while (now - then < (t->t_slot + t->t_rec) * SBT_1US); RELBUS(sc); From owner-svn-src-all@freebsd.org Fri Nov 8 07:56:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A1E51AA55E; Fri, 8 Nov 2019 07:56:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478Xdq3SfYz41Yx; Fri, 8 Nov 2019 07:56:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BB492304C; Fri, 8 Nov 2019 07:56:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA87uEmY069408; Fri, 8 Nov 2019 07:56:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA87uEVg069407; Fri, 8 Nov 2019 07:56:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911080756.xA87uEVg069407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Nov 2019 07:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354532 - stable/12/sys/dev/gpio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/gpio X-SVN-Commit-Revision: 354532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 07:56:15 -0000 Author: avg Date: Fri Nov 8 07:56:14 2019 New Revision: 354532 URL: https://svnweb.freebsd.org/changeset/base/354532 Log: MFC r354065: gpioiic: set output after switching to output mode... if presetting it failed. Modified: stable/12/sys/dev/gpio/gpioiic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/gpio/gpioiic.c ============================================================================== --- stable/12/sys/dev/gpio/gpioiic.c Fri Nov 8 07:38:34 2019 (r354531) +++ stable/12/sys/dev/gpio/gpioiic.c Fri Nov 8 07:56:14 2019 (r354532) @@ -168,59 +168,67 @@ gpioiic_reset_bus(device_t dev) } static void -gpioiic_setsda(device_t dev, int val) +gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + int err; if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_OUTPUT); + + /* + * Some controllers cannot set output value while a pin is in + * input mode. + */ + if (err != 0) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); } } static void +gpioiic_setsda(device_t dev, int val) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + gpioiic_setpin(sc, sc->sda_pin, val); +} + +static void gpioiic_setscl(device_t dev, int val) { struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_OUTPUT); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - } + gpioiic_setpin(sc, sc->scl_pin, val); } static int -gpioiic_getscl(device_t dev) +gpioiic_getpin(struct gpioiic_softc *sc, int pin) { - struct gpioiic_softc *sc = device_get_softc(dev); unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, &val); - + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); return ((int)val); } static int -gpioiic_getsda(device_t dev) +gpioiic_getscl(device_t dev) { struct gpioiic_softc *sc = device_get_softc(dev); - unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, &val); + return (gpioiic_getpin(sc, sc->scl_pin)); +} - return ((int)val); +static int +gpioiic_getsda(device_t dev) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + return (gpioiic_getpin(sc, sc->sda_pin)); } static int From owner-svn-src-all@freebsd.org Fri Nov 8 11:09:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BD741AEB35; Fri, 8 Nov 2019 11:09:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478cxC3cVzz4C17; Fri, 8 Nov 2019 11:09:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 603A025214; Fri, 8 Nov 2019 11:09:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8B9p5v094516; Fri, 8 Nov 2019 11:09:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8B9p20094515; Fri, 8 Nov 2019 11:09:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911081109.xA8B9p20094515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 8 Nov 2019 11:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354533 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 354533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 11:09:51 -0000 Author: trasz Date: Fri Nov 8 11:09:50 2019 New Revision: 354533 URL: https://svnweb.freebsd.org/changeset/base/354533 Log: Humanize more columns in the vmstat(8) output and adjust widths. The few columns that are not humanized are usually 0. This makes the output mostly aligned. Reviewed by: allanjude MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22185 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Fri Nov 8 07:56:14 2019 (r354532) +++ head/usr.bin/vmstat/vmstat.c Fri Nov 8 11:09:50 2019 (r354533) @@ -646,9 +646,8 @@ getcpuinfo(u_long *maskp, int *maxidp) static void -prthuman(const char *name, uint64_t val, int size) +prthuman(const char *name, uint64_t val, int size, int flags) { - int flags; char buf[10]; char fmt[128]; @@ -656,7 +655,7 @@ prthuman(const char *name, uint64_t val, int size) if (size < 5 || size > 9) xo_errx(1, "doofus"); - flags = HN_B | HN_NOSPACE | HN_DECIMAL; + flags |= HN_NOSPACE | HN_DECIMAL; humanize_number(buf, size, val, "", HN_AUTOSCALE, flags); xo_attr("value", "%ju", (uintmax_t) val); xo_emit(fmt, size, buf); @@ -784,20 +783,21 @@ dovmstat(unsigned int interval, int reps) fill_vmmeter(&sum); fill_vmtotal(&total); xo_open_container("processes"); - xo_emit("{:runnable/%1d} {:waiting/%ld} " - "{:swapped-out/%ld}", total.t_rq - 1, total.t_dw + + xo_emit("{:runnable/%2d} {:waiting/%2ld} " + "{:swapped-out/%2ld}", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); xo_close_container("processes"); xo_open_container("memory"); #define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) #define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ if (hflag) { - xo_emit(""); prthuman("available-memory", - total.t_avm * (uint64_t)sum.v_page_size, 5); - xo_emit(" "); + total.t_avm * (uint64_t)sum.v_page_size, 5, HN_B); prthuman("free-memory", - total.t_free * (uint64_t)sum.v_page_size, 5); + total.t_free * (uint64_t)sum.v_page_size, 5, HN_B); + prthuman("total-page-faults", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults), 5, 0); xo_emit(" "); } else { xo_emit(" "); @@ -807,10 +807,10 @@ dovmstat(unsigned int interval, int reps) xo_emit("{:free-memory/%7ju}", vmstat_pgtok(total.t_free)); xo_emit(" "); + xo_emit("{:total-page-faults/%5lu} ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } - xo_emit("{:total-page-faults/%5lu} ", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults)); xo_close_container("memory"); xo_open_container("paging-rates"); @@ -820,22 +820,44 @@ dovmstat(unsigned int interval, int reps) xo_emit("{:paged-in/%3lu} ", (unsigned long)rate(sum.v_swapin + sum.v_vnodein - (osum.v_swapin + osum.v_vnodein))); - xo_emit("{:paged-out/%3lu} ", + xo_emit("{:paged-out/%3lu}", (unsigned long)rate(sum.v_swapout + sum.v_vnodeout - (osum.v_swapout + osum.v_vnodeout))); - xo_emit("{:freed/%5lu} ", - (unsigned long)rate(sum.v_tfree - osum.v_tfree)); - xo_emit("{:scanned/%4lu} ", - (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); + if (hflag) { + prthuman("freed", + (unsigned long)rate(sum.v_tfree - osum.v_tfree), + 5, 0); + prthuman("scanned", + (unsigned long)rate(sum.v_pdpages - osum.v_pdpages), + 5, 0); + xo_emit(" "); + } else { + xo_emit(" "); + xo_emit("{:freed/%5lu} ", + (unsigned long)rate(sum.v_tfree - osum.v_tfree)); + xo_emit("{:scanned/%4lu} ", + (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); + } xo_close_container("paging-rates"); devstats(); xo_open_container("fault-rates"); - xo_emit("{:interrupts/%4lu} {:system-calls/%5lu} " - "{:context-switches/%5lu}", - (unsigned long)rate(sum.v_intr - osum.v_intr), - (unsigned long)rate(sum.v_syscall - osum.v_syscall), - (unsigned long)rate(sum.v_swtch - osum.v_swtch)); + xo_emit("{:interrupts/%4lu}", + (unsigned long)rate(sum.v_intr - osum.v_intr)); + if (hflag) { + prthuman("system-calls", + (unsigned long)rate(sum.v_syscall - osum.v_syscall), + 5, 0); + prthuman("context-switches", + (unsigned long)rate(sum.v_swtch - osum.v_swtch), + 5, 0); + } else { + xo_emit(" "); + xo_emit("{:system-calls/%5lu} " + "{:context-switches/%5lu}", + (unsigned long)rate(sum.v_syscall - osum.v_syscall), + (unsigned long)rate(sum.v_swtch - osum.v_swtch)); + } xo_close_container("fault-rates"); if (Pflag) pcpustats(cpumask, maxid); @@ -867,14 +889,14 @@ printhdr(int maxid, u_long cpumask) num_shown = MIN(num_selected, maxshowdevs); if (hflag) - xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); + xo_emit(" {T:procs} {T:memory} {T:/page%*s}", 19, ""); else xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); if (num_shown > 1) - xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, ""); + xo_emit(" {T:/disks %*s} ", num_shown * 4 - 7, ""); else if (num_shown == 1) xo_emit(" {T:disks}"); - xo_emit(" {T:faults} "); + xo_emit(" {T:faults} "); if (Pflag) { for (i = 0; i <= maxid; i++) { if (cpumask & (1ul << i)) @@ -882,10 +904,10 @@ printhdr(int maxid, u_long cpumask) } xo_emit("\n"); } else - xo_emit(" {T:cpu}\n"); + xo_emit(" {T:cpu}\n"); if (hflag) { - xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re}" - " {T:pi} {T:po} {T:fr} {T:sr} "); + xo_emit(" {T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re}" + " {T:pi} {T:po} {T:fr} {T:sr} "); } else { xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} " "{T:re} {T:pi} {T:po} {T:fr} {T:sr} "); @@ -896,7 +918,7 @@ printhdr(int maxid, u_long cpumask) xo_emit("{T:/%c%c%d} ", dev_select[i].device_name[0], dev_select[i].device_name[1], dev_select[i].unit_number); - xo_emit(" {T:in} {T:sy} {T:cs}"); + xo_emit(" {T:in} {T:sy} {T:cs}"); if (Pflag) { for (i = 0; i <= maxid; i++) { if (cpumask & (1ul << i)) From owner-svn-src-all@freebsd.org Fri Nov 8 11:51:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 372321AF70E; Fri, 8 Nov 2019 11:51:24 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478ds71VXgz4F56; Fri, 8 Nov 2019 11:51:22 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f180.google.com with SMTP id y23so5875130ljh.10; Fri, 08 Nov 2019 03:51:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=B/YYJZwnl/Us6rulHFaHppdyWEpAT6SL501jvPGLvLs=; b=nUf/8t+B9VNtGMb3wz6VIe2BHIBfK8KBoj50nsdZ9G5JxypFFqJW6NmnX6/WaHRXzy FVQh9QHq8F7syuZDz8HnAEAuYUA1uu179wVOjE2H7kzOFxCZZbNOE705PCp6hhA54cjb +6qJ4kJzIwxRczs/uOM8ersaHu12jg5BNM37PAghnomiCkF3hTDJsYqBtbQOge80AIeb tjIkEbKiB1UGCrTe1ZhdvYIeyJItV8aYFor2GDBW8W8hHxZaSbYV27PWXX7r0XRol9B4 tmCGQBnmnN6Lmx5Gbf/OoWCHSHwd2yNbhj0rfAQQc6+QHXAhmphppFaSPr2T3cx3mu4v G4jw== X-Gm-Message-State: APjAAAU+KQnLGOJoDrvp8FAYgUqHVfx19VPLnrLRLYE4lJNK/FsdoNn8 3vWGYc+4wfK0gNr86lry1khtovCtSSo= X-Google-Smtp-Source: APXvYqxNFFY4CoAutlQ3qjkH249A1d4JOQNa+o43dFUrw8bj3PFceU2XTWSQexX6Bl/K+CYnBf0GQw== X-Received: by 2002:a2e:6a19:: with SMTP id f25mr6551085ljc.147.1573213880851; Fri, 08 Nov 2019 03:51:20 -0800 (PST) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id u2sm6509525ljg.34.2019.11.08.03.51.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2019 03:51:19 -0800 (PST) Subject: Re: svn commit: r354482 - head/sys/x86/x86 To: Colin Percival , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201911072114.xA7LExVP090362@repo.freebsd.org> <0100016e47bc3e05-560c061d-ef2e-41b1-9166-20d80cb6b81d-000000@email.amazonses.com> <69cbaec6-5799-9640-89bd-bdb5b6ae9843@FreeBSD.org> <0100016e47e589be-1ed635b1-6701-43a8-88f7-79726e4bc036-000000@email.amazonses.com> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <1d4ff16f-2c0c-8939-4876-4ceb0044d359@FreeBSD.org> Date: Fri, 8 Nov 2019 13:51:18 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <0100016e47e589be-1ed635b1-6701-43a8-88f7-79726e4bc036-000000@email.amazonses.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 478ds71VXgz4F56 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.180 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[180.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; IP_SCORE(-1.13)[ip: (-0.39), ipnet: 209.85.128.0/17(-3.20), asn: 15169(-2.01), country: US(-0.05)]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[180.208.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 11:51:24 -0000 On 08/11/2019 00:04, Colin Percival wrote: > On 2019-11-07 13:34, Andriy Gapon wrote: >> On 07/11/2019 23:19, Colin Percival wrote: >>> On 2019-11-07 13:14, Andriy Gapon wrote: >>>> x86 stack_save_td_running() can work safely only if IPI_TRACE is a >>>> non-maskable interrupt. But at the moment FreeBSD/Xen does not provide >>>> support for the NMI delivery mode. So, mark the functionality as >>>> unsupported similarly to other platforms without NMI. >>>> [...] >>>> +#ifdef XENHVM >>> >>> I'm not sure this does what you intended. XENHVM simply adds *support* for >>> running under Xen/HVM, and it's part of the GENERIC kernel. >> >> Oh... I should not have rushed. >> So, I should really check for a run-time Xen marker? > > I'm guessing that you want > > #include > > ... > > if (vm_guest == VM_GUEST_XEN) > return (EOPNOTSUPP); > Colin, thank you again. But it seems that adding NMI support to a type of guest which is FreeBSD turned out to be much easier than I imagined. In fact, Roger (royger@) has already come up with a patch. I will be testing it soon. -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Nov 8 12:06:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98B351B05F7; Fri, 8 Nov 2019 12:06:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478fB54KvKz4GW7; Fri, 8 Nov 2019 12:06:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E80325CAB; Fri, 8 Nov 2019 12:06:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8C65qU035368; Fri, 8 Nov 2019 12:06:05 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8C63OI035360; Fri, 8 Nov 2019 12:06:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911081206.xA8C63OI035360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 8 Nov 2019 12:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354534 - in stable/12/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/common/atomic/aarch64 contrib/opensolaris/common/atomic/amd64 contrib/opensolaris/com... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/common/atomic/aarch64 contrib/opensolaris/common/atomic/amd64 contrib/opensolaris/common/atomic/i386 contrib/o... X-SVN-Commit-Revision: 354534 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 12:06:05 -0000 Author: avg Date: Fri Nov 8 12:06:03 2019 New Revision: 354534 URL: https://svnweb.freebsd.org/changeset/base/354534 Log: MFC r353340,r353340: cleanup of illumos compatibility atomics Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c stable/12/sys/cddl/compat/opensolaris/sys/atomic.h stable/12/sys/cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S stable/12/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S stable/12/sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S stable/12/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Fri Nov 8 12:06:03 2019 (r354534) @@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if !defined(__LP64__) && !defined(__mips_n32) && \ + !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) + #ifdef _KERNEL #include @@ -52,8 +55,6 @@ atomic_init(void) } #endif -#if !defined(__LP64__) && !defined(__mips_n32) && \ - !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) void atomic_add_64(volatile uint64_t *target, int64_t delta) { @@ -94,7 +95,6 @@ atomic_load_64(volatile uint64_t *a) mtx_unlock(&atomic_mtx); return (ret); } -#endif uint64_t atomic_add_64_nv(volatile uint64_t *target, int64_t delta) @@ -107,27 +107,6 @@ atomic_add_64_nv(volatile uint64_t *target, int64_t de return (newval); } -#if defined(__powerpc__) || defined(__arm__) || defined(__mips__) -void -atomic_or_8(volatile uint8_t *target, uint8_t value) -{ - mtx_lock(&atomic_mtx); - *target |= value; - mtx_unlock(&atomic_mtx); -} -#endif - -uint8_t -atomic_or_8_nv(volatile uint8_t *target, uint8_t value) -{ - uint8_t newval; - - mtx_lock(&atomic_mtx); - newval = (*target |= value); - mtx_unlock(&atomic_mtx); - return (newval); -} - uint64_t atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) { @@ -140,19 +119,7 @@ atomic_cas_64(volatile uint64_t *target, uint64_t cmp, mtx_unlock(&atomic_mtx); return (oldval); } - -uint32_t -atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) -{ - uint32_t oldval; - - mtx_lock(&atomic_mtx); - oldval = *target; - if (oldval == cmp) - *target = newval; - mtx_unlock(&atomic_mtx); - return (oldval); -} +#endif void membar_producer(void) Modified: stable/12/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- stable/12/sys/cddl/compat/opensolaris/sys/atomic.h Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/compat/opensolaris/sys/atomic.h Fri Nov 8 12:06:03 2019 (r354534) @@ -32,42 +32,28 @@ #include #include -#define casptr(_a, _b, _c) \ - atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) -#define cas32 atomic_cmpset_32 - #if defined(__i386__) && (defined(_KERNEL) || defined(KLD_MODULE)) #define I386_HAVE_ATOMIC64 #endif +#if defined(__i386__) || defined(__amd64__) || defined(__arm__) +/* No spurious failures from fcmpset. */ +#define STRONG_FCMPSET +#endif + #if !defined(__LP64__) && !defined(__mips_n32) && \ !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); extern uint64_t atomic_swap_64(volatile uint64_t *a, uint64_t value); extern uint64_t atomic_load_64(volatile uint64_t *a); -#endif -#ifndef __sparc64__ -extern uint32_t atomic_cas_32(volatile uint32_t *target, uint32_t cmp, - uint32_t newval); +extern uint64_t atomic_add_64_nv(volatile uint64_t *target, int64_t delta); extern uint64_t atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval); #endif -extern uint64_t atomic_add_64_nv(volatile uint64_t *target, int64_t delta); -extern uint8_t atomic_or_8_nv(volatile uint8_t *target, uint8_t value); + extern void membar_producer(void); -#if defined(__sparc64__) || defined(__powerpc__) || defined(__arm__) || \ - defined(__mips__) || defined(__aarch64__) || defined(__riscv) -extern void atomic_or_8(volatile uint8_t *target, uint8_t value); -#else -static __inline void -atomic_or_8(volatile uint8_t *target, uint8_t value) -{ - atomic_set_8(target, value); -} -#endif - static __inline uint32_t atomic_add_32_nv(volatile uint32_t *target, int32_t delta) { @@ -81,6 +67,18 @@ atomic_add_int_nv(volatile u_int *target, int delta) } static __inline void +atomic_inc_32(volatile uint32_t *target) +{ + atomic_add_32(target, 1); +} + +static __inline uint32_t +atomic_inc_32_nv(volatile uint32_t *target) +{ + return (atomic_add_32_nv(target, 1)); +} + +static __inline void atomic_dec_32(volatile uint32_t *target) { atomic_subtract_32(target, 1); @@ -89,9 +87,27 @@ atomic_dec_32(volatile uint32_t *target) static __inline uint32_t atomic_dec_32_nv(volatile uint32_t *target) { - return (atomic_fetchadd_32(target, -1) - 1); + return (atomic_add_32_nv(target, -1)); } +#ifndef __sparc64__ +static inline uint32_t +atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) +{ +#ifdef STRONG_FCMPSET + (void)atomic_fcmpset_32(target, &cmp, newval); +#else + uint32_t expected = cmp; + + do { + if (atomic_fcmpset_32(target, &cmp, newval)) + break; + } while (cmp == expected); +#endif + return (cmp); +} +#endif + #if defined(__LP64__) || defined(__mips_n32) || \ defined(ARM_HAVE_ATOMIC64) || defined(I386_HAVE_ATOMIC64) static __inline void @@ -99,19 +115,31 @@ atomic_dec_64(volatile uint64_t *target) { atomic_subtract_64(target, 1); } -#endif -static __inline void -atomic_inc_32(volatile uint32_t *target) +static inline uint64_t +atomic_add_64_nv(volatile uint64_t *target, int64_t delta) { - atomic_add_32(target, 1); + return (atomic_fetchadd_64(target, delta) + delta); } -static __inline uint32_t -atomic_inc_32_nv(volatile uint32_t *target) +#ifndef __sparc64__ +static inline uint64_t +atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) { - return (atomic_add_32_nv(target, 1)); +#ifdef STRONG_FCMPSET + (void)atomic_fcmpset_64(target, &cmp, newval); +#else + uint64_t expected = cmp; + + do { + if (atomic_fcmpset_64(target, &cmp, newval)) + break; + } while (cmp == expected); +#endif + return (cmp); } +#endif +#endif static __inline void atomic_inc_64(volatile uint64_t *target) Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/aarch64/opensolaris_atomic.S Fri Nov 8 12:06:03 2019 (r354534) @@ -28,58 +28,6 @@ #include -/* - * uint64_t atomic_add_64_nv(volatile uint64_t *target, int64_t delta) - */ -ENTRY(atomic_add_64_nv) -1: ldxr x2, [x0] /* Load *target */ - add x2, x2, x1 /* x2 = x2 + delta */ - stxr w3, x2, [x0] /* Store *target */ - cbnz w3, 1b /* Check if the store succeeded */ - mov x0, x2 /* Return the new value */ - ret -END(atomic_add_64_nv) - -/* - * uint32_t - * atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) - */ -ENTRY(atomic_cas_32) -1: ldxr w3, [x0] /* Load *target */ - cmp w3, w1 /* Does *targe == cmp? */ - b.ne 2f /* If not exit */ - stxr w4, w2, [x0] /* Store newval to *target */ - cbnz w4, 1b /* Check if the store succeeded */ -2: mov w0, w3 /* Return the old value */ - ret -END(atomic_cas_32) - -/* - * uint64_t - * atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) - */ -ENTRY(atomic_cas_64) -1: ldxr x3, [x0] /* Load *target */ - cmp x3, x1 /* Does *targe == cmp? */ - b.ne 2f /* If not exit */ - stxr w4, x2, [x0] /* Store newval to *target */ - cbnz w4, 1b /* Check if the store succeeded */ -2: mov x0, x3 /* Return the old value */ - ret -END(atomic_cas_64) - -/* - * uint8_t atomic_or_8_nv(volatile uint8_t *target, uint8_t value) - */ -ENTRY(atomic_or_8_nv) -1: ldxrb w2, [x0] /* Load *target */ - orr w2, w2, w1 /* x2 = x2 | delta */ - stxrb w3, w2, [x0] /* Store *target */ - cbnz w3, 1b /* Check if the store succeeded */ - mov w0, w2 /* Return the new value */ - ret -END(atomic_or_8_nv) - ENTRY(membar_producer) dmb ish ret Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S Fri Nov 8 12:06:03 2019 (r354534) @@ -28,40 +28,6 @@ #define _ASM #include - ENTRY(atomic_add_64_nv) - mov %rsi, %rax // %rax = delta addend - lock - xaddq %rsi, (%rdi) // %rsi = old value, (%rdi) = sum - addq %rsi, %rax // new value = original value + delta - ret - SET_SIZE(atomic_add_64_nv) - - ENTRY(atomic_or_8_nv) - movb (%rdi), %al // %al = old value -1: - movb %sil, %cl - orb %al, %cl // %cl = new value - lock - cmpxchgb %cl, (%rdi) // try to stick it in - jne 1b - movzbl %cl, %eax // return new value - ret - SET_SIZE(atomic_or_8_nv) - - ENTRY(atomic_cas_32) - movl %esi, %eax - lock - cmpxchgl %edx, (%rdi) - ret - SET_SIZE(atomic_cas_32) - - ENTRY(atomic_cas_64) - movq %rsi, %rax - lock - cmpxchgq %rdx, (%rdi) - ret - SET_SIZE(atomic_cas_64) - ENTRY(membar_producer) sfence ret Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S Fri Nov 8 12:06:03 2019 (r354534) @@ -89,28 +89,6 @@ SET_SIZE(atomic_add_64_nv) SET_SIZE(atomic_add_64) - ENTRY(atomic_or_8_nv) - movl 4(%esp), %edx // %edx = target address - movb (%edx), %al // %al = old value -1: - movl 8(%esp), %ecx // %ecx = delta - orb %al, %cl // %cl = new value - lock - cmpxchgb %cl, (%edx) // try to stick it in - jne 1b - movzbl %cl, %eax // return new value - ret - SET_SIZE(atomic_or_8_nv) - - ENTRY(atomic_cas_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - movl 12(%esp), %ecx - lock - cmpxchgl %ecx, (%edx) - ret - SET_SIZE(atomic_cas_32) - ENTRY(atomic_cas_64) pushl %ebx pushl %esi Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S Fri Nov 8 12:06:03 2019 (r354534) @@ -27,61 +27,6 @@ #include -ENTRY(atomic_add_64_nv) - 1: ldarx %r5,0,%r3 - add %r5,%r4,%r5 - stdcx. %r5,0,%r3 - bne- 1b - - mr %r3,%r5 - blr - -ENTRY(atomic_cas_32) - 1: lwarx %r6,0,%r3 - cmplw %r6,%r4 - bne 2f - stwcx. %r5,0,%r3 - bne- 1b - b 3f - - 2: stwcx. %r6,0,%r3 /* clear reservation */ - - 3: mr %r3,%r6 - blr - -ENTRY(atomic_cas_64) - 1: ldarx %r6,0,%r3 - cmpld %r6,%r4 - bne 2f - stdcx. %r5,0,%r3 - bne- 1b - b 3f - - 2: stdcx. %r6,0,%r3 /* clear reservation */ - - 3: mr %r3,%r6 - blr - -ENTRY(atomic_or_8_nv) - li %r6,3 - andc. %r6,%r3,%r6 /* r6 = r3 & ~4 */ - addi %r7,%r6,3 - sub %r7,%r7,%r3 /* offset in r7 */ - sldi %r7,%r7,3 /* bits to shift in r7 */ - - rlwinm %r4,%r4,0,24,31 /* mask and rotate the argument */ - slw %r4,%r4,%r7 - - 1: lwarx %r5,0,%r6 - or %r5,%r4,%r5 - stwcx. %r5,0,%r6 - bne- 1b - - srw %r3,%r5,%r7 - rlwinm %r3,%r3,0,24,31 /* mask return value */ - - blr - ENTRY(membar_producer) eieio blr Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S Fri Nov 8 11:09:50 2019 (r354533) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S Fri Nov 8 12:06:03 2019 (r354534) @@ -40,67 +40,6 @@ #endif /* - * NOTE: If atomic_add_64 and atomic_add_64_nv are ever - * separated, you need to also edit the libc sparcv9 platform - * specific mapfile and remove the NODYNSORT attribute - * from atomic_add_64_nv. - */ - ENTRY(atomic_add_64) - ALTENTRY(atomic_add_64_nv) - ALTENTRY(atomic_add_ptr) - ALTENTRY(atomic_add_ptr_nv) - ALTENTRY(atomic_add_long) - ALTENTRY(atomic_add_long_nv) -add_64: - ldx [%o0], %o2 -1: - add %o2, %o1, %o3 - casxa [%o0] __ASI_ATOMIC, %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - add %o2, %o1, %o0 ! return new value - SET_SIZE(atomic_add_long_nv) - SET_SIZE(atomic_add_long) - SET_SIZE(atomic_add_ptr_nv) - SET_SIZE(atomic_add_ptr) - SET_SIZE(atomic_add_64_nv) - SET_SIZE(atomic_add_64) - - /* - * NOTE: If atomic_or_8 and atomic_or_8_nv are ever - * separated, you need to also edit the libc sparcv9 platform - * specific mapfile and remove the NODYNSORT attribute - * from atomic_or_8_nv. - */ - ENTRY(atomic_or_8) - ALTENTRY(atomic_or_8_nv) - ALTENTRY(atomic_or_uchar) - and %o0, 0x3, %o4 ! %o4 = byte offset, left-to-right - xor %o4, 0x3, %g1 ! %g1 = byte offset, right-to-left - sll %g1, 3, %g1 ! %g1 = bit offset, right-to-left - set 0xff, %o3 ! %o3 = mask - sll %o3, %g1, %o3 ! %o3 = shifted to bit offset - sll %o1, %g1, %o1 ! %o1 = shifted to bit offset - and %o1, %o3, %o1 ! %o1 = single byte value - andn %o0, 0x3, %o0 ! %o0 = word address - ld [%o0], %o2 ! read old value -1: - or %o2, %o1, %o5 ! or in the new value - casa [%o0] __ASI_ATOMIC, %o2, %o5 - cmp %o2, %o5 - bne,a,pn %icc, 1b - mov %o5, %o2 ! %o2 = old value - or %o2, %o1, %o5 - and %o5, %o3, %o5 - retl - srl %o5, %g1, %o0 ! %o0 = new value - SET_SIZE(atomic_or_uchar) - SET_SIZE(atomic_or_8_nv) - SET_SIZE(atomic_or_8) - - /* * Spitfires and Blackbirds have a problem with membars in the * delay slot (SF_ERRATA_51). For safety's sake, we assume * that the whole world needs the workaround. From owner-svn-src-all@freebsd.org Fri Nov 8 12:19:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2771C1B0B47; Fri, 8 Nov 2019 12:19:04 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478fT40C5rz4HT2; Fri, 8 Nov 2019 12:19:04 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D972D25E6B; Fri, 8 Nov 2019 12:19:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8CJ3hq041341; Fri, 8 Nov 2019 12:19:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8CJ3q8041340; Fri, 8 Nov 2019 12:19:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911081219.xA8CJ3q8041340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 8 Nov 2019 12:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354535 - head/stand/i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/i386/libi386 X-SVN-Commit-Revision: 354535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 12:19:04 -0000 Author: tsoome Date: Fri Nov 8 12:19:03 2019 New Revision: 354535 URL: https://svnweb.freebsd.org/changeset/base/354535 Log: cstyle cleanup for i386_copy.c No functional changes are intended. Modified: head/stand/i386/libi386/i386_copy.c Modified: head/stand/i386/libi386/i386_copy.c ============================================================================== --- head/stand/i386/libi386/i386_copy.c Fri Nov 8 12:06:03 2019 (r354534) +++ head/stand/i386/libi386/i386_copy.c Fri Nov 8 12:19:03 2019 (r354535) @@ -40,25 +40,25 @@ __FBSDID("$FreeBSD$"); ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len) { - if (dest + len >= memtop) { - errno = EFBIG; - return(-1); - } + if (dest + len >= memtop) { + errno = EFBIG; + return (-1); + } - bcopy(src, PTOV(dest), len); - return(len); + bcopy(src, PTOV(dest), len); + return (len); } ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len) { - if (src + len >= memtop) { - errno = EFBIG; - return(-1); - } - - bcopy(PTOV(src), dest, len); - return(len); + if (src + len >= memtop) { + errno = EFBIG; + return (-1); + } + + bcopy(PTOV(src), dest, len); + return (len); } @@ -66,10 +66,10 @@ ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len) { - if (dest + len >= memtop_copyin) { - errno = EFBIG; - return(-1); - } + if (dest + len >= memtop_copyin) { + errno = EFBIG; + return (-1); + } - return (read(fd, PTOV(dest), len)); + return (read(fd, PTOV(dest), len)); } From owner-svn-src-all@freebsd.org Fri Nov 8 14:06:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87FF31B38CC; Fri, 8 Nov 2019 14:06:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478hsP2yfhz4PYN; Fri, 8 Nov 2019 14:06:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48E6627203; Fri, 8 Nov 2019 14:06:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8E6nLB014544; Fri, 8 Nov 2019 14:06:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8E6nUa014543; Fri, 8 Nov 2019 14:06:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081406.xA8E6nUa014543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354536 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 354536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:06:49 -0000 Author: emaste Date: Fri Nov 8 14:06:48 2019 New Revision: 354536 URL: https://svnweb.freebsd.org/changeset/base/354536 Log: suggest xtoolchain package if binutils and GCC bootstraps are both broken Previously we checked for only BINUTILS_BOOTSTRAP as a broken option and suggested installing the binutils package. This was originally done for arm64 where we used the in-tree Clang with external binutils package. Add a case to the warning to suggest instead the full xtoolchain package if we have no in-tree compiler either. Differential Revision: https://reviews.freebsd.org/D21851 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Nov 8 12:19:03 2019 (r354535) +++ head/Makefile.inc1 Fri Nov 8 14:06:48 2019 (r354536) @@ -189,7 +189,11 @@ CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} !defined(CROSS_BINUTILS_PREFIX) CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_TRIPLE}/bin/ .if !exists(${CROSS_BINUTILS_PREFIX}) +.if !empty(BROKEN_OPTIONS:MGCC_BOOTSTRAP) && ${MK_CLANG_BOOTSTRAP} == "no" +.error In-tree toolchain does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-xtoolchain-gcc port or package or set CROSS_TOOLCHAIN_PREFIX. +.else .error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. +.endif .endif .endif .endif From owner-svn-src-all@freebsd.org Fri Nov 8 14:11:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D02B21B3A11; Fri, 8 Nov 2019 14:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478hyj5BT3z4PtV; Fri, 8 Nov 2019 14:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9601627267; Fri, 8 Nov 2019 14:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8EBP0o018540; Fri, 8 Nov 2019 14:11:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EBPF9018539; Fri, 8 Nov 2019 14:11:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081411.xA8EBPF9018539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354537 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 354537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:11:25 -0000 Author: emaste Date: Fri Nov 8 14:11:25 2019 New Revision: 354537 URL: https://svnweb.freebsd.org/changeset/base/354537 Log: makefs: avoid warning when creating FAT filesystem on existing file Previously the mkfs_msdos function (from newfs_msdos) emitted warnings in the case that an image size is specified and the target is not a file, or no size is specified and the target is not a character device. The latter warning (not a character device) doesn't make sense when this code is used in makefs, regardless of whether an image size is specified or not. Sponsored by: The FreeBSD Foundation Modified: head/sbin/newfs_msdos/mkfs_msdos.c Modified: head/sbin/newfs_msdos/mkfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/mkfs_msdos.c Fri Nov 8 14:06:48 2019 (r354536) +++ head/sbin/newfs_msdos/mkfs_msdos.c Fri Nov 8 14:11:25 2019 (r354537) @@ -285,8 +285,10 @@ mkfs_msdos(const char *fname, const char *dtype, const if (!S_ISREG(sb.st_mode)) warnx("warning, %s is not a regular file", fname); } else { +#ifndef MAKEFS if (!S_ISCHR(sb.st_mode)) warnx("warning, %s is not a character device", fname); +#endif } if (!o.no_create) if (check_mounted(fname, sb.st_mode) == -1) From owner-svn-src-all@freebsd.org Fri Nov 8 14:17:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56FCB1B3DC5; Fri, 8 Nov 2019 14:17:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478j5f1r4qz4QJr; Fri, 8 Nov 2019 14:17:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 221F3273CE; Fri, 8 Nov 2019 14:17:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8EHQn5020971; Fri, 8 Nov 2019 14:17:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EHQi5020970; Fri, 8 Nov 2019 14:17:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081417.xA8EHQi5020970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354538 - head/sys/arm/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/linux X-SVN-Commit-Revision: 354538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:17:26 -0000 Author: emaste Date: Fri Nov 8 14:17:25 2019 New Revision: 354538 URL: https://svnweb.freebsd.org/changeset/base/354538 Log: arm linuxulator: add syscalls definition From Linux arch/arm/kernel/call.S Reviewed by: imp (earlier) Submitted by: Grégory Soutadé Differential Revision: https://reviews.freebsd.org/D7972 Added: head/sys/arm/linux/ head/sys/arm/linux/syscalls.master (contents, props changed) Added: head/sys/arm/linux/syscalls.master ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/linux/syscalls.master Fri Nov 8 14:17:25 2019 (r354538) @@ -0,0 +1,673 @@ + $FreeBSD$ + +; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 +; System call name/number master file (or rather, slave, from LINUX). +; Processed to create linux_sysent.c, linux_proto.h and linux_syscall.h. + +; Columns: number audit type nargs name alt{name,tag,rtyp}/comments +; number system call number, must be in order +; audit the audit event associated with the system call +; A value of AUE_NULL means no auditing, but it also means that +; there is no audit event for the call at this time. For the +; case where the event exists, but we don't want auditing, the +; event should be #defined to AUE_NULL in audit_kevents.h. +; type one of STD, OBSOL, UNIMPL +; name psuedo-prototype of syscall routine +; If one of the following alts is different, then all appear: +; altname name of system call if different +; alttag name of args struct tag if different from [o]`name'"_args" +; altrtyp return type if not int (bogus - syscalls always return int) +; for UNIMPL/OBSOL, name continues with comments + +; types: +; STD always included +; OBSOL obsolete, not included in system, only specifies name +; UNIMPL not implemented, placeholder only + +#include +#include +#include +#include +#include +#include + +; Isn't pretty, but there seems to be no other way to trap nosys +#define nosys linux_nosys + +; #ifdef's, etc. may be included, and are copied to the output files. + +0 AUE_NULL UNIMPL setup +1 AUE_EXIT STD { void linux_exit(int rval); } +2 AUE_FORK STD { int linux_fork(void); } +3 AUE_NULL NOPROTO { int read(int fd, char *buf, \ + u_int nbyte); } +4 AUE_NULL NOPROTO { int write(int fd, char *buf, \ + u_int nbyte); } +5 AUE_OPEN_RWTC STD { int linux_open(char *path, l_int flags, \ + l_int mode); } +6 AUE_CLOSE NOPROTO { int close(int fd); } +7 AUE_NULL UNIMPL ; was linux_waitpid +8 AUE_CREAT STD { int linux_creat(char *path, \ + l_int mode); } +9 AUE_LINK STD { int linux_link(char *path, char *to); } +10 AUE_UNLINK STD { int linux_unlink(char *path); } +11 AUE_EXECVE STD { int linux_execve(char *path, char **argp, \ + char **envp); } +12 AUE_CHDIR STD { int linux_chdir(char *path); } +13 AUE_NULL UNIMPL ; was OBSOLETE(linux_time) +14 AUE_MKNOD STD { int linux_mknod(char *path, l_int mode, \ + l_dev_t dev); } +15 AUE_CHMOD STD { int linux_chmod(char *path, \ + l_mode_t mode); } +16 AUE_LCHOWN STD { int linux_lchown16(char *path, \ + l_uid16_t uid, l_gid16_t gid); } +17 AUE_NULL UNIMPL ; was linux_break +18 AUE_NULL UNIMPL ; was linux_stat +19 AUE_LSEEK STD { int linux_lseek(l_uint fdes, l_off_t off, \ + l_int whence); } +20 AUE_GETPID STD { int linux_getpid(void); } +21 AUE_MOUNT STD { int linux_mount(char *specialfile, \ + char *dir, char *filesystemtype, \ + l_ulong rwflag, void *data); } +22 AUE_NULL UNIMPL ; was OBSOLETE(linux_oldumount) +23 AUE_SETUID STD { int linux_setuid16(l_uid16_t uid); } +24 AUE_GETUID STD { int linux_getuid16(void); } +25 AUE_NULL UNIMPL ; was OBSOLETE(linux_stime) +26 AUE_PTRACE UNIMPL ptrace +27 AUE_NULL UNIMPL ; was OBSOLETE(linux_alarm) +28 AUE_NULL UNIMPL ; was linux_fstat +29 AUE_NULL STD { int linux_pause(void); } +30 AUE_NULL UNIMPL ; was OBSOLETE(linux_utime) +31 AUE_NULL UNIMPL ; was linux_stty +32 AUE_NULL UNIMPL ; was linux_getty +33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); } +34 AUE_NICE STD { int linux_nice(l_int inc); } +35 AUE_NULL UNIMPL ; was linux_ftime +36 AUE_SYNC NOPROTO { int sync(void); } +37 AUE_KILL STD { int linux_kill(l_int pid, l_int signum); } +38 AUE_RENAME STD { int linux_rename(char *from, char *to); } +39 AUE_MKDIR STD { int linux_mkdir(char *path, l_int mode); } +40 AUE_RMDIR STD { int linux_rmdir(char *path); } +41 AUE_DUP NOPROTO { int dup(u_int fd); } +42 AUE_PIPE STD { int linux_pipe(l_int *pipefds); } +43 AUE_NULL STD { int linux_times(struct l_times_argv *buf); } +44 AUE_NULL UNIMPL ; was linux_prof +45 AUE_NULL STD { int linux_brk(l_ulong dsend); } +46 AUE_SETGID STD { int linux_setgid16(l_gid16_t gid); } +47 AUE_GETGID STD { int linux_getgid16(void); } +48 AUE_NULL UNIMPL ; was linux_signal +49 AUE_GETEUID STD { int linux_geteuid16(void); } +50 AUE_GETEGID STD { int linux_getegid16(void); } +51 AUE_ACCT NOPROTO { int acct(char *path); } +52 AUE_UMOUNT STD { int linux_umount(char *path, l_int flags); } +53 AUE_NULL UNIMPL ; was linux_lock +54 AUE_IOCTL STD { int linux_ioctl(l_uint fd, l_uint cmd, \ + l_ulong arg); } +55 AUE_FCNTL STD { int linux_fcntl(l_uint fd, l_uint cmd, \ + l_ulong arg); } +56 AUE_NULL UNIMPL ; was linux_mpx +57 AUE_SETPGRP NOPROTO { int setpgid(int pid, int pgid); } +58 AUE_NULL UNIMPL ; was linux_ulimit +59 AUE_NULL UNIMPL ; was linux_olduname +60 AUE_UMASK NOPROTO { int umask(int newmask); } +61 AUE_CHROOT NOPROTO { int chroot(char *path); } +62 AUE_NULL STD { int linux_ustat(l_dev_t dev, \ + struct l_ustat *ubuf); } +63 AUE_DUP2 NOPROTO { int dup2(u_int from, u_int to); } +64 AUE_GETPPID STD { int linux_getppid(void); } +65 AUE_GETPGRP NOPROTO { int getpgrp(void); } +66 AUE_SETSID NOPROTO { int setsid(void); } +67 AUE_NULL STD { int linux_sigaction(l_int sig, \ + l_osigaction_t *nsa, \ + l_osigaction_t *osa); } +68 AUE_NULL UNIMPL ; was linux_sgetmask +69 AUE_NULL UNIMPL ; was linux_ssetmask +70 AUE_SETREUID STD { int linux_setreuid16(l_uid16_t ruid, \ + l_uid16_t euid); } +71 AUE_SETREGID STD { int linux_setregid16(l_gid16_t rgid, \ + l_gid16_t egid); } +72 AUE_NULL STD { int linux_sigsuspend(l_int hist0, \ + l_int hist1, l_osigset_t mask); } +73 AUE_NULL STD { int linux_sigpending(l_osigset_t *mask); } +74 AUE_SYSCTL STD { int linux_sethostname(char *hostname, \ + u_int len); } +75 AUE_SETRLIMIT STD { int linux_setrlimit(l_uint resource, \ + struct l_rlimit *rlim); } +76 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_getrlimit) +77 AUE_GETRUSAGE NOPROTO { int getrusage(int who, \ + struct rusage *rusage); } +78 AUE_GETTIMEOFDAY STD { int linux_gettimeofday( \ + struct timeval32 *tp, \ + struct timezone *tzp); } +79 AUE_SETTIMEOFDAY STD { int linux_settimeofday( \ + struct timeval32 *tp, \ + struct timezone *tzp); } +80 AUE_GETGROUPS STD { int linux_getgroups16(l_uint gidsetsize, \ + l_gid16_t *gidset); } +81 AUE_SETGROUPS STD { int linux_setgroups16(l_uint gidsetsize, \ + l_gid16_t *gidset); } +82 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_select) +83 AUE_SYMLINK STD { int linux_symlink(char *path, char *to); } +84 AUE_NULL UNIMPL ; was linux_lstat +85 AUE_READLINK STD { int linux_readlink(char *name, char *buf, \ + l_int count); } +86 AUE_NULL UNIMPL uselib +87 AUE_SWAPON NOPROTO { int swapon(char *name); } +88 AUE_REBOOT STD { int linux_reboot(l_int magic1, \ + l_int magic2, l_uint cmd, void *arg); } +89 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_readdir) +90 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_mmap) +91 AUE_MUNMAP NOPROTO { int munmap(caddr_t addr, int len); } +92 AUE_TRUNCATE STD { int linux_truncate(char *path, \ + l_ulong length); } +93 AUE_FTRUNCATE STD { int linux_ftruncate(int fd, long length); } +94 AUE_FCHMOD NOPROTO { int fchmod(int fd, int mode); } +95 AUE_FCHOWN NOPROTO { int fchown(int fd, int uid, int gid); } +96 AUE_GETPRIORITY STD { int linux_getpriority(int which, int who); } +97 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \ + int prio); } +98 AUE_NULL UNIMPL ; was linux_profil +99 AUE_STATFS STD { int linux_statfs(char *path, \ + struct l_statfs_buf *buf); } +100 AUE_FSTATFS STD { int linux_fstatfs(l_uint fd, \ + struct l_statfs_buf *buf); } +101 AUE_NULL UNIMPL ; was ioperm +102 AUE_NULL UNIMPL ; was OBSOLETE(linux_socketcall) +103 AUE_NULL STD { int linux_syslog(l_int type, char *buf, \ + l_int len); } +104 AUE_SETITIMER STD { int linux_setitimer(l_int which, \ + struct l_itimerval *itv, \ + struct l_itimerval *oitv); } +105 AUE_GETITIMER STD { int linux_getitimer(l_int which, \ + struct l_itimerval *itv); } +106 AUE_STAT STD { int linux_newstat(char *path, \ + struct l_newstat *buf); } +107 AUE_LSTAT STD { int linux_newlstat(char *path, \ + struct l_newstat *buf); } +108 AUE_FSTAT STD { int linux_newfstat(l_uint fd, \ + struct l_newstat *buf); } +109 AUE_NULL UNIMPL ; was linux_uname +110 AUE_NULL UNIMPL ; was linux_iopl +111 AUE_NULL STD { int linux_vhangup(void); } +112 AUE_NULL UNIMPL ; +113 AUE_NULL UNIMPL ; was OBSOLETE(linux_syscall) +114 AUE_WAIT4 STD { int linux_wait4(l_pid_t pid, \ + l_int *status, l_int options, \ + void *rusage); } +115 AUE_SWAPOFF STD { int linux_swapoff(void); } +116 AUE_NULL STD { int linux_sysinfo(struct l_sysinfo *info); } +117 AUE_NULL UNIMPL ; was OBSOLETE(linux_ipc) +118 AUE_FSYNC NOPROTO { int fsync(int fd); } +119 AUE_SIGRETURN STD { int linux_sigreturn( \ + struct l_sigframe *sfp); } +120 AUE_RFORK STD { int linux_clone(l_int flags, void *stack, \ + void *parent_tidptr, void *tls, void * child_tidptr); } +121 AUE_SYSCTL STD { int linux_setdomainname(char *name, \ + int len); } +122 AUE_NULL STD { int linux_newuname( \ + struct l_new_utsname *buf); } +123 AUE_NULL UNIMPL ; was linux_modify_ldt +124 AUE_ADJTIME STD { int linux_adjtimex(void); } +125 AUE_MPROTECT STD { int linux_mprotect(caddr_t addr, int len, \ + int prot); } +126 AUE_SIGPROCMASK STD { int linux_sigprocmask(l_int how, \ + l_osigset_t *mask, l_osigset_t *omask); } +127 AUE_NULL UNIMPL ; was linux_create_module +128 AUE_NULL STD { int linux_init_module(void); } +129 AUE_NULL STD { int linux_delete_module(void); } +130 AUE_NULL UNIMPL ; was linux_get_kernel_syms +131 AUE_QUOTACTL STD { int linux_quotactl(void); } +132 AUE_GETPGID NOPROTO { int getpgid(int pid); } +133 AUE_FCHDIR NOPROTO { int fchdir(int fd); } +134 AUE_BDFLUSH STD { int linux_bdflush(void); } +135 AUE_NULL STD { int linux_sysfs(l_int option, \ + l_ulong arg1, l_ulong arg2); } +136 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +137 AUE_NULL UNIMPL ; was afs_syscall +138 AUE_SETFSUID STD { int linux_setfsuid16(l_uid16_t uid); } +139 AUE_SETFSGID STD { int linux_setfsgid16(l_gid16_t gid); } +140 AUE_LSEEK STD { int linux_llseek(l_int fd, l_ulong ohigh, \ + l_ulong olow, l_loff_t *res, \ + l_uint whence); } +141 AUE_GETDIRENTRIES STD { int linux_getdents(l_uint fd, \ + void *dent, l_uint count); } +; 142: newselect +142 AUE_SELECT STD { int linux_select(l_int nfds, \ + l_fd_set *readfds, l_fd_set *writefds, \ + l_fd_set *exceptfds, \ + struct l_timeval *timeout); } +143 AUE_FLOCK NOPROTO { int flock(int fd, int how); } +144 AUE_MSYNC STD { int linux_msync(l_ulong addr, \ + l_size_t len, l_int fl); } +145 AUE_READV NOPROTO { int readv(int fd, struct iovec *iovp, \ + u_int iovcnt); } +146 AUE_WRITEV NOPROTO { int writev(int fd, struct iovec *iovp, \ + u_int iovcnt); } +147 AUE_GETSID STD { int linux_getsid(l_pid_t pid); } +148 AUE_NULL STD { int linux_fdatasync(l_uint fd); } +149 AUE_SYSCTL STD { int linux_sysctl( \ + struct l___sysctl_args *args); } +150 AUE_MLOCK NOPROTO { int mlock(const void *addr, size_t len); } +151 AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); } +152 AUE_MLOCKALL NOPROTO { int mlockall(int how); } +153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } +154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ + struct sched_param *param); } +155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \ + struct sched_param *param); } +156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \ + l_pid_t pid, l_int policy, \ + struct sched_param *param); } +157 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \ + l_pid_t pid); } +158 AUE_NULL NOPROTO { int sched_yield(void); } +159 AUE_SCHED_GET_PRIORITY_MAX STD { int linux_sched_get_priority_max( \ + l_int policy); } +160 AUE_SCHED_GET_PRIORITY_MIN STD { int linux_sched_get_priority_min( \ + l_int policy); } +161 AUE_SCHED_RR_GET_INTERVAL STD { int linux_sched_rr_get_interval( \ + l_pid_t pid, struct l_timespec *interval); } +162 AUE_NULL STD { int linux_nanosleep( \ + const struct l_timespec *rqtp, \ + struct l_timespec *rmtp); } +163 AUE_NULL STD { int linux_mremap(l_ulong addr, \ + l_ulong old_len, l_ulong new_len, \ + l_ulong flags, l_ulong new_addr); } +164 AUE_SETRESUID STD { int linux_setresuid16(l_uid16_t ruid, \ + l_uid16_t euid, l_uid16_t suid); } +165 AUE_GETRESUID STD { int linux_getresuid16(l_uid16_t *ruid, \ + l_uid16_t *euid, l_uid16_t *suid); } +166 AUE_NULL UNIMPL ; was linux_vm86 +167 AUE_NULL UNIMPL ; was linux_query_module +168 AUE_POLL NOPROTO { int poll(struct pollfd* fds, \ + unsigned int nfds, long timeout); } +169 AUE_NULL UNIMPL ; was linux_nfsservctl +170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \ + l_gid16_t egid, l_gid16_t sgid); } +171 AUE_GETRESGID STD { int linux_getresgid16(l_gid16_t *rgid, \ + l_gid16_t *egid, l_gid16_t *sgid); } +172 AUE_PRCTL STD { int linux_prctl(l_int option, l_int arg2, l_int arg3, \ + l_int arg4, l_int arg5); } +173 AUE_NULL STD { int linux_rt_sigreturn( \ + struct l_ucontext *ucp); } +174 AUE_NULL STD { int linux_rt_sigaction(l_int sig, \ + l_sigaction_t *act, l_sigaction_t *oact, \ + l_size_t sigsetsize); } +175 AUE_NULL STD { int linux_rt_sigprocmask(l_int how, \ + l_sigset_t *mask, l_sigset_t *omask, \ + l_size_t sigsetsize); } +176 AUE_NULL STD { int linux_rt_sigpending(l_sigset_t *set, \ + l_size_t sigsetsize); } +177 AUE_NULL STD { int linux_rt_sigtimedwait(l_sigset_t *mask, \ + l_siginfo_t *ptr, \ + struct l_timeval *timeout, \ + l_size_t sigsetsize); } +178 AUE_NULL STD { int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \ + l_siginfo_t *info); } +179 AUE_NULL STD { int linux_rt_sigsuspend( \ + l_sigset_t *newset, \ + l_size_t sigsetsize); } +180 AUE_PREAD STD { int linux_pread(l_uint fd, char *buf, \ + l_size_t nbyte, l_loff_t offset); } +181 AUE_PWRITE STD { int linux_pwrite(l_uint fd, char *buf, \ + l_size_t nbyte, l_loff_t offset); } +182 AUE_CHOWN STD { int linux_chown16(char *path, \ + l_uid16_t uid, l_gid16_t gid); } +183 AUE_GETCWD STD { int linux_getcwd(char *buf, \ + l_ulong bufsize); } +184 AUE_CAPGET STD { int linux_capget(struct l_user_cap_header *hdrp, \ + struct l_user_cap_data *datap); } +185 AUE_CAPSET STD { int linux_capset(struct l_user_cap_header *hdrp, \ + struct l_user_cap_data *datap); } +186 AUE_NULL STD { int linux_sigaltstack(l_stack_t *uss, \ + l_stack_t *uoss); } +187 AUE_SENDFILE STD { int linux_sendfile(void); } +188 AUE_NULL UNIMPL ; was getpmsg +189 AUE_NULL UNIMPL ; was putpmsg +190 AUE_VFORK STD { int linux_vfork(void); } +; 191: ugetrlimit +191 AUE_GETRLIMIT STD { int linux_getrlimit(l_uint resource, \ + struct l_rlimit *rlim); } +192 AUE_MMAP STD { int linux_mmap2(l_ulong addr, l_ulong len, \ + l_ulong prot, l_ulong flags, l_ulong fd, \ + l_ulong pgoff); } +193 AUE_TRUNCATE STD { int linux_truncate64(char *path, \ + l_loff_t length); } +194 AUE_FTRUNCATE STD { int linux_ftruncate64(l_uint fd, \ + l_loff_t length); } +195 AUE_STAT STD { int linux_stat64(const char *filename, \ + struct l_stat64 *statbuf); } +196 AUE_LSTAT STD { int linux_lstat64(const char *filename, \ + struct l_stat64 *statbuf); } +197 AUE_FSTAT STD { int linux_fstat64(l_int fd, \ + struct l_stat64 *statbuf); } +198 AUE_LCHOWN STD { int linux_lchown(char *path, l_uid_t uid, \ + l_gid_t gid); } +199 AUE_GETUID STD { int linux_getuid(void); } +200 AUE_GETGID STD { int linux_getgid(void); } +201 AUE_GETEUID NOPROTO { int geteuid(void); } +202 AUE_GETEGID NOPROTO { int getegid(void); } +203 AUE_SETREUID NOPROTO { int setreuid(uid_t ruid, uid_t euid); } +204 AUE_SETREGID NOPROTO { int setregid(gid_t rgid, gid_t egid); } +205 AUE_GETGROUPS STD { int linux_getgroups(l_int gidsetsize, \ + l_gid_t *grouplist); } +206 AUE_SETGROUPS STD { int linux_setgroups(l_int gidsetsize, \ + l_gid_t *grouplist); } +207 AUE_FCHOWN NODEF fchown fchown fchown_args int +208 AUE_SETRESUID NOPROTO { int setresuid(uid_t ruid, uid_t euid, \ + uid_t suid); } +209 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \ + uid_t *suid); } +210 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \ + gid_t sgid); } +211 AUE_GETRESGID NOPROTO { int getresgid(gid_t *rgid, gid_t *egid, \ + gid_t *sgid); } +212 AUE_CHOWN STD { int linux_chown(char *path, l_uid_t uid, \ + l_gid_t gid); } +213 AUE_SETUID NOPROTO { int setuid(uid_t uid); } +214 AUE_SETGID NOPROTO { int setgid(gid_t gid); } +215 AUE_SETFSUID STD { int linux_setfsuid(l_uid_t uid); } +216 AUE_SETFSGID STD { int linux_setfsgid(l_gid_t gid); } + +217 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ + void *dirent, l_uint count); } +218 AUE_PIVOT_ROOT STD { int linux_pivot_root(char *new_root, \ + char *put_old); } +219 AUE_MINCORE STD { int linux_mincore(l_ulong start, \ + l_size_t len, u_char *vec); } +220 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ + int behav); } +221 AUE_FCNTL STD { int linux_fcntl64(l_uint fd, l_uint cmd, \ + l_ulong arg); } +222 AUE_NULL UNIMPL +223 AUE_NULL UNIMPL +224 AUE_NULL STD { long linux_gettid(void); } +225 AUE_NULL UNIMPL linux_readahead +226 AUE_NULL STD { int linux_setxattr(void); } +227 AUE_NULL STD { int linux_lsetxattr(void); } +228 AUE_NULL STD { int linux_fsetxattr(void); } +229 AUE_NULL STD { int linux_getxattr(void); } +230 AUE_NULL STD { int linux_lgetxattr(void); } +231 AUE_NULL STD { int linux_fgetxattr(void); } +232 AUE_NULL STD { int linux_listxattr(void); } +233 AUE_NULL STD { int linux_llistxattr(void); } +234 AUE_NULL STD { int linux_flistxattr(void); } +235 AUE_NULL STD { int linux_removexattr(void); } +236 AUE_NULL STD { int linux_lremovexattr(void); } +237 AUE_NULL STD { int linux_fremovexattr(void); } +238 AUE_NULL STD { int linux_tkill(int tid, int sig); } +239 AUE_SENDFILE UNIMPL linux_sendfile64 +240 AUE_NULL STD { int linux_sys_futex(void *uaddr, int op, uint32_t val, \ + struct l_timespec *timeout, uint32_t *uaddr2, uint32_t val3); } +241 AUE_NULL STD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ + l_ulong *user_mask_ptr); } +242 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ + l_ulong *user_mask_ptr); } +243 AUE_NULL UNIMPL linux_io_setup +244 AUE_NULL UNIMPL linux_io_destroy +245 AUE_NULL UNIMPL linux_io_getevents +246 AUE_NULL UNIMPL linux_io_submit +247 AUE_NULL UNIMPL linux_io_cancel +248 AUE_EXIT STD { int linux_exit_group(int error_code); } +249 AUE_NULL STD { int linux_lookup_dcookie(void); } +250 AUE_NULL STD { int linux_epoll_create(l_int size); } +251 AUE_NULL STD { int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \ + struct epoll_event *event); } +252 AUE_NULL STD { int linux_epoll_wait(l_int epfd, struct epoll_event *events, \ + l_int maxevents, l_int timeout); } +253 AUE_NULL STD { int linux_remap_file_pages(void); } + +254 AUE_NULL UNIMPL ; was set_thread_area +255 AUE_NULL UNIMPL ; was get_thread_area +256 AUE_NULL STD { int linux_set_tid_address(int *tidptr); } +257 AUE_NULL STD { int linux_timer_create(clockid_t clock_id, \ + struct sigevent *evp, l_timer_t *timerid); } +258 AUE_NULL STD { int linux_timer_settime(l_timer_t timerid, l_int flags, \ + const struct itimerspec *new, struct itimerspec *old); } +259 AUE_NULL STD { int linux_timer_gettime(l_timer_t timerid, struct itimerspec *setting); } +260 AUE_NULL STD { int linux_timer_getoverrun(l_timer_t timerid); } +261 AUE_NULL STD { int linux_timer_delete(l_timer_t timerid); } +262 AUE_CLOCK_SETTIME STD { int linux_clock_settime(clockid_t which, struct l_timespec *tp); } +263 AUE_NULL STD { int linux_clock_gettime(clockid_t which, struct l_timespec *tp); } +264 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); } +265 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \ + struct l_timespec *rqtp, struct l_timespec *rmtp); } +266 AUE_STATFS STD { int linux_statfs64(char *path, size_t bufsize, struct l_statfs64_buf *buf); } +267 AUE_FSTATFS STD { int linux_fstatfs64(l_uint fd, size_t bufsize, struct l_statfs64_buf *buf); } +268 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); } +269 AUE_UTIMES STD { int linux_utimes(char *fname, \ + struct l_timeval *tptr); } +270 AUE_NULL STD { int linux_fadvise64_64(int fd, \ + l_loff_t offset, l_loff_t len, \ + int advice); } +271 AUE_NULL UNIMPL pciconfig_iobase +272 AUE_NULL UNIMPL pciconfig_read +273 AUE_NULL UNIMPL pciconfig_write +; linux 2.6.6: +274 AUE_NULL STD { int linux_mq_open(const char *name, int oflag, mode_t mode, \ + struct mq_attr *attr); } +275 AUE_NULL STD { int linux_mq_unlink(const char *name); } +276 AUE_NULL STD { int linux_mq_timedsend(l_mqd_t mqd, const char *msg_ptr, \ + size_t msg_len, unsigned int msg_prio, const struct \ + l_timespec *abs_timeout); } +277 AUE_NULL STD { int linux_mq_timedreceive(l_mqd_t mqd, char *msg_ptr, \ + size_t msg_len, unsigned int msg_prio, const struct \ + l_timespec *abs_timeout); } +278 AUE_NULL STD { int linux_mq_notify(l_mqd_t mqd, const struct l_timespec *abs_timeout); } +279 AUE_NULL STD { int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \ + struct mq_attr *oattr); } +280 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ + l_siginfo_t *info, int options, \ + void *rusage); } +281 AUE_SOCKET STD { int linux_socket(l_int domain, l_int type, \ + l_int protocol); } +282 AUE_BIND STD { int linux_bind(l_int s, l_uintptr_t name, \ + l_int namelen); } +283 AUE_CONNECT STD { int linux_connect(l_int s, l_uintptr_t name, \ + l_int namelen); } +284 AUE_LISTEN STD { int linux_listen(l_int s, l_int backlog); } +285 AUE_ACCEPT STD { int linux_accept(l_int s, l_uintptr_t addr, \ + l_uintptr_t namelen); } +286 AUE_GETSOCKNAME STD { int linux_getsockname(l_int s, \ + l_uintptr_t addr, l_uintptr_t namelen); } +287 AUE_GETPEERNAME STD { int linux_getpeername(l_int s, \ + l_uintptr_t addr, l_uintptr_t namelen); } +288 AUE_SOCKETPAIR STD { int linux_socketpair(l_int domain, \ + l_int type, l_int protocol, l_uintptr_t rsv); } +289 AUE_SEND STD { int linux_send(int s, l_uintptr_t msg, \ + int len, int flags); } +290 AUE_SENDTO STD { int linux_sendto(l_int s, l_uintptr_t msg, \ + l_int len, l_int flags, l_uintptr_t to, \ + l_int tolen); } +291 AUE_RECV STD { int linux_recv(int s, l_uintptr_t msg, \ + int len, int flags); } +292 AUE_RECVFROM STD { int linux_recvfrom(l_int s, l_uintptr_t buf, \ + l_size_t len, l_int flags, l_uintptr_t from, \ + l_uintptr_t fromlen); } +293 AUE_NULL STD { int linux_shutdown(l_int s, l_int how); } +294 AUE_SETSOCKOPT STD { int linux_setsockopt(l_int s, l_int level, \ + l_int optname, l_uintptr_t optval, \ + l_int optlen); } +295 AUE_GETSOCKOPT STD { int linux_getsockopt(l_int s, l_int level, \ + l_int optname, l_uintptr_t optval, \ + l_uintptr_t optlen); } +296 AUE_SENDMSG STD { int linux_sendmsg(l_int s, l_uintptr_t msg, \ + l_int flags); } +297 AUE_RECVMSG STD { int linux_recvmsg(l_int s, l_uintptr_t msg, \ + l_int flags); } +298 AUE_NULL STD { int linux_semop(l_int semid, \ + struct l_sembuf *tsops, l_uint nsops); } +299 AUE_NULL STD { int linux_semget(l_key_t key, \ + l_int nsems, l_int semflg); } +300 AUE_NULL STD { int linux_semctl(l_int semid, \ + l_int semnum, l_int cmd, union l_semun arg); } +301 AUE_NULL STD { int linux_msgsnd(l_int msqid, \ + struct l_msgbuf *msgp, l_size_t msgsz, \ + l_int msgflg); } +302 AUE_NULL STD { int linux_msgrcv(l_int msqid, \ + struct l_msgbuf *msgp, l_size_t msgsz, \ + l_long msgtyp, l_int msgflg); } +303 AUE_NULL STD { int linux_msgget(l_key_t key, l_int msgflg); } +304 AUE_NULL STD { int linux_msgctl(l_int msqid, l_int cmd, \ + struct l_msqid_ds *buf); } +305 AUE_NULL STD { int linux_shmat(l_int shmid, char *shmaddr, \ + l_int shmflg); } +306 AUE_NULL STD { int linux_shmdt(char *shmaddr); } +307 AUE_NULL STD { int linux_shmget(l_key_t key, l_size_t size, \ + l_int shmflg); } +308 AUE_NULL STD { int linux_shmctl(l_int shmid, l_int cmd, \ + struct l_shmid_ds *buf); } +; linux 2.6.11: +309 AUE_NULL STD { int linux_add_key(void); } +310 AUE_NULL STD { int linux_request_key(void); } +311 AUE_NULL STD { int linux_keyctl(void); } +312 AUE_NULL UNIMPL semtimedop +313 AUE_NULL UNIMPL ; was vserver + +; linux 2.6.13: +314 AUE_NULL STD { int linux_ioprio_set(void); } +315 AUE_NULL STD { int linux_ioprio_get(void); } +316 AUE_NULL STD { int linux_inotify_init(void); } +317 AUE_NULL STD { int linux_inotify_add_watch(void); } +318 AUE_NULL STD { int linux_inotify_rm_watch(void); } + +319 AUE_NULL STD { int linux_mbind(void); } +320 AUE_NULL STD { int linux_get_mempolicy(void); } +321 AUE_NULL STD { int linux_set_mempolicy(void); } + +; linux 2.6.16: +322 AUE_OPEN_RWTC STD { int linux_openat(l_int dfd, const char *filename, \ + l_int flags, l_int mode); } +323 AUE_MKDIRAT STD { int linux_mkdirat(l_int dfd, const char *pathname, \ + l_int mode); } +324 AUE_MKNODAT STD { int linux_mknodat(l_int dfd, const char *filename, \ + l_int mode, l_uint dev); } +325 AUE_FCHOWNAT STD { int linux_fchownat(l_int dfd, const char *filename, \ + l_uid16_t uid, l_gid16_t gid, l_int flag); } +326 AUE_FUTIMESAT STD { int linux_futimesat(l_int dfd, char *filename, \ + struct l_timeval *utimes); } +327 AUE_FSTATAT STD { int linux_fstatat64(l_int dfd, char *pathname, \ + struct l_stat64 *statbuf, l_int flag); } +328 AUE_UNLINKAT STD { int linux_unlinkat(l_int dfd, const char *pathname, \ + l_int flag); } +329 AUE_RENAMEAT STD { int linux_renameat(l_int olddfd, const char *oldname, \ + l_int newdfd, const char *newname); } +330 AUE_LINKAT STD { int linux_linkat(l_int olddfd, const char *oldname, \ + l_int newdfd, const char *newname, l_int flag); } +331 AUE_SYMLINKAT STD { int linux_symlinkat(const char *oldname, l_int newdfd, \ + const char *newname); } +332 AUE_READLINKAT STD { int linux_readlinkat(l_int dfd, const char *path, \ + char *buf, l_int bufsiz); } +333 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \ + l_mode_t mode); } +334 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, \ + l_int amode); } +335 AUE_SELECT STD { int linux_pselect6(l_int nfds, l_fd_set *readfds, \ + l_fd_set *writefds, l_fd_set *exceptfds, \ + struct l_timespec *tsp, l_uintptr_t *sig); } +336 AUE_POLL STD { int linux_ppoll(struct pollfd *fds, uint32_t nfds, \ + struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); } +337 AUE_NULL STD { int linux_unshare(void); } +; linux 2.6.17: +338 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \ + l_size_t len); } +339 AUE_NULL STD { int linux_get_robust_list(l_int pid, \ + struct linux_robust_list_head **head, l_size_t *len); } +340 AUE_NULL STD { int linux_splice(void); } +341 AUE_NULL STD { int linux_sync_file_range(void); } +342 AUE_NULL STD { int linux_tee(void); } +343 AUE_NULL STD { int linux_vmsplice(void); } +; linux 2.6.18: +344 AUE_NULL STD { int linux_move_pages(void); } +; linux 2.6.19: +345 AUE_NULL STD { int linux_getcpu(void); } +346 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ + l_int maxevents, l_int timeout, l_sigset_t *mask); } +; linux 2.6.22: +347 AUE_NULL STD { int linux_kexec_load(void); } +348 AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, const char *pathname, \ + const struct l_timespec *times, l_int flags); } +349 AUE_NULL STD { int linux_signalfd(void); } +350 AUE_NULL STD { int linux_timerfd_create(void); } +351 AUE_NULL STD { int linux_eventfd(l_uint initval); } +; linux 2.6.23: +352 AUE_NULL STD { int linux_fallocate(l_int fd, l_int mode, \ + l_loff_t offset, l_loff_t len); } +; linux 2.6.25: +353 AUE_NULL STD { int linux_timerfd_settime(void); } +354 AUE_NULL STD { int linux_timerfd_gettime(void); } +; linux 2.6.27: +355 AUE_NULL STD { int linux_signalfd4(void); } +356 AUE_NULL STD { int linux_eventfd2(l_uint initval, l_int flags); } +357 AUE_NULL STD { int linux_epoll_create1(l_int flags); } +358 AUE_NULL STD { int linux_dup3(l_int oldfd, \ + l_int newfd, l_int flags); } +359 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } +360 AUE_NULL STD { int linux_inotify_init1(void); } +; linux 2.6.30: +361 AUE_NULL STD { int linux_preadv(void); } +362 AUE_NULL STD { int linux_pwritev(void); } +; linux 2.6.31: +363 AUE_NULL STD { int linux_rt_tsigqueueinfo(void); } +364 AUE_NULL STD { int linux_perf_event_open(void); } +; linux 2.6.33: +365 AUE_NULL STD { int linux_recvmmsg(l_int s, \ + struct l_mmsghdr *msg, l_uint vlen, \ + l_uint flags, struct l_timespec *timeout); } +366 AUE_ACCEPT STD { int linux_accept4(l_int s, l_uintptr_t addr, \ + l_uintptr_t namelen, int flags); } +367 AUE_NULL STD { int linux_fanotify_init(void); } +368 AUE_NULL STD { int linux_fanotify_mark(void); } +; linux 2.6.36: +369 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ + l_uint resource, \ + struct rlimit *new, \ + struct rlimit *old); } +; later: +370 AUE_NULL STD { int linux_name_to_handle_at(void); } +371 AUE_NULL STD { int linux_open_by_handle_at(void); } +372 AUE_NULL STD { int linux_clock_adjtime(void); } +373 AUE_SYNC STD { int linux_syncfs(l_int fd); } +374 AUE_NULL STD { int linux_sendmmsg(l_int s, \ + struct l_mmsghdr *msg, l_uint vlen, \ + l_uint flags); } +375 AUE_NULL STD { int linux_setns(void); } +376 AUE_NULL STD { int linux_process_vm_readv(void); } +377 AUE_NULL STD { int linux_process_vm_writev(void); } +378 AUE_NULL UNIMPL kcmp +379 AUE_NULL UNIMPL finit_module + +380 AUE_NULL UNIMPL sys_sched_setattr +381 AUE_NULL UNIMPL sys_sched_getattr +382 AUE_NULL UNIMPL sys_renameat2 +383 AUE_NULL UNIMPL sys_seccomp +384 AUE_NULL UNIMPL sys_getrandom +385 AUE_NULL UNIMPL sys_memfd_create +386 AUE_NULL UNIMPL sys_bpf +387 AUE_NULL UNIMPL sys_execveat +388 AUE_NULL UNIMPL sys_userfaultfd +389 AUE_NULL UNIMPL sys_membarrier +390 AUE_NULL UNIMPL sys_mlock2 +391 AUE_NULL UNIMPL sys_copy_file_range +392 AUE_NULL UNIMPL sys_preadv2 +393 AUE_NULL UNIMPL sys_pwritev2 +394 AUE_NULL UNIMPL +395 AUE_NULL UNIMPL +396 AUE_NULL UNIMPL +397 AUE_NULL UNIMPL +398 AUE_NULL UNIMPL +399 AUE_NULL UNIMPL + +; ARM specific +; Effective number here is 0x000f0000 +; but we must not breaks syscall numbering + +400 AUE_NULL UNIMPL +401 AUE_NULL UNIMPL breakpoint +402 AUE_NULL UNIMPL cacheflush +403 AUE_NULL UNIMPL usr26 +404 AUE_NULL UNIMPL usr32 +405 AUE_NULL STD { int linux_set_tls(void* tls); } + +; please, keep this line at the end. +406 AUE_NULL UNIMPL nosys From owner-svn-src-all@freebsd.org Fri Nov 8 14:18:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 752EE1B3E5F; Fri, 8 Nov 2019 14:18:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478j6d3Fd2z4QX7; Fri, 8 Nov 2019 14:18:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A45D273DA; Fri, 8 Nov 2019 14:18:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8EIHL6021555; Fri, 8 Nov 2019 14:18:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EIHwh021554; Fri, 8 Nov 2019 14:18:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081418.xA8EIHwh021554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354539 - head/sys/arm/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/linux X-SVN-Commit-Revision: 354539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:18:17 -0000 Author: emaste Date: Fri Nov 8 14:18:16 2019 New Revision: 354539 URL: https://svnweb.freebsd.org/changeset/base/354539 Log: arm linuxulator: reformat syscalls.master per current style Equivalent to r339958 for sys/kern/syscalls.master. Also add a dummy name for an UNUSED. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/linux/syscalls.master Modified: head/sys/arm/linux/syscalls.master ============================================================================== --- head/sys/arm/linux/syscalls.master Fri Nov 8 14:17:25 2019 (r354538) +++ head/sys/arm/linux/syscalls.master Fri Nov 8 14:18:16 2019 (r354539) @@ -1,29 +1,8 @@ $FreeBSD$ -; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 -; System call name/number master file (or rather, slave, from LINUX). -; Processed to create linux_sysent.c, linux_proto.h and linux_syscall.h. +; Linux ABI system call name/number map, based on Linux file +; arch/arm/kernel/calls.S -; Columns: number audit type nargs name alt{name,tag,rtyp}/comments -; number system call number, must be in order -; audit the audit event associated with the system call -; A value of AUE_NULL means no auditing, but it also means that -; there is no audit event for the call at this time. For the -; case where the event exists, but we don't want auditing, the -; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, UNIMPL -; name psuedo-prototype of syscall routine -; If one of the following alts is different, then all appear: -; altname name of system call if different -; alttag name of args struct tag if different from [o]`name'"_args" -; altrtyp return type if not int (bogus - syscalls always return int) -; for UNIMPL/OBSOL, name continues with comments - -; types: -; STD always included -; OBSOL obsolete, not included in system, only specifies name -; UNIMPL not implemented, placeholder only - #include #include #include @@ -34,606 +13,1859 @@ ; Isn't pretty, but there seems to be no other way to trap nosys #define nosys linux_nosys -; #ifdef's, etc. may be included, and are copied to the output files. - 0 AUE_NULL UNIMPL setup -1 AUE_EXIT STD { void linux_exit(int rval); } -2 AUE_FORK STD { int linux_fork(void); } -3 AUE_NULL NOPROTO { int read(int fd, char *buf, \ - u_int nbyte); } -4 AUE_NULL NOPROTO { int write(int fd, char *buf, \ - u_int nbyte); } -5 AUE_OPEN_RWTC STD { int linux_open(char *path, l_int flags, \ - l_int mode); } -6 AUE_CLOSE NOPROTO { int close(int fd); } +1 AUE_EXIT STD { + void linux_exit( + int rval + ); + } +2 AUE_FORK STD { + int linux_fork(void); + } +3 AUE_NULL NOPROTO { + int read( + int fd, + char *buf, + u_int nbyte + ); + } +4 AUE_NULL NOPROTO { + int write( + int fd, + char *buf, + u_int nbyte + ); + } +5 AUE_OPEN_RWTC STD { + int linux_open( + char *path, + l_int flags, + l_int mode + ); + } +6 AUE_CLOSE NOPROTO { + int close( + int fd); + } 7 AUE_NULL UNIMPL ; was linux_waitpid -8 AUE_CREAT STD { int linux_creat(char *path, \ - l_int mode); } -9 AUE_LINK STD { int linux_link(char *path, char *to); } -10 AUE_UNLINK STD { int linux_unlink(char *path); } -11 AUE_EXECVE STD { int linux_execve(char *path, char **argp, \ - char **envp); } -12 AUE_CHDIR STD { int linux_chdir(char *path); } +8 AUE_CREAT STD { + int linux_creat( + char *path, + l_int mode + ); + } +9 AUE_LINK STD { + int linux_link( + char *path, + char *to + ); + } +10 AUE_UNLINK STD { + int linux_unlink( + char *path + ); + } +11 AUE_EXECVE STD { + int linux_execve( + char *path, + char **argp, + char **envp + ); + } +12 AUE_CHDIR STD { + int linux_chdir( + char *path + ); + } 13 AUE_NULL UNIMPL ; was OBSOLETE(linux_time) -14 AUE_MKNOD STD { int linux_mknod(char *path, l_int mode, \ - l_dev_t dev); } -15 AUE_CHMOD STD { int linux_chmod(char *path, \ - l_mode_t mode); } -16 AUE_LCHOWN STD { int linux_lchown16(char *path, \ - l_uid16_t uid, l_gid16_t gid); } +14 AUE_MKNOD STD { + int linux_mknod( + char *path, + l_int mode, + l_dev_t dev + ); + } +15 AUE_CHMOD STD { + int linux_chmod( + char *path, + l_mode_t mode + ); + } +16 AUE_LCHOWN STD { + int linux_lchown16( + char *path, + l_uid16_t uid, + l_gid16_t gid); + } 17 AUE_NULL UNIMPL ; was linux_break 18 AUE_NULL UNIMPL ; was linux_stat -19 AUE_LSEEK STD { int linux_lseek(l_uint fdes, l_off_t off, \ - l_int whence); } -20 AUE_GETPID STD { int linux_getpid(void); } -21 AUE_MOUNT STD { int linux_mount(char *specialfile, \ - char *dir, char *filesystemtype, \ - l_ulong rwflag, void *data); } +19 AUE_LSEEK STD { + int linux_lseek( + l_uint fdes, + l_off_t off, + l_int whence + ); + } +20 AUE_GETPID STD { + int linux_getpid(void); + } +21 AUE_MOUNT STD { + int linux_mount( + char *specialfile, + char *dir, + char *filesystemtype, + l_ulong rwflag, + void *data + ); + } 22 AUE_NULL UNIMPL ; was OBSOLETE(linux_oldumount) -23 AUE_SETUID STD { int linux_setuid16(l_uid16_t uid); } -24 AUE_GETUID STD { int linux_getuid16(void); } +23 AUE_SETUID STD { + int linux_setuid16( + l_uid16_t uid); + } +24 AUE_GETUID STD { + int linux_getuid16(void); + } 25 AUE_NULL UNIMPL ; was OBSOLETE(linux_stime) 26 AUE_PTRACE UNIMPL ptrace 27 AUE_NULL UNIMPL ; was OBSOLETE(linux_alarm) 28 AUE_NULL UNIMPL ; was linux_fstat -29 AUE_NULL STD { int linux_pause(void); } +29 AUE_NULL STD { + int linux_pause(void); + } 30 AUE_NULL UNIMPL ; was OBSOLETE(linux_utime) 31 AUE_NULL UNIMPL ; was linux_stty 32 AUE_NULL UNIMPL ; was linux_getty -33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); } -34 AUE_NICE STD { int linux_nice(l_int inc); } +33 AUE_ACCESS STD { + int linux_access( + char *path, + l_int amode + ); + } +34 AUE_NICE STD { + int linux_nice( + l_int inc + ); + } 35 AUE_NULL UNIMPL ; was linux_ftime -36 AUE_SYNC NOPROTO { int sync(void); } -37 AUE_KILL STD { int linux_kill(l_int pid, l_int signum); } -38 AUE_RENAME STD { int linux_rename(char *from, char *to); } -39 AUE_MKDIR STD { int linux_mkdir(char *path, l_int mode); } -40 AUE_RMDIR STD { int linux_rmdir(char *path); } -41 AUE_DUP NOPROTO { int dup(u_int fd); } -42 AUE_PIPE STD { int linux_pipe(l_int *pipefds); } -43 AUE_NULL STD { int linux_times(struct l_times_argv *buf); } +36 AUE_SYNC NOPROTO { + int sync(void); + } +37 AUE_KILL STD { + int linux_kill( + l_int pid, + l_int signum + ); + } +38 AUE_RENAME STD { + int linux_rename( + char *from, + char *to + ); + } +39 AUE_MKDIR STD { + int linux_mkdir( + char *path, + l_int mode + ); + } +40 AUE_RMDIR STD { + int linux_rmdir( + char *path + ); + } +41 AUE_DUP NOPROTO { + int dup( + u_int fd); + } +42 AUE_PIPE STD { + int linux_pipe( + l_int *pipefds + ); + } +43 AUE_NULL STD { + int linux_times( + struct l_times_argv *buf + ); + } 44 AUE_NULL UNIMPL ; was linux_prof -45 AUE_NULL STD { int linux_brk(l_ulong dsend); } -46 AUE_SETGID STD { int linux_setgid16(l_gid16_t gid); } -47 AUE_GETGID STD { int linux_getgid16(void); } +45 AUE_NULL STD { + int linux_brk( + l_ulong dsend); + } +46 AUE_SETGID STD { + int linux_setgid16( + l_gid16_t gid); + } +47 AUE_GETGID STD { + int linux_getgid16(void); + } 48 AUE_NULL UNIMPL ; was linux_signal -49 AUE_GETEUID STD { int linux_geteuid16(void); } -50 AUE_GETEGID STD { int linux_getegid16(void); } -51 AUE_ACCT NOPROTO { int acct(char *path); } -52 AUE_UMOUNT STD { int linux_umount(char *path, l_int flags); } +49 AUE_GETEUID STD { + int linux_geteuid16(void); + } +50 AUE_GETEGID STD { + int linux_getegid16(void); + } +51 AUE_ACCT NOPROTO { + int acct( + char *path + ); + } +52 AUE_UMOUNT STD { + int linux_umount( + char *path, + l_int flags + ); + } 53 AUE_NULL UNIMPL ; was linux_lock -54 AUE_IOCTL STD { int linux_ioctl(l_uint fd, l_uint cmd, \ - l_ulong arg); } -55 AUE_FCNTL STD { int linux_fcntl(l_uint fd, l_uint cmd, \ - l_ulong arg); } +54 AUE_IOCTL STD { + int linux_ioctl( + l_uint fd, + l_uint cmd, + l_ulong arg + ); + } +55 AUE_FCNTL STD { + int linux_fcntl( + l_uint fd, + l_uint cmd, + l_ulong arg + ); + } 56 AUE_NULL UNIMPL ; was linux_mpx -57 AUE_SETPGRP NOPROTO { int setpgid(int pid, int pgid); } +57 AUE_SETPGRP NOPROTO { + int setpgid( + int pid, + int pgid); + } 58 AUE_NULL UNIMPL ; was linux_ulimit 59 AUE_NULL UNIMPL ; was linux_olduname -60 AUE_UMASK NOPROTO { int umask(int newmask); } -61 AUE_CHROOT NOPROTO { int chroot(char *path); } -62 AUE_NULL STD { int linux_ustat(l_dev_t dev, \ - struct l_ustat *ubuf); } -63 AUE_DUP2 NOPROTO { int dup2(u_int from, u_int to); } -64 AUE_GETPPID STD { int linux_getppid(void); } -65 AUE_GETPGRP NOPROTO { int getpgrp(void); } -66 AUE_SETSID NOPROTO { int setsid(void); } -67 AUE_NULL STD { int linux_sigaction(l_int sig, \ - l_osigaction_t *nsa, \ - l_osigaction_t *osa); } +60 AUE_UMASK NOPROTO { + int umask( + int newmask + ); + } +61 AUE_CHROOT NOPROTO { + int chroot( + char *path + ); + } +62 AUE_NULL STD { + int linux_ustat( + l_dev_t dev, + struct l_ustat *ubuf + ); + } +63 AUE_DUP2 NOPROTO { + int dup2( + u_int from, + u_int to + ); + } +64 AUE_GETPPID STD { + int linux_getppid(void); + } +65 AUE_GETPGRP NOPROTO { + int getpgrp(void); + } +66 AUE_SETSID NOPROTO { + int setsid(void); + } +67 AUE_NULL STD { + int linux_sigaction( + l_int sig, + l_osigaction_t *nsa, + l_osigaction_t *osa + ); + } 68 AUE_NULL UNIMPL ; was linux_sgetmask 69 AUE_NULL UNIMPL ; was linux_ssetmask -70 AUE_SETREUID STD { int linux_setreuid16(l_uid16_t ruid, \ - l_uid16_t euid); } -71 AUE_SETREGID STD { int linux_setregid16(l_gid16_t rgid, \ - l_gid16_t egid); } -72 AUE_NULL STD { int linux_sigsuspend(l_int hist0, \ - l_int hist1, l_osigset_t mask); } -73 AUE_NULL STD { int linux_sigpending(l_osigset_t *mask); } -74 AUE_SYSCTL STD { int linux_sethostname(char *hostname, \ - u_int len); } -75 AUE_SETRLIMIT STD { int linux_setrlimit(l_uint resource, \ - struct l_rlimit *rlim); } +70 AUE_SETREUID STD { + int linux_setreuid16( + l_uid16_t ruid, + l_uid16_t euid); + } +71 AUE_SETREGID STD { + int linux_setregid16( + l_gid16_t rgid, + l_gid16_t egid); + } +72 AUE_NULL STD { + int linux_sigsuspend( + l_int hist0, + l_int hist1, + l_osigset_t mask + ); + } +73 AUE_NULL STD { + int linux_sigpending( + l_osigset_t *mask + ); + } +74 AUE_SYSCTL STD { + int linux_sethostname( + char *hostname, + u_int len + ); + } +75 AUE_SETRLIMIT STD { + int linux_setrlimit( + l_uint resource, + struct l_rlimit *rlim + ); + } 76 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_getrlimit) -77 AUE_GETRUSAGE NOPROTO { int getrusage(int who, \ - struct rusage *rusage); } -78 AUE_GETTIMEOFDAY STD { int linux_gettimeofday( \ - struct timeval32 *tp, \ - struct timezone *tzp); } -79 AUE_SETTIMEOFDAY STD { int linux_settimeofday( \ - struct timeval32 *tp, \ - struct timezone *tzp); } -80 AUE_GETGROUPS STD { int linux_getgroups16(l_uint gidsetsize, \ - l_gid16_t *gidset); } -81 AUE_SETGROUPS STD { int linux_setgroups16(l_uint gidsetsize, \ - l_gid16_t *gidset); } +77 AUE_GETRUSAGE NOPROTO { + int getrusage( + int who, + struct rusage *rusage + ); + } +78 AUE_GETTIMEOFDAY STD { + int linux_gettimeofday( + struct timeval32 *tp, + struct timezone *tzp + ); + } +79 AUE_SETTIMEOFDAY STD { + int linux_settimeofday( + struct timeval32 *tp, + struct timezone *tzp + ); + } +80 AUE_GETGROUPS STD { + int linux_getgroups16( + l_uint gidsetsize, + l_gid16_t *gidset + ); + } +81 AUE_SETGROUPS STD { + int linux_setgroups16( + l_uint gidsetsize, + l_gid16_t *gidset + ); + } 82 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_select) -83 AUE_SYMLINK STD { int linux_symlink(char *path, char *to); } +83 AUE_SYMLINK STD { + int linux_symlink( + char *path, + char *to + ); + } 84 AUE_NULL UNIMPL ; was linux_lstat -85 AUE_READLINK STD { int linux_readlink(char *name, char *buf, \ - l_int count); } +85 AUE_READLINK STD { + int linux_readlink( + char *name, + char *buf, + l_int count + ); + } 86 AUE_NULL UNIMPL uselib -87 AUE_SWAPON NOPROTO { int swapon(char *name); } -88 AUE_REBOOT STD { int linux_reboot(l_int magic1, \ - l_int magic2, l_uint cmd, void *arg); } +87 AUE_SWAPON NOPROTO { + int swapon( + char *name + ); + } +88 AUE_REBOOT STD { + int linux_reboot( + l_int magic1, + l_int magic2, + l_uint cmd, + void *arg + ); + } 89 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_readdir) 90 AUE_NULL UNIMPL ; was OBSOLETE(linux_old_mmap) -91 AUE_MUNMAP NOPROTO { int munmap(caddr_t addr, int len); } -92 AUE_TRUNCATE STD { int linux_truncate(char *path, \ - l_ulong length); } -93 AUE_FTRUNCATE STD { int linux_ftruncate(int fd, long length); } -94 AUE_FCHMOD NOPROTO { int fchmod(int fd, int mode); } -95 AUE_FCHOWN NOPROTO { int fchown(int fd, int uid, int gid); } -96 AUE_GETPRIORITY STD { int linux_getpriority(int which, int who); } -97 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \ - int prio); } +91 AUE_MUNMAP NOPROTO { + int munmap( + caddr_t addr, + int len + ); + } +92 AUE_TRUNCATE STD { + int linux_truncate( + char *path, + l_ulong length + ); + } +93 AUE_FTRUNCATE STD { + int linux_ftruncate( + int fd, + long length + ); + } +94 AUE_FCHMOD NOPROTO { + int fchmod( + int fd, + int mode + ); + } +95 AUE_FCHOWN NOPROTO { + int fchown( + int fd, + int uid, + int gid); + } +96 AUE_GETPRIORITY STD { + int linux_getpriority( + int which, + int who + ); + } +97 AUE_SETPRIORITY NOPROTO { + int setpriority( + int which, + int who, + int prio + ); + } 98 AUE_NULL UNIMPL ; was linux_profil -99 AUE_STATFS STD { int linux_statfs(char *path, \ - struct l_statfs_buf *buf); } -100 AUE_FSTATFS STD { int linux_fstatfs(l_uint fd, \ - struct l_statfs_buf *buf); } +99 AUE_STATFS STD { + int linux_statfs( + char *path, + struct l_statfs_buf *buf + ); + } +100 AUE_FSTATFS STD { + int linux_fstatfs( + l_uint fd, + struct l_statfs_buf *buf + ); + } 101 AUE_NULL UNIMPL ; was ioperm 102 AUE_NULL UNIMPL ; was OBSOLETE(linux_socketcall) -103 AUE_NULL STD { int linux_syslog(l_int type, char *buf, \ - l_int len); } -104 AUE_SETITIMER STD { int linux_setitimer(l_int which, \ - struct l_itimerval *itv, \ - struct l_itimerval *oitv); } -105 AUE_GETITIMER STD { int linux_getitimer(l_int which, \ - struct l_itimerval *itv); } -106 AUE_STAT STD { int linux_newstat(char *path, \ - struct l_newstat *buf); } -107 AUE_LSTAT STD { int linux_newlstat(char *path, \ - struct l_newstat *buf); } -108 AUE_FSTAT STD { int linux_newfstat(l_uint fd, \ - struct l_newstat *buf); } +103 AUE_NULL STD { + int linux_syslog( + l_int type, + char *buf, + l_int len + ); + } +104 AUE_SETITIMER STD { + int linux_setitimer( + l_int which, + struct l_itimerval *itv, + struct l_itimerval *oitv + ); + } +105 AUE_GETITIMER STD { + int linux_getitimer( + l_int which, + struct l_itimerval *itv + ); + } +106 AUE_STAT STD { + int linux_newstat( + char *path, + struct l_newstat *buf + ); + } +107 AUE_LSTAT STD { + int linux_newlstat( + char *path, + struct l_newstat *buf + ); + } +108 AUE_FSTAT STD { + int linux_newfstat( + l_uint fd, + struct l_newstat *buf + ); + } 109 AUE_NULL UNIMPL ; was linux_uname 110 AUE_NULL UNIMPL ; was linux_iopl -111 AUE_NULL STD { int linux_vhangup(void); } +111 AUE_NULL STD { + int linux_vhangup(void); + } 112 AUE_NULL UNIMPL ; 113 AUE_NULL UNIMPL ; was OBSOLETE(linux_syscall) -114 AUE_WAIT4 STD { int linux_wait4(l_pid_t pid, \ - l_int *status, l_int options, \ - void *rusage); } -115 AUE_SWAPOFF STD { int linux_swapoff(void); } -116 AUE_NULL STD { int linux_sysinfo(struct l_sysinfo *info); } +114 AUE_WAIT4 STD { + int linux_wait4( + l_pid_t pid, + l_int *status, + l_int options, + void *rusage + ); + } +115 AUE_SWAPOFF STD { + int linux_swapoff(void); + } +116 AUE_NULL STD { + int linux_sysinfo( + struct l_sysinfo *info + ); + } 117 AUE_NULL UNIMPL ; was OBSOLETE(linux_ipc) -118 AUE_FSYNC NOPROTO { int fsync(int fd); } -119 AUE_SIGRETURN STD { int linux_sigreturn( \ - struct l_sigframe *sfp); } -120 AUE_RFORK STD { int linux_clone(l_int flags, void *stack, \ - void *parent_tidptr, void *tls, void * child_tidptr); } -121 AUE_SYSCTL STD { int linux_setdomainname(char *name, \ - int len); } -122 AUE_NULL STD { int linux_newuname( \ - struct l_new_utsname *buf); } +118 AUE_FSYNC NOPROTO { + int fsync( + int fd); + } +119 AUE_SIGRETURN STD { + int linux_sigreturn( + struct l_sigframe *sfp + ); + } +120 AUE_RFORK STD { + int linux_clone( + l_int flags, + void *stack, + void *parent_tidptr, + void *tls, + void * child_tidptr + ); + } +121 AUE_SYSCTL STD { + int linux_setdomainname( + char *name, + int len + ); + } +122 AUE_NULL STD { + int linux_newuname( + struct l_new_utsname *buf + ); + } 123 AUE_NULL UNIMPL ; was linux_modify_ldt -124 AUE_ADJTIME STD { int linux_adjtimex(void); } -125 AUE_MPROTECT STD { int linux_mprotect(caddr_t addr, int len, \ - int prot); } -126 AUE_SIGPROCMASK STD { int linux_sigprocmask(l_int how, \ - l_osigset_t *mask, l_osigset_t *omask); } +124 AUE_ADJTIME STD { + int linux_adjtimex(void); + } +125 AUE_MPROTECT STD { + int linux_mprotect( + caddr_t addr, + int len, + int prot + ); + } +126 AUE_SIGPROCMASK STD { + int linux_sigprocmask( + l_int how, + l_osigset_t *mask, + l_osigset_t *omask + ); + } 127 AUE_NULL UNIMPL ; was linux_create_module -128 AUE_NULL STD { int linux_init_module(void); } -129 AUE_NULL STD { int linux_delete_module(void); } +128 AUE_NULL STD { + int linux_init_module(void); + } +129 AUE_NULL STD { + int linux_delete_module(void); + } 130 AUE_NULL UNIMPL ; was linux_get_kernel_syms -131 AUE_QUOTACTL STD { int linux_quotactl(void); } -132 AUE_GETPGID NOPROTO { int getpgid(int pid); } -133 AUE_FCHDIR NOPROTO { int fchdir(int fd); } -134 AUE_BDFLUSH STD { int linux_bdflush(void); } -135 AUE_NULL STD { int linux_sysfs(l_int option, \ - l_ulong arg1, l_ulong arg2); } -136 AUE_PERSONALITY STD { int linux_personality(l_ulong per); } +131 AUE_QUOTACTL STD { + int linux_quotactl(void); + } +132 AUE_GETPGID NOPROTO { + int getpgid( + int pid); + } +133 AUE_FCHDIR NOPROTO { + int fchdir( + int fd); + } +134 AUE_BDFLUSH STD { + int linux_bdflush(void); + } +135 AUE_NULL STD { + int linux_sysfs( + l_int option, + l_ulong arg1, + l_ulong arg2 + ); + } +136 AUE_PERSONALITY STD { + int linux_personality( + l_ulong per + ); + } 137 AUE_NULL UNIMPL ; was afs_syscall -138 AUE_SETFSUID STD { int linux_setfsuid16(l_uid16_t uid); } -139 AUE_SETFSGID STD { int linux_setfsgid16(l_gid16_t gid); } -140 AUE_LSEEK STD { int linux_llseek(l_int fd, l_ulong ohigh, \ - l_ulong olow, l_loff_t *res, \ - l_uint whence); } -141 AUE_GETDIRENTRIES STD { int linux_getdents(l_uint fd, \ - void *dent, l_uint count); } +138 AUE_SETFSUID STD { + int linux_setfsuid16( + l_uid16_t uid); + } +139 AUE_SETFSGID STD { + int linux_setfsgid16( + l_gid16_t gid); + } +140 AUE_LSEEK STD { + int linux_llseek( + l_int fd, + l_ulong ohigh, + l_ulong olow, + l_loff_t *res, + l_uint whence + ); + } +141 AUE_GETDIRENTRIES STD { + int linux_getdents( + l_uint fd, + void *dent, + l_uint count + ); + } ; 142: newselect -142 AUE_SELECT STD { int linux_select(l_int nfds, \ - l_fd_set *readfds, l_fd_set *writefds, \ - l_fd_set *exceptfds, \ - struct l_timeval *timeout); } -143 AUE_FLOCK NOPROTO { int flock(int fd, int how); } -144 AUE_MSYNC STD { int linux_msync(l_ulong addr, \ - l_size_t len, l_int fl); } -145 AUE_READV NOPROTO { int readv(int fd, struct iovec *iovp, \ - u_int iovcnt); } -146 AUE_WRITEV NOPROTO { int writev(int fd, struct iovec *iovp, \ - u_int iovcnt); } -147 AUE_GETSID STD { int linux_getsid(l_pid_t pid); } -148 AUE_NULL STD { int linux_fdatasync(l_uint fd); } -149 AUE_SYSCTL STD { int linux_sysctl( \ - struct l___sysctl_args *args); } -150 AUE_MLOCK NOPROTO { int mlock(const void *addr, size_t len); } -151 AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); } -152 AUE_MLOCKALL NOPROTO { int mlockall(int how); } -153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } -154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ - struct sched_param *param); } -155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \ - struct sched_param *param); } -156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \ - l_pid_t pid, l_int policy, \ - struct sched_param *param); } -157 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \ - l_pid_t pid); } -158 AUE_NULL NOPROTO { int sched_yield(void); } -159 AUE_SCHED_GET_PRIORITY_MAX STD { int linux_sched_get_priority_max( \ - l_int policy); } -160 AUE_SCHED_GET_PRIORITY_MIN STD { int linux_sched_get_priority_min( \ - l_int policy); } -161 AUE_SCHED_RR_GET_INTERVAL STD { int linux_sched_rr_get_interval( \ - l_pid_t pid, struct l_timespec *interval); } -162 AUE_NULL STD { int linux_nanosleep( \ - const struct l_timespec *rqtp, \ - struct l_timespec *rmtp); } -163 AUE_NULL STD { int linux_mremap(l_ulong addr, \ - l_ulong old_len, l_ulong new_len, \ - l_ulong flags, l_ulong new_addr); } -164 AUE_SETRESUID STD { int linux_setresuid16(l_uid16_t ruid, \ - l_uid16_t euid, l_uid16_t suid); } -165 AUE_GETRESUID STD { int linux_getresuid16(l_uid16_t *ruid, \ - l_uid16_t *euid, l_uid16_t *suid); } +142 AUE_SELECT STD { + int linux_select( + l_int nfds, + l_fd_set *readfds, + l_fd_set *writefds, + l_fd_set *exceptfds, + struct l_timeval *timeout + ); + } +143 AUE_FLOCK NOPROTO { + int flock( + int fd, + int how + ); + } +144 AUE_MSYNC STD { + int linux_msync( + l_ulong addr, + l_size_t len, + l_int fl + ); + } +145 AUE_READV NOPROTO { + int readv( + int fd, + struct iovec *iovp, + u_int iovcnt + ); + } +146 AUE_WRITEV NOPROTO { + int writev( + int fd, + struct iovec *iovp, + u_int iovcnt + ); + } +147 AUE_GETSID STD { + int linux_getsid( + l_pid_t pid); + } +148 AUE_NULL STD { + int linux_fdatasync( + l_uint fd); + } +149 AUE_SYSCTL STD { + int linux_sysctl( + struct l___sysctl_args *args + ); + } +150 AUE_MLOCK NOPROTO { + int mlock( + const void *addr, + size_t len + ); + } +151 AUE_MUNLOCK NOPROTO { + int munlock( + const void *addr, + size_t len + ); + } +152 AUE_MLOCKALL NOPROTO { + int mlockall( + int how + ); + } +153 AUE_MUNLOCKALL NOPROTO { + int munlockall(void); + } +154 AUE_SCHED_SETPARAM STD { + int linux_sched_setparam( + l_pid_t pid, + struct sched_param *param + ); + } +155 AUE_SCHED_GETPARAM STD { + int linux_sched_getparam( + l_pid_t pid, + struct sched_param *param + ); + } +156 AUE_SCHED_SETSCHEDULER STD { + int linux_sched_setscheduler( + l_pid_t pid, + l_int policy, + struct sched_param *param + ); + } +157 AUE_SCHED_GETSCHEDULER STD { + int linux_sched_getscheduler( + l_pid_t pid); + } +158 AUE_NULL NOPROTO { + int sched_yield(void); + } +159 AUE_SCHED_GET_PRIORITY_MAX STD { + int linux_sched_get_priority_max( + l_int policy + ); + } +160 AUE_SCHED_GET_PRIORITY_MIN STD { + int linux_sched_get_priority_min( + l_int policy + ); + } +161 AUE_SCHED_RR_GET_INTERVAL STD { + int linux_sched_rr_get_interval( + l_pid_t pid, + struct l_timespec *interval + ); + } +162 AUE_NULL STD { + int linux_nanosleep( + const struct l_timespec *rqtp, + struct l_timespec *rmtp + ); + } +163 AUE_NULL STD { + int linux_mremap( + l_ulong addr, + l_ulong old_len, + l_ulong new_len, + l_ulong flags, + l_ulong new_addr + ); + } +164 AUE_SETRESUID STD { + int linux_setresuid16( + l_uid16_t ruid, + l_uid16_t euid, + l_uid16_t suid); + } +165 AUE_GETRESUID STD { + int linux_getresuid16( + l_uid16_t *ruid, + l_uid16_t *euid, + l_uid16_t *suid); + } 166 AUE_NULL UNIMPL ; was linux_vm86 167 AUE_NULL UNIMPL ; was linux_query_module -168 AUE_POLL NOPROTO { int poll(struct pollfd* fds, \ - unsigned int nfds, long timeout); } +168 AUE_POLL NOPROTO { + int poll( + struct pollfd* fds, + unsigned int nfds, + long timeout + ); + } 169 AUE_NULL UNIMPL ; was linux_nfsservctl -170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \ - l_gid16_t egid, l_gid16_t sgid); } -171 AUE_GETRESGID STD { int linux_getresgid16(l_gid16_t *rgid, \ - l_gid16_t *egid, l_gid16_t *sgid); } -172 AUE_PRCTL STD { int linux_prctl(l_int option, l_int arg2, l_int arg3, \ - l_int arg4, l_int arg5); } -173 AUE_NULL STD { int linux_rt_sigreturn( \ - struct l_ucontext *ucp); } -174 AUE_NULL STD { int linux_rt_sigaction(l_int sig, \ - l_sigaction_t *act, l_sigaction_t *oact, \ - l_size_t sigsetsize); } -175 AUE_NULL STD { int linux_rt_sigprocmask(l_int how, \ - l_sigset_t *mask, l_sigset_t *omask, \ - l_size_t sigsetsize); } -176 AUE_NULL STD { int linux_rt_sigpending(l_sigset_t *set, \ - l_size_t sigsetsize); } -177 AUE_NULL STD { int linux_rt_sigtimedwait(l_sigset_t *mask, \ - l_siginfo_t *ptr, \ - struct l_timeval *timeout, \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Nov 8 14:25:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44B571B420C; Fri, 8 Nov 2019 14:25:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478jGv13jdz4R34; Fri, 8 Nov 2019 14:25:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07B0F2759C; Fri, 8 Nov 2019 14:25:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8EPQTN027403; Fri, 8 Nov 2019 14:25:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EPQnw027402; Fri, 8 Nov 2019 14:25:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081425.xA8EPQnw027402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354540 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:25:27 -0000 Author: emaste Date: Fri Nov 8 14:25:26 2019 New Revision: 354540 URL: https://svnweb.freebsd.org/changeset/base/354540 Log: add reference to PR for sparc64 BSD_CRTBEGIN in BROKEN_OPTIONS We will soon remove the BSD_CRTBEGIN option (and will use the new CRT files always) as part of the GCC 4.2.1 removal. Right now BSD_CRTBEGIN works everywhere but sparc64; add a reference to the PR in case anyone stumbles across this and is looking for more information. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Nov 8 14:18:16 2019 (r354539) +++ head/share/mk/src.opts.mk Fri Nov 8 14:25:26 2019 (r354540) @@ -411,7 +411,7 @@ BROKEN_OPTIONS+=HYPERV BROKEN_OPTIONS+=NVME .endif -# Sparc64 need extra crt*.o files +# Sparc64 need extra crt*.o files - PR 239851 .if ${__T:Msparc64} BROKEN_OPTIONS+=BSD_CRTBEGIN .endif From owner-svn-src-all@freebsd.org Fri Nov 8 14:28:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80AEB1B4355; Fri, 8 Nov 2019 14:28:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478jLc2rX9z4RDv; Fri, 8 Nov 2019 14:28:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44FC3275A2; Fri, 8 Nov 2019 14:28:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8ESeOo027579; Fri, 8 Nov 2019 14:28:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8ESefv027578; Fri, 8 Nov 2019 14:28:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911081428.xA8ESefv027578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 8 Nov 2019 14:28:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354541 - head/lib/csu/common X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/csu/common X-SVN-Commit-Revision: 354541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:28:40 -0000 Author: kevans Date: Fri Nov 8 14:28:39 2019 New Revision: 354541 URL: https://svnweb.freebsd.org/changeset/base/354541 Log: csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs .jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as we're still getting .jcr sections added -- presumably due to the reference in crtbegin. Without this terminal, the .jcr section (without data) overlaps with the next section and register_classes in crtbegin will be examining the wrong item. PR: 241439 Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D22132 Modified: head/lib/csu/common/crtend.c Modified: head/lib/csu/common/crtend.c ============================================================================== --- head/lib/csu/common/crtend.c Fri Nov 8 14:25:26 2019 (r354540) +++ head/lib/csu/common/crtend.c Fri Nov 8 14:28:39 2019 (r354541) @@ -26,9 +26,14 @@ __FBSDID("$FreeBSD$"); #include "crt.h" -#ifdef HAVE_CTORS typedef void (*crt_func)(void); +static crt_func __JCR_LIST__[] __section(".jcr") __used = { + (crt_func)0 +}; + +#ifdef HAVE_CTORS + /* * On some architectures and toolchains we may need to call the .ctors. * These are called in the reverse order they are in the ELF file. @@ -39,9 +44,6 @@ static crt_func __CTOR_END__[] __section(".ctors") __u (crt_func)0 }; static crt_func __DTOR_END__[] __section(".dtors") __used = { - (crt_func)0 -}; -static crt_func __JCR_LIST__[] __section(".jcr") __used = { (crt_func)0 }; From owner-svn-src-all@freebsd.org Fri Nov 8 14:36:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F19E1B47C1; Fri, 8 Nov 2019 14:36:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478jWx1Q9Fz4Rvc; Fri, 8 Nov 2019 14:36:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13F1527782; Fri, 8 Nov 2019 14:36:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Eaiau035258; Fri, 8 Nov 2019 14:36:44 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EaiIQ035255; Fri, 8 Nov 2019 14:36:44 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911081436.xA8EaiIQ035255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 8 Nov 2019 14:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354542 - in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354542 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:36:45 -0000 Author: bz Date: Fri Nov 8 14:36:44 2019 New Revision: 354542 URL: https://svnweb.freebsd.org/changeset/base/354542 Log: frag6: properly handle atomic fragments according to RFCs. RFC 8200 says: "If the fragment is a whole datagram (that is, both the Fragment Offset field and the M flag are zero), then it does not need any further reassembly and should be processed as a fully reassembled packet (i.e., updating Next Header, adjust Payload Length, removing the Fragment header, etc.). .." That means we should remove the fragment header and make all the adjustments rather than just skipping over the fragment header. The difference should be noticeable in that a properly handled atomic fragment triggering an ICMPv6 message at an upper layer (e.g. dest unreach, unreachable port) will not include the fragment header. Update the test cases to also test for an unfragmentable part. That is needed so that the next header is properly updated (not just lengths). MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22155 Modified: head/sys/netinet6/frag6.c head/tests/sys/netinet6/frag6/frag6_03.py head/tests/sys/netinet6/frag6/frag6_03.sh Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Nov 8 14:28:39 2019 (r354541) +++ head/sys/netinet6/frag6.c Fri Nov 8 14:36:44 2019 (r354542) @@ -395,6 +395,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) m = *mp; offset = *offp; + M_ASSERTPKTHDR(m); + ip6 = mtod(m, struct ip6_hdr *); #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE); @@ -437,22 +439,35 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6STAT_INC(ip6s_fragments); in6_ifstat_inc(dstifp, ifs6_reass_reqd); - /* Offset now points to data portion. */ - offset += sizeof(struct ip6_frag); - /* * Handle "atomic" fragments (offset and m bit set to 0) upfront, - * unrelated to any reassembly. Still need to remove the frag hdr. + * unrelated to any reassembly. We need to remove the frag hdr + * which is ugly. * See RFC 6946 and section 4.5 of RFC 8200. */ if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) { IP6STAT_INC(ip6s_atomicfrags); - /* XXX-BZ handle correctly. */ + nxt = ip6f->ip6f_nxt; + /* + * Set nxt(-hdr field value) to the original value. + * We cannot just set ip6->ip6_nxt as there might be + * an unfragmentable part with extension headers and + * we must update the last one. + */ + m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), + (caddr_t)&nxt); + ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - + sizeof(struct ip6_frag)); + if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) + goto dropfrag2; + m->m_pkthdr.len -= sizeof(struct ip6_frag); in6_ifstat_inc(dstifp, ifs6_reass_ok); - *offp = offset; - m->m_flags |= M_FRAGMENTED; - return (ip6f->ip6f_nxt); + *mp = m; + return (nxt); } + + /* Offset now points to data portion. */ + offset += sizeof(struct ip6_frag); /* Get fragment length and discard 0-byte fragments. */ frgpartlen = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) - offset; Modified: head/tests/sys/netinet6/frag6/frag6_03.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.py Fri Nov 8 14:28:39 2019 (r354541) +++ head/tests/sys/netinet6/frag6/frag6_03.py Fri Nov 8 14:36:44 2019 (r354542) @@ -101,6 +101,33 @@ def main(): if not sniffer.foundCorrectPacket: sys.exit(1) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ## + # + # Atomic fragment with extension header. + # + # A: Nothing listening on UDP port. + # R: ICMPv6 dst unreach, unreach port. + # + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + ip6f01 = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrDestOpt(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) / \ + sp.IPv6ExtHdrFragment(offset=0, m=0, id=0x3001) / \ + sp.UDP(dport=3456, sport=6543) + if args.debug : + ip6f01.display() + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + + sleep(0.10) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_03.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.sh Fri Nov 8 14:28:39 2019 (r354541) +++ head/tests/sys/netinet6/frag6/frag6_03.sh Fri Nov 8 14:36:44 2019 (r354542) @@ -67,12 +67,12 @@ frag6_03_check_stats() { # Check selection of global UDP stats. # cat < ${HOME}/filter-${jname}.txt - 1 + 2 0 0 0 0 - 1 + 2 0 0 0 @@ -94,11 +94,11 @@ EOF 0 0 0 - 1 + 2 0 0 0 - 1 + 2 0 0 0 @@ -124,12 +124,12 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 1 + 2 0 0 0 0 - 1 + 2 0 0 0 @@ -170,8 +170,8 @@ EOF 0 0 0 - 1 - 1 + 2 + 2 0 EOF count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` @@ -196,8 +196,8 @@ EOF 0 0 0 - 1 - 1 + 2 + 2 0 0 0 From owner-svn-src-all@freebsd.org Fri Nov 8 14:51:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E8E91B4D23; Fri, 8 Nov 2019 14:51:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478jrZ6hQmz4SdH; Fri, 8 Nov 2019 14:51:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C90792799A; Fri, 8 Nov 2019 14:51:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8EpAhE043192; Fri, 8 Nov 2019 14:51:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8EpAcO043190; Fri, 8 Nov 2019 14:51:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081451.xA8EpAcO043190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354543 - in head: lib/libkvm sys/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: lib/libkvm sys/sys X-SVN-Commit-Revision: 354543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:51:11 -0000 Author: emaste Date: Fri Nov 8 14:51:09 2019 New Revision: 354543 URL: https://svnweb.freebsd.org/changeset/base/354543 Log: kvm: fix types for cross-debugging As with other libkvm interfaces use maximum-sized types to support cross-debugging (e.g. a 64-bit vmcore on a 32-bit host). See https://lists.freebsd.org/pipermail/svn-src-all/2019-February/176051.html for further discussion. This is an API-breaking change, but there are few consumers of this interface today. Reviewed by: will Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21945 Modified: head/lib/libkvm/kvm.h head/lib/libkvm/kvm_private.c head/sys/sys/types.h Modified: head/lib/libkvm/kvm.h ============================================================================== --- head/lib/libkvm/kvm.h Fri Nov 8 14:36:44 2019 (r354542) +++ head/lib/libkvm/kvm.h Fri Nov 8 14:51:09 2019 (r354543) @@ -82,18 +82,18 @@ struct kvm_swap { }; struct kvm_page { - unsigned int version; - u_long paddr; - u_long kmap_vaddr; - u_long dmap_vaddr; - vm_prot_t prot; - u_long offset; - size_t len; - /* end of version 1 */ + u_int kp_version; + kpaddr_t kp_paddr; + kvaddr_t kp_kmap_vaddr; + kvaddr_t kp_dmap_vaddr; + vm_prot_t kp_prot; + off_t kp_offset; + size_t kp_len; + /* end of version 2 */ }; #define SWIF_DEV_PREFIX 0x0002 -#define LIBKVM_WALK_PAGES_VERSION 1 +#define LIBKVM_WALK_PAGES_VERSION 2 __BEGIN_DECLS int kvm_close(kvm_t *); Modified: head/lib/libkvm/kvm_private.c ============================================================================== --- head/lib/libkvm/kvm_private.c Fri Nov 8 14:36:44 2019 (r354542) +++ head/lib/libkvm/kvm_private.c Fri Nov 8 14:51:09 2019 (r354543) @@ -755,13 +755,13 @@ _kvm_visit_cb(kvm_t *kd, kvm_walk_pages_cb_t *cb, void { unsigned int pgsz = page_size ? page_size : len; struct kvm_page p = { - .version = LIBKVM_WALK_PAGES_VERSION, - .paddr = pa, - .kmap_vaddr = kmap_vaddr, - .dmap_vaddr = dmap_vaddr, - .prot = prot, - .offset = _kvm_pt_find(kd, pa, pgsz), - .len = len, + .kp_version = LIBKVM_WALK_PAGES_VERSION, + .kp_paddr = pa, + .kp_kmap_vaddr = kmap_vaddr, + .kp_dmap_vaddr = dmap_vaddr, + .kp_prot = prot, + .kp_offset = _kvm_pt_find(kd, pa, pgsz), + .kp_len = len, }; return cb(&p, arg); Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Fri Nov 8 14:36:44 2019 (r354542) +++ head/sys/sys/types.h Fri Nov 8 14:51:09 2019 (r354543) @@ -252,11 +252,12 @@ typedef struct cap_rights cap_rights_t; #endif /* - * Types suitable for exporting size and pointers (as virtual addresses) - * from the kernel independent of native word size. These should be - * used in place of size_t and (u)intptr_t in structs which contain such - * types that are shared with userspace. + * Types suitable for exporting physical addresses, virtual addresses + * (pointers), and memory object sizes from the kernel independent of native + * word size. These should be used in place of vm_paddr_t, (u)intptr_t, and + * size_t in structs which contain such types that are shared with userspace. */ +typedef __uint64_t kpaddr_t; typedef __uint64_t kvaddr_t; typedef __uint64_t ksize_t; From owner-svn-src-all@freebsd.org Fri Nov 8 14:59:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 339691B5005; Fri, 8 Nov 2019 14:59:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478k2Q0YqFz4T3r; Fri, 8 Nov 2019 14:59:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EABD427B2C; Fri, 8 Nov 2019 14:59:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8ExfLF048139; Fri, 8 Nov 2019 14:59:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8ExfeZ048138; Fri, 8 Nov 2019 14:59:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081459.xA8ExfeZ048138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 14:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354544 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 354544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 14:59:42 -0000 Author: emaste Date: Fri Nov 8 14:59:41 2019 New Revision: 354544 URL: https://svnweb.freebsd.org/changeset/base/354544 Log: elfcopy/strip: Ensure sections have required alignment on output Object files may specify insufficient alignment on certain sections, for example due to a bug in NASM[1]. When we detect that case in elfcopy or strip, emit a warning and increase the alignment to the minimum required. The NASM bug was fixed in 2015[2], but we might as well have this fixup (and warning) in elfcopy in case we encounter such a file for any other reason. This might be reworked somewhat upstream - see ELF Tool Chain ticket 485[3]. [1] https://bugzilla.nasm.us/show_bug.cgi?id=3392307 [2] https://repo.or.cz/w/nasm.git/commit/1f0cb0f2c1ba632c0fab02424928cfb756a9160c [3] https://sourceforge.net/p/elftoolchain/tickets/485/ PR: 198611 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2292 Modified: head/contrib/elftoolchain/elfcopy/sections.c Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Fri Nov 8 14:51:09 2019 (r354543) +++ head/contrib/elftoolchain/elfcopy/sections.c Fri Nov 8 14:59:41 2019 (r354544) @@ -879,6 +879,43 @@ pad_section(struct elfcopy *ecp, struct section *s) elf_errmsg(-1)); } +static int +section_type_alignment(int sht, int class) +{ + switch (sht) + { + case SHT_DYNAMIC: + case SHT_DYNSYM: + case SHT_FINI_ARRAY: + case SHT_GNU_HASH: + case SHT_INIT_ARRAY: + case SHT_PREINIT_ARRAY: + case SHT_REL: + case SHT_RELA: + case SHT_SYMTAB: + return (class == ELFCLASS64 ? 8 : 4); + case SHT_SUNW_move: + return (8); + case SHT_GNU_LIBLIST: + case SHT_GROUP: + case SHT_HASH: + case SHT_NOTE: + case SHT_SUNW_verdef: /* == SHT_GNU_verdef */ + case SHT_SUNW_verneed: /* == SHT_GNU_verneed */ + case SHT_SYMTAB_SHNDX: + return (4); + case SHT_SUNW_syminfo: + case SHT_SUNW_versym: /* == SHT_GNU_versym */ + return (2); + case SHT_NOBITS: + case SHT_PROGBITS: + case SHT_STRTAB: + case SHT_SUNW_dof: + return (1); + } + return (1); +} + void resync_sections(struct elfcopy *ecp) { @@ -886,6 +923,7 @@ resync_sections(struct elfcopy *ecp) GElf_Shdr osh; uint64_t off; int first; + int min_alignment; ps = NULL; first = 1; @@ -908,6 +946,12 @@ resync_sections(struct elfcopy *ecp) /* Align section offset. */ if (s->align == 0) s->align = 1; + min_alignment = section_type_alignment(s->type, ecp->oec); + if (s->align < INT_MAX && (int)s->align < min_alignment) { + warnx("section %s alignment %d increased to %d", + s->name, (int)s->align, min_alignment); + s->align = min_alignment; + } if (off <= s->off) { if (!s->loadable || (ecp->flags & RELOCATABLE)) s->off = roundup(off, s->align); @@ -937,6 +981,7 @@ resync_sections(struct elfcopy *ecp) errx(EXIT_FAILURE, "gelf_getshdr() failed: %s", elf_errmsg(-1)); osh.sh_addr = s->vma; + osh.sh_addralign = s->align; osh.sh_offset = s->off; osh.sh_size = s->sz; if (!gelf_update_shdr(s->os, &osh)) From owner-svn-src-all@freebsd.org Fri Nov 8 15:15:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A0EC1B579B; Fri, 8 Nov 2019 15:15:45 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478kNw6wQnz4VNJ; Fri, 8 Nov 2019 15:15:44 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 58238223E; Fri, 8 Nov 2019 15:15:44 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Fri, 8 Nov 2019 15:15:41 +0000 From: Glen Barber To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350089 - head Message-ID: <20191108151541.GU5599@FreeBSD.org> References: <201907171909.x6HJ96Tu082986@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oGy11dVowAZA6eXT" Content-Disposition: inline In-Reply-To: <201907171909.x6HJ96Tu082986@repo.freebsd.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 15:15:45 -0000 --oGy11dVowAZA6eXT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 17, 2019 at 07:09:06PM +0000, Mark Johnston wrote: > Author: markj > Date: Wed Jul 17 19:09:05 2019 > New Revision: 350089 > URL: https://svnweb.freebsd.org/changeset/base/350089 >=20 > Log: > Add an initial RELNOTES file. > =20 > The intent is to provide a convenient location to document changes > that are relevant to users of binary FreeBSD distributions, in contrast > with UPDATING, which exists to document caveats for users who build > FreeBSD from source. > =20 > This complements the "Relnotes:" tag in commit messages by providing a > place to document the change in more detail, or in case a "Relnotes:" > tag was accidentally omitted. In particular, "Relnotes:" should be > used if you do not intend to document the change in RELNOTES for some > reason. > =20 > Changes to the file should not be MFCed. For now the file will exist > only in head, but may be updated via direct commits to stable branches > depending on how things go. > =20 I had to go look at the original thread to remind myself about this, but regarding not MFCing changes from head to stable branches, I think there may have been some confusion in the discussion. By "changes should not be MFCed", at least based on my recollection of how the conversation was going, I (at least) meant "not MFCed, but committed as a direct commit to stable branches." In other words, merging the RELNOTES change from head to stable/X does not really make sense, as the revision numbers will have changed, and would inevitably cause merge conflicts. Now that 12.1 is out, maybe we can expand the idea of this file into stable/12 and even stable/11. One additional idea that came to mind is with the formatting for stable branches. For example, in head, there is: rNNNNNN: The foo(8) utility was added. For stable branches, I would propose the format of: rNNNNNM, MFC of rNNNNNN: The foo(8) utility was added. Thoughts? Glen --oGy11dVowAZA6eXT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAl3Fhp0ACgkQAxRYpUeP 4pPozw//ZwQ0CIkxoRyhkmuJlu6cWcvYG8FSgLZsG08UNJmV3BQ58qF2yJQFV/N0 UeBW/60BrhDn3WRf3LhtG/ZKoIFJEhnWvgShdyMBv4iSV6oYg65ZIbnleLoflAf5 ktINUsgbyq/X+DbcdEGAFXrL03IFukIkxmAKDV4kf4FSJ9ywyPTBfyynhKxB5Vpy 3s+5K7IJQlWVxmCmSOtGoE3IKDMofKQbvRJZL6i13ViBQlu5qMJimzuQkDLBoXX5 SCysNlzumzH2beJM9JsBE5YgxPG4ISkjJ3uhi3HxudNT7tMYuu+W09il2z9zneQ0 uEx3yqw/rA2ikuRq5H9ck80oFdlL+af3z/olhodgTPCfSEqAY5ZWVgLTxic3y5Ym I3y4vNeEIwZx1B1kQRIdyDOFOvxIIQe3qle9QCyLKKruptxJahN8Z3N0VF3pedPp i+UIujwtF4NGNHjtjBgDOi1+by6b+EwUuv5r2yhV3usnuZQXjSb00v9VNNsuXNHb 6alUlR2ymX/OT8lxEozrFfNOmvdleJZNmodpK2L3HTeWS1lStISixMAOPu2NDVmX s3BWfevCGqwVQSAwNDsq7WDR1jan4QK4ocfav8Y91ihokkF2uZbbePzKg5Yegli4 S79Qa2knx23Tx6Ipicqj1leDZzD9BgWXSacS24ZnoO7QI8GB/kg= =EMF7 -----END PGP SIGNATURE----- --oGy11dVowAZA6eXT-- From owner-svn-src-all@freebsd.org Fri Nov 8 15:20:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95C701B5906; Fri, 8 Nov 2019 15:20:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478kVD3Qlcz4VZk; Fri, 8 Nov 2019 15:20:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5903A27EF5; Fri, 8 Nov 2019 15:20:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8FKKqm060316; Fri, 8 Nov 2019 15:20:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8FKKuo060315; Fri, 8 Nov 2019 15:20:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081520.xA8FKKuo060315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 15:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354545 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 354545 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 15:20:20 -0000 Author: emaste Date: Fri Nov 8 15:20:19 2019 New Revision: 354545 URL: https://svnweb.freebsd.org/changeset/base/354545 Log: mark LLVM_LIBUNWIND as broken on sparc64, with PR reference PR: 233405 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Nov 8 14:59:41 2019 (r354544) +++ head/share/mk/src.opts.mk Fri Nov 8 15:20:19 2019 (r354545) @@ -411,9 +411,11 @@ BROKEN_OPTIONS+=HYPERV BROKEN_OPTIONS+=NVME .endif -# Sparc64 need extra crt*.o files - PR 239851 .if ${__T:Msparc64} +# Sparc64 need extra crt*.o files - PR 239851 BROKEN_OPTIONS+=BSD_CRTBEGIN +# PR 233405 +BROKEN_OPTIONS+=LLVM_LIBUNWIND .endif .if ${COMPILER_FEATURES:Mc++11} && \ From owner-svn-src-all@freebsd.org Fri Nov 8 15:26:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 113EA1B5CE3; Fri, 8 Nov 2019 15:26:24 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478kdC6f41z4W80; Fri, 8 Nov 2019 15:26:23 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2EA8E6; Fri, 8 Nov 2019 15:26:23 +0000 (UTC) (envelope-from jrm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8FQNC6066120; Fri, 8 Nov 2019 15:26:23 GMT (envelope-from jrm@FreeBSD.org) Received: (from jrm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8FQNP9066119; Fri, 8 Nov 2019 15:26:23 GMT (envelope-from jrm@FreeBSD.org) Message-Id: <201911081526.xA8FQNP9066119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrm set sender to jrm@FreeBSD.org using -f From: Joseph Mingrone Date: Fri, 8 Nov 2019 15:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r354546 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: jrm X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 354546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 15:26:24 -0000 Author: jrm (ports committer) Date: Fri Nov 8 15:26:23 2019 New Revision: 354546 URL: https://svnweb.freebsd.org/changeset/base/354546 Log: Sadly, take in Kurt Lidl's commit bit after his death. In Memory of Kurt Lidl: https://www.freebsdfoundation.org/blog/in-memory-of-kurt-lidl/ Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Fri Nov 8 15:20:19 2019 (r354545) +++ svnadmin/conf/access Fri Nov 8 15:26:23 2019 (r354546) @@ -129,7 +129,6 @@ kibab kp landonf leitao -lidl loos lstewart luporl From owner-svn-src-all@freebsd.org Fri Nov 8 15:48:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 207141B616A; Fri, 8 Nov 2019 15:48:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478l6j039mz4X0f; Fri, 8 Nov 2019 15:48:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x841.google.com with SMTP id o3so6943879qtj.8; Fri, 08 Nov 2019 07:48:28 -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:user-agent; bh=wpmxzNjwmrOMVC3TYGifGplBs1Jmeal2KLWCbTCK+n0=; b=VZ5hQAps7leLxrCG7wcfIDQ9+S4VVoAxOpeM4L31fh4yjEltw1oHerjegGQsFsL+Yo qL7OIa50uRGXcnR+hdaqD/wox3ir/YetUF8ncHDf+00YGGM+xRhTkdAU0+ncaPLxJw/N L9Sl9proBgYJCGCGcFURVutsMieUjFX5FNX1VTjKSzQLVr1MXmEJ50c+C4r4GgXRHA07 KAGIVVZ/aZu4U+VFSkWoBVNKFxlcQ6jUPg5HdGO1KIwHIF18kSNO9PgvJYWnT8ngBoJJ zbTXP6Q3LW1iRoaqXWlf3lRKSFA3CX9ySOTPPNO8AEAAxo4scvJGVv42fllwuZHPdewN f5bg== 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:user-agent; bh=wpmxzNjwmrOMVC3TYGifGplBs1Jmeal2KLWCbTCK+n0=; b=OPqy82IIKhrkwPXze03YNaVC2TDE7ek9VcZo69yQhCfZC/aatMSaqTH43wc/DLx5m4 yVZ/Rz/x+t/NuzHS9/ph76VkNfth4UQxNkdMt5xGPE2ygviLCCCMLWVvCHa9nxziqlsU 2E7PQ9VyalnvwyavTZCUhBR2BJn85HUc3wROAyq/cvkUHB1wSNoZ+mN+h3Yp8LuJcFir sXwLtaLrFFCqz+HnHzaJ+vIJhg19t2YHQ06rdfLNpVr0PvvJsSzcW+/ekz30sWmzT/mQ +L9VKQzXGdUb7+7IsR5JAJkL9HaDV75y6uK4Tm9ZblDvRn4gIvv0BAxC0uCR6QQKmdjb 9+Gw== X-Gm-Message-State: APjAAAU2MYU2iNhva7vSAbLRFlUk1jYZPtkIi/TOnj+x+Vm4BQm4efkQ CkNk/xDEfqi+3Q9mluLszAHYoNRHYew= X-Google-Smtp-Source: APXvYqyj59CmApXeDbdVwYBMh1mM22m3ePaGWuYGsDGsKOn1JBCNVMjz8RwAquWOhHWYvogmSnG9Fg== X-Received: by 2002:ac8:4403:: with SMTP id j3mr8550305qtn.66.1573228107405; Fri, 08 Nov 2019 07:48:27 -0800 (PST) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id 76sm3374830qke.111.2019.11.08.07.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 07:48:26 -0800 (PST) Sender: Mark Johnston Date: Fri, 8 Nov 2019 10:41:15 -0500 From: Mark Johnston To: Glen Barber Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r350089 - head Message-ID: <20191108154115.GA37198@raichu> References: <201907171909.x6HJ96Tu082986@repo.freebsd.org> <20191108151541.GU5599@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191108151541.GU5599@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 478l6j039mz4X0f X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 15:48:29 -0000 On Fri, Nov 08, 2019 at 03:15:41PM +0000, Glen Barber wrote: > On Wed, Jul 17, 2019 at 07:09:06PM +0000, Mark Johnston wrote: > > Author: markj > > Date: Wed Jul 17 19:09:05 2019 > > New Revision: 350089 > > URL: https://svnweb.freebsd.org/changeset/base/350089 > > > > Log: > > Add an initial RELNOTES file. > > > > The intent is to provide a convenient location to document changes > > that are relevant to users of binary FreeBSD distributions, in contrast > > with UPDATING, which exists to document caveats for users who build > > FreeBSD from source. > > > > This complements the "Relnotes:" tag in commit messages by providing a > > place to document the change in more detail, or in case a "Relnotes:" > > tag was accidentally omitted. In particular, "Relnotes:" should be > > used if you do not intend to document the change in RELNOTES for some > > reason. > > > > Changes to the file should not be MFCed. For now the file will exist > > only in head, but may be updated via direct commits to stable branches > > depending on how things go. > > > > I had to go look at the original thread to remind myself about this, but > regarding not MFCing changes from head to stable branches, I think there > may have been some confusion in the discussion. > > By "changes should not be MFCed", at least based on my recollection of > how the conversation was going, I (at least) meant "not MFCed, but > committed as a direct commit to stable branches." In other words, > merging the RELNOTES change from head to stable/X does not really make > sense, as the revision numbers will have changed, and would inevitably > cause merge conflicts. Right. I don't think there's any problem with having a per-branch RELNOTES file so long as they are maintained by direct commits. When I added the file I initially just wanted to target HEAD and see if people would actually add things to the file. > Now that 12.1 is out, maybe we can expand the idea of this file into > stable/12 and even stable/11. One additional idea that came to mind is > with the formatting for stable branches. > > For example, in head, there is: > > rNNNNNN: > The foo(8) utility was added. > > For stable branches, I would propose the format of: > > rNNNNNM, MFC of rNNNNNN: > The foo(8) utility was added. > > Thoughts? That seems reasonable to me. From owner-svn-src-all@freebsd.org Fri Nov 8 16:10:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E0221B68FE; Fri, 8 Nov 2019 16:10:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478lcQ3Cdvz4Y4N; Fri, 8 Nov 2019 16:10:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 516AD88D; Fri, 8 Nov 2019 16:10:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8GAkw9091116; Fri, 8 Nov 2019 16:10:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8GAkwr091115; Fri, 8 Nov 2019 16:10:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911081610.xA8GAkwr091115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Nov 2019 16:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354547 - stable/12/contrib/blacklist/bin X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/contrib/blacklist/bin X-SVN-Commit-Revision: 354547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 16:10:46 -0000 Author: emaste Date: Fri Nov 8 16:10:45 2019 New Revision: 354547 URL: https://svnweb.freebsd.org/changeset/base/354547 Log: MFC r353898: blacklistd: remove reference to NetBSD npfctl Xr pfctl instead PR: 221069 Submitted by: "fml" Modified: stable/12/contrib/blacklist/bin/blacklistd.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/blacklist/bin/blacklistd.8 ============================================================================== --- stable/12/contrib/blacklist/bin/blacklistd.8 Fri Nov 8 15:26:23 2019 (r354546) +++ stable/12/contrib/blacklist/bin/blacklistd.8 Fri Nov 8 16:10:45 2019 (r354547) @@ -233,7 +233,7 @@ Socket to receive connection notifications. .Sh SEE ALSO .Xr blacklistd.conf 5 , .Xr blacklistctl 8 , -.Xr npfctl 8 , +.Xr pfctl 8 , .Xr syslogd 8 .Sh HISTORY .Nm From owner-svn-src-all@freebsd.org Fri Nov 8 16:27:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9FC81B6EE1; Fri, 8 Nov 2019 16:27:36 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478lzq6WhFz4Z0F; Fri, 8 Nov 2019 16:27:35 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qv1-xf42.google.com with SMTP id x14so2435645qvu.0; Fri, 08 Nov 2019 08:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tD2yvSSWSBFNr73tUkwjt9YSORzRbKnUxzi18dj7coQ=; b=T7HNvI4X53Lx0qoufhDwJDGNJJVKxA7c2KWUe9IXRXQbPsVwo5jv1IJhXyObQvwrYF H8umiTp6xI81C3VYz5s4djQAqRXtVS+1mn+TawCDvHuuaXcAGsjIaUu5gQ1QvQvLnpnz 1y7uswk2HvZlZXmxe3Dmn5y7wvxazf0drS2sdZlsQ2MrPtMJzNFCNKgfpoMC2llf6YO9 jk17oJB1tIRTWvbspsigiAaKn0uiDa7hP+gzZEdBJsX/g2N9Ogm0xhTOBvPBnSLQA8Tv WunAGNTim/Qm7Ufquzq+EatoeJYRYOe9J5F/BIqLbIHW0+QIvF6k/+mT7km97GrnMou4 UY/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=tD2yvSSWSBFNr73tUkwjt9YSORzRbKnUxzi18dj7coQ=; b=HRmuyGtGP9uRERTZZYmAPS9pXFoUzvKG4MvrI39dTCDdFVAqikdFGWGZvbWDBAPGor ged3ZxjY9bqI5pIBBffYlNjHtQ6xmnAdQjCLutb+kokCs0flATjDQb/Ol9JcW3TtWJKq xnGMUa+MLvPl80Z1LvpyyDNrYuyKBu5epHIv8SHCcAu/YFOj2CtI7mr1sFQ+EOLHnLS9 J8poXTm39MAXQXmPFKV8eI8GGIg88pfbqaCSr58nPUkrsHmK6gSu/A6C2IHr28liZlRn e3lh8M1R41F2DjN0pxGH23epwROyislA/zYXWu5QbLFxq+IJOARDJEVuYs/kXvREsHHE NA/w== X-Gm-Message-State: APjAAAW2DLciSL+p2iEpXVJXNBrpgdffD96S7BGyO3IFAZi5Um/mupEP qMx+ydB+CDIr9bcWRIi0kpMqaV// X-Google-Smtp-Source: APXvYqzuGEF7gvfB9LH4d1JjXmEvGUNElbednLnpJpkzh9pt+mmUD37/68nS2jr4DFEfRgu/12JH3g== X-Received: by 2002:ad4:55c7:: with SMTP id bt7mr10174576qvb.29.1573230454270; Fri, 08 Nov 2019 08:27:34 -0800 (PST) Received: from mbp.home ([2804:f1c:800:fc00:351a:3009:3672:3590]) by smtp.gmail.com with ESMTPSA id t27sm2793257qkm.19.2019.11.08.08.27.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2019 08:27:33 -0800 (PST) Sender: Renato Botelho Subject: Re: svn commit: r354149 - head/sys/net To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910291736.x9THa6Gd018030@repo.freebsd.org> From: Renato Botelho Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB AAG0LFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+iQFXBBMB CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf uAuixGf4bK6C7hcE34D/ULkBDQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm 1iNu1Tc5ccvcyAwTswARAQABiQE8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+ BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov fms0VzARITYzTwmpDQ== Message-ID: <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> Date: Fri, 8 Nov 2019 13:27:30 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <201910291736.x9THa6Gd018030@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 478lzq6WhFz4Z0F X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=T7HNvI4X; dmarc=none; spf=pass (mx1.freebsd.org: domain of gargabsd@gmail.com designates 2607:f8b0:4864:20::f42 as permitted sender) smtp.mailfrom=gargabsd@gmail.com X-Spamd-Result: default: False [-3.08 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.88)[ipnet: 2607:f8b0::/32(-2.34), asn: 15169(-2.01), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 16:27:36 -0000 On 29/10/19 14:36, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Oct 29 17:36:06 2019 > New Revision: 354149 > URL: https://svnweb.freebsd.org/changeset/base/354149 > > Log: > There is a long standing problem with multicast programming for NICs > and IPv6. With IPv6 we may call if_addmulti() in context of processing > of an incoming packet. Usually this is interrupt context. While most > of the NIC drivers are able to reprogram multicast filters without > sleeping, some of them can't. An example is e1000 family of drivers. > With iflib conversion the problem was somewhat hidden. Iflib processes > packets in private taskqueue, so going to sleep doesn't trigger an > assertion. However, the sleep would block operation of the driver and > following incoming packets would fill the ring and eventually would > start being dropped. Enabling epoch for the full time of a packet > processing again started to trigger assertions for e1000. > > Fix this problem once and for all using a general taskqueue to call > if_ioctl() method in all cases when if_addmulti() is called in a > non sleeping context. Note that nobody cares about returned value. > > Reviewed by: hselasky, kib > Differential Revision: https://reviews.freebsd.org/D22154 Hi Gleb, I upgraded my laptop running 13-CURRENT from r354133 to r354437 and it crashed during boot as you can see in the pictures [1]. It seems like it crashed while it was configuring network. After bisect I managed to boot fine with r354148 and reproduce the crash with this revision applied. Here is the relevant portion of my /etc/rc.conf: # Lagg ifconfig_em0="up" wlans_iwn0="wlan0" ifconfig_wlan0="WPA" create_args_wlan0="wlanaddr 3c:97:0e:48:3f:f8 up" cloned_interfaces="lagg0" ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP" ifconfig_lagg0_ipv6="inet6 accept_rtadv" rtsold_enable="YES" [1] https://imgur.com/a/lBtq3FW -- Renato Botelho From owner-svn-src-all@freebsd.org Fri Nov 8 16:30:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D933A1B6FE5; Fri, 8 Nov 2019 16:30:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478m3h5Jgnz4ZHk; Fri, 8 Nov 2019 16:30:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99D79C43; Fri, 8 Nov 2019 16:30:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8GUuLA003770; Fri, 8 Nov 2019 16:30:56 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8GUuJT003769; Fri, 8 Nov 2019 16:30:56 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201911081630.xA8GUuJT003769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 8 Nov 2019 16:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354548 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 354548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 16:30:56 -0000 Author: vangyzen Date: Fri Nov 8 16:30:55 2019 New Revision: 354548 URL: https://svnweb.freebsd.org/changeset/base/354548 Log: vmm: pass M_WAITOK to uma_zalloc when allocating FPU save area Submitted by: patrick.sullivan3@dell.com Reviewed by: markj MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22276 Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Nov 8 16:10:45 2019 (r354547) +++ head/sys/amd64/amd64/fpu.c Fri Nov 8 16:30:55 2019 (r354548) @@ -1190,7 +1190,7 @@ struct savefpu * fpu_save_area_alloc(void) { - return (uma_zalloc(fpu_save_area_zone, 0)); + return (uma_zalloc(fpu_save_area_zone, M_WAITOK)); } void Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Nov 8 16:10:45 2019 (r354547) +++ head/sys/i386/i386/npx.c Fri Nov 8 16:30:55 2019 (r354548) @@ -1473,7 +1473,7 @@ union savefpu * fpu_save_area_alloc(void) { - return (uma_zalloc(fpu_save_area_zone, 0)); + return (uma_zalloc(fpu_save_area_zone, M_WAITOK)); } void From owner-svn-src-all@freebsd.org Fri Nov 8 16:56:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B35181B790A; Fri, 8 Nov 2019 16:56:49 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478mdY3VSxz4bwK; Fri, 8 Nov 2019 16:56:49 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A62C117C; Fri, 8 Nov 2019 16:56:49 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Gunt3019528; Fri, 8 Nov 2019 16:56:49 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8Gun2a019527; Fri, 8 Nov 2019 16:56:49 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911081656.xA8Gun2a019527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 8 Nov 2019 16:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354549 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 354549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 16:56:49 -0000 Author: manu Date: Fri Nov 8 16:56:48 2019 New Revision: 354549 URL: https://svnweb.freebsd.org/changeset/base/354549 Log: libpmc: Match on the cpuid with a regex The CPUID is, or can be, a regex to be matched. Use regex from libc instead of strcmp Tested-by: gallatin MFC after: 1 week Modified: head/lib/libpmc/libpmc_pmu_util.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Fri Nov 8 16:30:55 2019 (r354548) +++ head/lib/libpmc/libpmc_pmu_util.c Fri Nov 8 16:56:48 2019 (r354549) @@ -165,8 +165,11 @@ struct pmu_event_desc { static const struct pmu_events_map * pmu_events_map_get(const char *cpuid) { - size_t s; + regex_t re; + regmatch_t pmatch[1]; + size_t s, len; char buf[64]; + int match; const struct pmu_events_map *pme; if (cpuid != NULL) { @@ -179,9 +182,20 @@ pmu_events_map_get(const char *cpuid) (void *)NULL, 0) == -1) return (NULL); } - for (pme = pmu_events_map; pme->cpuid != NULL; pme++) - if (strcmp(buf, pme->cpuid) == 0) - return (pme); + for (pme = pmu_events_map; pme->cpuid != NULL; pme++) { + if (regcomp(&re, pme->cpuid, REG_EXTENDED) != 0) { + printf("regex '%s' failed to compile, ignoring\n", + pme->cpuid); + continue; + } + match = regexec(&re, buf, 1, pmatch, 0); + regfree(&re); + if (match == 0) { + len = pmatch[0].rm_eo - pmatch[0].rm_so; + if(len == strlen(buf)) + return (pme); + } + } return (NULL); } From owner-svn-src-all@freebsd.org Fri Nov 8 17:19:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E886E15842B; Fri, 8 Nov 2019 17:19:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478n7B6qkBz4dQX; Fri, 8 Nov 2019 17:19:02 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qk1-x743.google.com with SMTP id 205so5956356qkk.1; Fri, 08 Nov 2019 09:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:references:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BSTrmw7VH9q7Jg7WiXu3AmIiiDguXVDPkE651Z24XV4=; b=rsDE1rv2w7cpEiTF6BBKBaXrBqsgfPVekdk/zgBQZUgWNAXSAB9Q5OfWnJwqf9jpSd UI2+J9svf9u1fo3I75pK5ziG9yT9/f5PsVXsLXjgLPvAFUE1aSILDGKiYgvy4ZsY3GXw 3U19fFNibu8mwHROIfYz6C5oDas8tOhG7LNUjxvgBEEAG2CYRPEcia52T/MCZFuOC4P5 d+cXlKXGporYYDVrzkDXIOaZM2CdgN6G5wdYsiK2fnpZdH7d31zirrpEtiGmibuLP7ej nOSlWPJJYvT6ecP56BBhlNS8xub74MODBqMdKRLBjfcriXNq3F1CYVYpgVxpOKfMvCzj nJUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:references:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=BSTrmw7VH9q7Jg7WiXu3AmIiiDguXVDPkE651Z24XV4=; b=A/YxY5RsLFSFmBwsSWzIkXHTG+3KvNkO8SkaKGPUA4UcgdOs6/rAjD7MiXQlFfyh0K AvxnsZOXjyFFHPf8SuXym02dF0dEh1Q0U02RcCOxXrBE6HpTWZ0qK+0eRh6jswOSEnwT 4cX3ySv6ArX/QA8wTsR6+cQnmTyN4ZedvE4dRpFBvXE/BUrBEqf9Hn2er05cCtDB71sk CMgyoWLk6yiQKL7meR+O/RiWHcshVpJ0O2H8aEPNS6qdO51e3hwkKM4B/NlBnHjmRqau giEUcZQmAl8LEA3nbJG16MRpRTwXoWxmAjwN4FNQif3KsJiBXMvnmHIakaUvI0oETLUj OGYg== X-Gm-Message-State: APjAAAVSarGIPTaRvuyELuON8Q+OuBTtCqu/yuKx/C8P8lvR22d/wktD gDRyGLOgQ+ZImjXtZMX9opaV2ZHW X-Google-Smtp-Source: APXvYqw8c4rZIexgnA+kgejxJXTHoo1qrgbFqX+8w1D7FeHqNXqLiykQkyCw6LkWGP/Hq/NToAiz4Q== X-Received: by 2002:a37:4f0a:: with SMTP id d10mr10072902qkb.286.1573233541656; Fri, 08 Nov 2019 09:19:01 -0800 (PST) Received: from mbp.home ([2804:f1c:800:fc00:a4ea:5918:a7:f7cd]) by smtp.gmail.com with ESMTPSA id j18sm2766948qtn.52.2019.11.08.09.18.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2019 09:19:00 -0800 (PST) Sender: Renato Botelho Subject: Re: svn commit: r354149 - head/sys/net From: Renato Botelho To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910291736.x9THa6Gd018030@repo.freebsd.org> <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> Autocrypt: addr=garga@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFn4ZqUBCACxJRWi57JkmsCrSU0gZd/CwB+B90OTUeXmF63lDPETOQ+pBA4+vJgzjW1C pv7rR25wxvESJKphxZJOOk9AXTXsg5QrhdP3+KQG/zNcKd2ukbt3ezkhdMx8q81wn4wY2oTl WXdGIVdDKvC8sCp1fc6pPKJin71/skb9wg6ThtlRFlv9en4f8QSVmRuzRKQ6VjCbl+yIpiye /I5BQ4I99uouPzPhzf9ya3cvp4xbiw5wSo1F3nLsThBT2osYy/nRNz2ciuCYyyX87dGhio0T 8Pxl37eBbGQvCGwPQBApCcfoiZBN/5F65Tt4p72gIqT+AYuqq5G7Bhj+fGTC7q0QotL/ABEB AAG0LFJlbmF0byBCb3RlbGhvIChGcmVlQlNEKSA8Z2FyZ2FARnJlZUJTRC5vcmc+iQFXBBMB CgBBAhsDBQkFo5qABQsJCAcDBRUKCQgLBRYDAgEAAh4BAheAFiEExxiLNMqsn7yXmTy7W54E w5ZrhhoFAln4aeUCGQEACgkQW54Ew5ZrhhpTIwf+OS+Gv/ITOy7+8D+8SKXNmkfczsTO+Uqz 6SraXcq32j1C4QcRQCwGPhVJJgKnFSvPm3kbNPFXaQh1zD+mTQ4r/Loc78Rz+fZljYcgNx7n aQKhd9pdpXaELOe+Y10jvGUrT0SE06Y10BP/NmQaLplt9qG8VgLAAB9ZcsuZ9pzbBbQjd9In OK5VcXQzHT/EBBQ1rHsl1Aq8TYdmjbKl+HKc1c8dJ5OfXrgnTIUwQdN1rauXbmH/YW/CKN7z zF59v/sPBTaWfFl2CS/BORhWhe1PBudrVZWFT0oJGNuG6k8dlnssoL/0ojFaN5w5xm8mvMAf uAuixGf4bK6C7hcE34D/ULkBDQRZ+GalAQgApiTibUM0OpeCcxf5YUep4F4y853ClU4TMqZO +ho38sz0GdshQWuBEBqahOtxapHUMtlmC+wJNCBAav5JYjHHrXXE9pgRm5EgVssDpMvplLB4 5CFdx5jBu02Bt9Wp5bD21TPH3rsYJUB3rYmxWfVmdRhNBERrCJu49OIsBSKAlIinx8altYrh Z7bO2C1hKOG6QHWRr4ml4HTD/gZ6TTfsrR+sktBNv/5ZRkcJNDVM+eOGagXkEUOVFe9KXynD 3KcZBbBKpwoaW5GK8OglKJt8ggUfc78CG1xk4b5nL8QCk0CBrC6VPPOYvXTpYSTHmx1QkElm 1iNu1Tc5ccvcyAwTswARAQABiQE8BBgBCgAmFiEExxiLNMqsn7yXmTy7W54Ew5ZrhhoFAln4 ZqUCGwwFCQWjmoAACgkQW54Ew5ZrhhoH3wf+KuIeDyvIJOui+0C5FD5r44Bwkj/SAUVUerfp 0qtRktc+BZoSifPs3Rqjh/PpwRvLTuJnSsiqWLz8NCTThogRzVqEcQHqZR3vOjtYM60sjYJ+ BGQl/bjm1C/YtWEEmKs7mJc+02U8qJA4rbNKSRRRoz6XngnuN6YC0fkeD7c7rxRhOg6OWasZ JinB9+dO1IH7eZ5c97v518qSaLRp0T7I+FpEGOp7tTFHaepZWEnuojr5D6jI1MOEywy0EWJu 3m0TYlh935I8o7gLABqoHEmUeW7JK7r91SZaFnr8zQ6XOAxkPh50uFMTNtNZTnM7k1pRv5Ov fms0VzARITYzTwmpDQ== Message-ID: Date: Fri, 8 Nov 2019 14:18:57 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 478n7B6qkBz4dQX X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=rsDE1rv2; dmarc=none; spf=pass (mx1.freebsd.org: domain of gargabsd@gmail.com designates 2607:f8b0:4864:20::743 as permitted sender) smtp.mailfrom=gargabsd@gmail.com X-Spamd-Result: default: False [-2.52 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[garga@FreeBSD.org,gargabsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.33)[ip: (2.74), ipnet: 2607:f8b0::/32(-2.34), asn: 15169(-2.01), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; FORGED_SENDER(0.30)[garga@FreeBSD.org,gargabsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:19:04 -0000 On 08/11/19 13:27, Renato Botelho wrote: > On 29/10/19 14:36, Gleb Smirnoff wrote: >> Author: glebius >> Date: Tue Oct 29 17:36:06 2019 >> New Revision: 354149 >> URL: https://svnweb.freebsd.org/changeset/base/354149 >> >> Log: >> There is a long standing problem with multicast programming for NICs >> and IPv6. With IPv6 we may call if_addmulti() in context of processing >> of an incoming packet. Usually this is interrupt context. While most >> of the NIC drivers are able to reprogram multicast filters without >> sleeping, some of them can't. An example is e1000 family of drivers. >> With iflib conversion the problem was somewhat hidden. Iflib processes >> packets in private taskqueue, so going to sleep doesn't trigger an >> assertion. However, the sleep would block operation of the driver and >> following incoming packets would fill the ring and eventually would >> start being dropped. Enabling epoch for the full time of a packet >> processing again started to trigger assertions for e1000. >> >> Fix this problem once and for all using a general taskqueue to call >> if_ioctl() method in all cases when if_addmulti() is called in a >> non sleeping context. Note that nobody cares about returned value. >> >> Reviewed by: hselasky, kib >> Differential Revision: https://reviews.freebsd.org/D22154 > > Hi Gleb, > > I upgraded my laptop running 13-CURRENT from r354133 to r354437 and it > crashed during boot as you can see in the pictures [1]. It seems like > it crashed while it was configuring network. > > After bisect I managed to boot fine with r354148 and reproduce the crash > with this revision applied. > > Here is the relevant portion of my /etc/rc.conf: > > # Lagg > ifconfig_em0="up" > wlans_iwn0="wlan0" > ifconfig_wlan0="WPA" > create_args_wlan0="wlanaddr 3c:97:0e:48:3f:f8 up" > cloned_interfaces="lagg0" > ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP" > ifconfig_lagg0_ipv6="inet6 accept_rtadv" > rtsold_enable="YES" > > [1] https://imgur.com/a/lBtq3FW I forgot to mention. If I disable IPv6 on lagg interface the crash is gone. -- Renato Botelho From owner-svn-src-all@freebsd.org Fri Nov 8 17:27:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34BB715876A; Fri, 8 Nov 2019 17:27:21 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478nJn0KkTz4dvZ; Fri, 8 Nov 2019 17:27:21 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E28491747; Fri, 8 Nov 2019 17:27:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8HRKoK038979; Fri, 8 Nov 2019 17:27:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8HRK2J038978; Fri, 8 Nov 2019 17:27:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911081727.xA8HRK2J038978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 8 Nov 2019 17:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354550 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 354550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:27:21 -0000 Author: manu Date: Fri Nov 8 17:27:20 2019 New Revision: 354550 URL: https://svnweb.freebsd.org/changeset/base/354550 Log: libpmc: Forgot regex.h Reported by: ci MFC after: 1 week X-MFC-With: r354549 Modified: head/lib/libpmc/libpmc_pmu_util.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Fri Nov 8 16:56:48 2019 (r354549) +++ head/lib/libpmc/libpmc_pmu_util.c Fri Nov 8 17:27:20 2019 (r354550) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Fri Nov 8 17:33:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E23BD158B19; Fri, 8 Nov 2019 17:33:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478nRb5WByz4fSc; Fri, 8 Nov 2019 17:33:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.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 EC965EBF; Fri, 8 Nov 2019 17:33:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32 To: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911072258.xA7MwBkh050268@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 8 Nov 2019 09:33:13 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911072258.xA7MwBkh050268@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:33:15 -0000 On 11/7/19 2:58 PM, Brooks Davis wrote: > Author: brooks > Date: Thu Nov 7 22:58:10 2019 > New Revision: 354491 > URL: https://svnweb.freebsd.org/changeset/base/354491 > > Log: > libcompat: build 32-bit rtld and ldd as part of "everything" > > Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included > directly so MD paths in Makefiles work. In the process centralize > setting them in LIBCOMPATWMAKEENV. > > Alter .PATH and CFLAGS settings in work when the Makefile is included. > > While here only support LIB32 on supported platforms rather than always > enabling it and requiring users of MK_LIB32 to filter based > TARGET/MACHINE_ARCH. > > The net effect of this change is to make Makefile.libcompat only build > compatability libraries. > > Changes relative to r354449: > > Correct detection of the compiler type when bsd.compat.mk is used > outside Makefile.libcompat. Previously it always matched the clang > case. > > Set LDFLAGS including the linker emulation for mips where -m32 seems to > be insufficent. Hmm, so mips doesn't use -m32 at all (it doesn't work there), but mips should be setting -mabi=o32 which the compiler driver should use to pass the right linker emulation to ld. Only bare LD instances (which mostly don't exist anymore) should require the explicit emulation. That is what the old Makefile.libcompat was doing which worked fine. -- John Baldwin From owner-svn-src-all@freebsd.org Fri Nov 8 17:33:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 616EC158BD4; Fri, 8 Nov 2019 17:33:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478nS71vTVz4fcC; Fri, 8 Nov 2019 17:33:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 249ED1942; Fri, 8 Nov 2019 17:33:43 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8HXh2Q044802; Fri, 8 Nov 2019 17:33:43 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8HXh8B044801; Fri, 8 Nov 2019 17:33:43 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201911081733.xA8HXh8B044801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 8 Nov 2019 17:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354551 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:33:43 -0000 Author: gjb Date: Fri Nov 8 17:33:42 2019 New Revision: 354551 URL: https://svnweb.freebsd.org/changeset/base/354551 Log: Dereference lem(4), no longer in 13-CURRENT. While here, fix formatting of inline parenthesis and Xrs. Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: head/share/man/man4/netmap.4 Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Fri Nov 8 17:27:20 2019 (r354550) +++ head/share/man/man4/netmap.4 Fri Nov 8 17:33:42 2019 (r354551) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 26, 2019 +.Dd November 8, 2019 .Dt NETMAP 4 .Os .Sh NAME @@ -828,7 +828,7 @@ On .Xr cxgbe 4 , .Xr em 4 , .Xr iflib 4 -(providing igb, em and lem), +.Pq providing Xr igb 4 and Xr em 4 , .Xr ixgbe 4 , .Xr ixl 4 , .Xr re 4 , From owner-svn-src-all@freebsd.org Fri Nov 8 17:57:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 003501592FA; Fri, 8 Nov 2019 17:57:05 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478nz46CFzz3Bxh; Fri, 8 Nov 2019 17:57:04 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4DAD1D0D; Fri, 8 Nov 2019 17:57:04 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Hv4l6056494; Fri, 8 Nov 2019 17:57:04 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8Hv3j0056489; Fri, 8 Nov 2019 17:57:03 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911081757.xA8Hv3j0056489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 8 Nov 2019 17:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354552 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:57:05 -0000 Author: vmaffione Date: Fri Nov 8 17:57:03 2019 New Revision: 354552 URL: https://svnweb.freebsd.org/changeset/base/354552 Log: bhyve: add support for virtio-net mergeable rx buffers Mergeable rx buffers is a virtio-net feature that allows the hypervisor to use multiple RX descriptor chains to receive a single receive packet. Without this feature, a TSO-enabled guest is compelled to publish only 64K (or 32K) long chains, and each of these large buffers is consumed to receive a single packet, even a very short one. This is a waste of memory, as a RX queue has room for 256 chains, which means up to 16MB of buffer memory for each (single-queue) vtnet device. With the feature on, the guest can publish 2K long chains, and the hypervisor will merge them as needed. This change also enables the feature in the netmap backend, which supports virtio-net offloads. We plan to add support for the tap backend too. Note that differently from QEMU/KVM, here we implement one-copy receive, while QEMU uses two copies. Reviewed by: jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D21007 Modified: head/usr.sbin/bhyve/net_backends.c head/usr.sbin/bhyve/pci_virtio_console.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/virtio.c head/usr.sbin/bhyve/virtio.h Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Fri Nov 8 17:33:42 2019 (r354551) +++ head/usr.sbin/bhyve/net_backends.c Fri Nov 8 17:57:03 2019 (r354552) @@ -328,7 +328,8 @@ DATA_SET(net_backend_set, vmnet_backend); #define NETMAP_FEATURES (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_TSO4 | \ VIRTIO_NET_F_HOST_TSO6 | VIRTIO_NET_F_HOST_UFO | \ VIRTIO_NET_F_GUEST_CSUM | VIRTIO_NET_F_GUEST_TSO4 | \ - VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_UFO) + VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_UFO | \ + VIRTIO_NET_F_MRG_RXBUF) struct netmap_priv { char ifname[IFNAMSIZ]; Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Fri Nov 8 17:33:42 2019 (r354551) +++ head/usr.sbin/bhyve/pci_virtio_console.c Fri Nov 8 17:57:03 2019 (r354552) @@ -423,7 +423,7 @@ pci_vtcon_sock_rx(int fd __unused, enum ev_type t __un len = readv(sock->vss_conn_fd, &iov, n); if (len == 0 || (len < 0 && errno == EWOULDBLOCK)) { - vq_retchain(vq); + vq_retchains(vq, 1); vq_endchains(vq, 0); if (len == 0) goto close; Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Fri Nov 8 17:33:42 2019 (r354551) +++ head/usr.sbin/bhyve/pci_virtio_net.c Fri Nov 8 17:57:03 2019 (r354552) @@ -58,11 +58,14 @@ __FBSDID("$FreeBSD$"); #include "virtio.h" #include "net_utils.h" #include "net_backends.h" +#include "iov.h" #define VTNET_RINGSZ 1024 #define VTNET_MAXSEGS 256 +#define VTNET_MAX_PKT_LEN (65536 + 64) + #define VTNET_S_HOSTCAPS \ ( VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | \ VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC) @@ -170,59 +173,119 @@ pci_vtnet_reset(void *vsc) pthread_mutex_unlock(&sc->rx_mtx); } +struct virtio_mrg_rxbuf_info { + uint16_t idx; + uint16_t pad; + uint32_t len; +}; + static void pci_vtnet_rx(struct pci_vtnet_softc *sc) { + struct virtio_mrg_rxbuf_info info[VTNET_MAXSEGS]; struct iovec iov[VTNET_MAXSEGS + 1]; struct vqueue_info *vq; - int len, n; - uint16_t idx; + uint32_t cur_iov_bytes; + struct iovec *cur_iov; + uint16_t cur_iov_len; + uint32_t ulen; + int n_chains; + int len; vq = &sc->vsc_queues[VTNET_RXQ]; for (;;) { /* - * Check for available rx buffers. + * Get a descriptor chain to store the next ingress + * packet. In case of mergeable rx buffers, get as + * many chains as necessary in order to make room + * for a maximum sized LRO packet. */ - if (!vq_has_descs(vq)) { - /* No rx buffers. Enable RX kicks and double check. */ - vq_kick_enable(vq); - if (!vq_has_descs(vq)) { + cur_iov_bytes = 0; + cur_iov_len = 0; + cur_iov = iov; + n_chains = 0; + do { + int n = vq_getchain(vq, &info[n_chains].idx, cur_iov, + VTNET_MAXSEGS - cur_iov_len, NULL); + + if (n == 0) { /* - * Still no buffers. Interrupt if needed - * (including for NOTIFY_ON_EMPTY), and - * disable the backend until the next kick. + * No rx buffers. Enable RX kicks and double + * check. */ - vq_endchains(vq, /*used_all_avail=*/1); - netbe_rx_disable(sc->vsc_be); - return; + vq_kick_enable(vq); + if (!vq_has_descs(vq)) { + /* + * Still no buffers. Return the unused + * chains (if any), interrupt if needed + * (including for NOTIFY_ON_EMPTY), and + * disable the backend until the next + * kick. + */ + vq_retchains(vq, n_chains); + vq_endchains(vq, /*used_all_avail=*/1); + netbe_rx_disable(sc->vsc_be); + return; + } + + /* More rx buffers found, so keep going. */ + vq_kick_disable(vq); + continue; } + assert(n >= 1 && cur_iov_len + n <= VTNET_MAXSEGS); + cur_iov_len += n; + if (!sc->rx_merge) { + n_chains = 1; + break; + } + info[n_chains].len = (uint32_t)count_iov(cur_iov, n); + cur_iov_bytes += info[n_chains].len; + cur_iov += n; + n_chains++; + } while (cur_iov_bytes < VTNET_MAX_PKT_LEN && + cur_iov_len < VTNET_MAXSEGS); - /* More rx buffers found, so keep going. */ - vq_kick_disable(vq); - } + len = netbe_recv(sc->vsc_be, iov, cur_iov_len); - /* - * Get descriptor chain. - */ - n = vq_getchain(vq, &idx, iov, VTNET_MAXSEGS, NULL); - assert(n >= 1 && n <= VTNET_MAXSEGS); - - len = netbe_recv(sc->vsc_be, iov, n); - if (len <= 0) { /* * No more packets (len == 0), or backend errored * (err < 0). Return unused available buffers * and stop. */ - vq_retchain(vq); + vq_retchains(vq, n_chains); /* Interrupt if needed/appropriate and stop. */ vq_endchains(vq, /*used_all_avail=*/0); return; } - /* Publish the info to the guest */ - vq_relchain(vq, idx, (uint32_t)len); + ulen = (uint32_t)len; /* avoid too many casts below */ + + /* Publish the used buffers to the guest. */ + if (!sc->rx_merge) { + vq_relchain(vq, info[0].idx, ulen); + } else { + struct virtio_net_rxhdr *hdr = iov[0].iov_base; + uint32_t iolen; + int i = 0; + + assert(iov[0].iov_len >= sizeof(*hdr)); + + do { + iolen = info[i].len; + if (iolen > ulen) { + iolen = ulen; + } + vq_relchain_prepare(vq, info[i].idx, iolen); + ulen -= iolen; + i++; + assert(i <= n_chains); + } while (ulen > 0); + + hdr->vrh_bufs = i; + vq_relchain_publish(vq); + vq_retchains(vq, n_chains - i); + } } } Modified: head/usr.sbin/bhyve/virtio.c ============================================================================== --- head/usr.sbin/bhyve/virtio.c Fri Nov 8 17:33:42 2019 (r354551) +++ head/usr.sbin/bhyve/virtio.c Fri Nov 8 17:57:03 2019 (r354552) @@ -102,6 +102,7 @@ vi_reset_dev(struct virtio_softc *vs) for (vq = vs->vs_queues, i = 0; i < nvq; vq++, i++) { vq->vq_flags = 0; vq->vq_last_avail = 0; + vq->vq_next_used = 0; vq->vq_save_used = 0; vq->vq_pfn = 0; vq->vq_msix_idx = VIRTIO_MSI_NO_VECTOR; @@ -199,6 +200,7 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) /* Mark queue as allocated, and start at 0 when we use it. */ vq->vq_flags = VQ_ALLOC; vq->vq_last_avail = 0; + vq->vq_next_used = 0; vq->vq_save_used = 0; } @@ -279,7 +281,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * the guest has written are valid (including all their * vd_next fields and vd_flags). * - * Compute (last_avail - va_idx) in integers mod 2**16. This is + * Compute (va_idx - last_avail) in integers mod 2**16. This is * the number of descriptors the device has made available * since the last time we updated vq->vq_last_avail. * @@ -382,38 +384,30 @@ loopy: } /* - * Return the currently-first request chain back to the available queue. + * Return the first n_chain request chains back to the available queue. * - * (This chain is the one you handled when you called vq_getchain() + * (These chains are the ones you handled when you called vq_getchain() * and used its positive return value.) */ void -vq_retchain(struct vqueue_info *vq) +vq_retchains(struct vqueue_info *vq, uint16_t n_chains) { - vq->vq_last_avail--; + vq->vq_last_avail -= n_chains; } -/* - * Return specified request chain to the guest, setting its I/O length - * to the provided value. - * - * (This chain is the one you handled when you called vq_getchain() - * and used its positive return value.) - */ void -vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) +vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) { - uint16_t uidx, mask; volatile struct vring_used *vuh; volatile struct virtio_used *vue; + uint16_t mask; /* * Notes: * - mask is N-1 where N is a power of 2 so computes x % N * - vuh points to the "used" data shared with guest * - vue points to the "used" ring entry we want to update - * - head is the same value we compute in vq_iovecs(). * * (I apologize for the two fields named vu_idx; the * virtio spec calls the one that vue points to, "id"...) @@ -421,18 +415,35 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint mask = vq->vq_qsize - 1; vuh = vq->vq_used; - uidx = vuh->vu_idx; - vue = &vuh->vu_ring[uidx++ & mask]; + vue = &vuh->vu_ring[vq->vq_next_used++ & mask]; vue->vu_idx = idx; vue->vu_tlen = iolen; +} +void +vq_relchain_publish(struct vqueue_info *vq) +{ /* * Ensure the used descriptor is visible before updating the index. * This is necessary on ISAs with memory ordering less strict than x86 * (and even on x86 to act as a compiler barrier). */ atomic_thread_fence_rel(); - vuh->vu_idx = uidx; + vq->vq_used->vu_idx = vq->vq_next_used; +} + +/* + * Return specified request chain to the guest, setting its I/O length + * to the provided value. + * + * (This chain is the one you handled when you called vq_getchain() + * and used its positive return value.) + */ +void +vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) +{ + vq_relchain_prepare(vq, idx, iolen); + vq_relchain_publish(vq); } /* Modified: head/usr.sbin/bhyve/virtio.h ============================================================================== --- head/usr.sbin/bhyve/virtio.h Fri Nov 8 17:33:42 2019 (r354551) +++ head/usr.sbin/bhyve/virtio.h Fri Nov 8 17:57:03 2019 (r354552) @@ -392,6 +392,7 @@ struct vqueue_info { uint16_t vq_flags; /* flags (see above) */ uint16_t vq_last_avail; /* a recent value of vq_avail->va_idx */ + uint16_t vq_next_used; /* index of the next used slot to be filled */ uint16_t vq_save_used; /* saved vq_used->vu_idx; see vq_endchains */ uint16_t vq_msix_idx; /* MSI-X index, or VIRTIO_MSI_NO_VECTOR */ @@ -479,7 +480,10 @@ void vi_set_io_bar(struct virtio_softc *, int); int vq_getchain(struct vqueue_info *vq, uint16_t *pidx, struct iovec *iov, int n_iov, uint16_t *flags); -void vq_retchain(struct vqueue_info *vq); +void vq_retchains(struct vqueue_info *vq, uint16_t n_chains); +void vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, + uint32_t iolen); +void vq_relchain_publish(struct vqueue_info *vq); void vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen); void vq_endchains(struct vqueue_info *vq, int used_all_avail); From owner-svn-src-all@freebsd.org Fri Nov 8 18:26:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A4F915AC25; Fri, 8 Nov 2019 18:26:27 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 478pcz1d8Yz3F85; Fri, 8 Nov 2019 18:26:26 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xA8IQI5i021143; Fri, 8 Nov 2019 10:26:18 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xA8IQIUn021142; Fri, 8 Nov 2019 10:26:18 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201911081826.xA8IQIUn021142@gndrsh.dnsmgr.net> Subject: Re: svn commit: r350089 - head In-Reply-To: <20191108151541.GU5599@FreeBSD.org> To: Glen Barber Date: Fri, 8 Nov 2019 10:26:18 -0800 (PST) CC: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 478pcz1d8Yz3F85 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 18:26:27 -0000 > On Wed, Jul 17, 2019 at 07:09:06PM +0000, Mark Johnston wrote: > > Author: markj > > Date: Wed Jul 17 19:09:05 2019 > > New Revision: 350089 > > URL: https://svnweb.freebsd.org/changeset/base/350089 > > > > Log: > > Add an initial RELNOTES file. > > > > The intent is to provide a convenient location to document changes > > that are relevant to users of binary FreeBSD distributions, in contrast > > with UPDATING, which exists to document caveats for users who build > > FreeBSD from source. > > > > This complements the "Relnotes:" tag in commit messages by providing a > > place to document the change in more detail, or in case a "Relnotes:" > > tag was accidentally omitted. In particular, "Relnotes:" should be > > used if you do not intend to document the change in RELNOTES for some > > reason. > > > > Changes to the file should not be MFCed. For now the file will exist > > only in head, but may be updated via direct commits to stable branches > > depending on how things go. > > > > I had to go look at the original thread to remind myself about this, but > regarding not MFCing changes from head to stable branches, I think there > may have been some confusion in the discussion. > > By "changes should not be MFCed", at least based on my recollection of > how the conversation was going, I (at least) meant "not MFCed, but > committed as a direct commit to stable branches." In other words, > merging the RELNOTES change from head to stable/X does not really make > sense, as the revision numbers will have changed, and would inevitably > cause merge conflicts. > > Now that 12.1 is out, maybe we can expand the idea of this file into > stable/12 and even stable/11. One additional idea that came to mind is > with the formatting for stable branches. > > For example, in head, there is: > > rNNNNNN: > The foo(8) utility was added. > > For stable branches, I would propose the format of: > > rNNNNNM, MFC of rNNNNNN: > The foo(8) utility was added. > > Thoughts? My thoughs originally on this was that when a release noteable item is merged from head to stable the exact related commit to RELNOTES should also be merged unaltered. The RELNOTES file should state that revision numbers in this file are ^/HEAD revision numbers, and that a merge serach may be needed to find the branch verson of the MFC. The ^/head RELNOTES file should be trunkated to length 0 when a .0 branch is crated POST branch creation, thus all the relevant entries are in the file on the new branch and can grow as things are merged to it. Thus keeps the RELNOTES file in a state that matches the branch as far as entires, just the Rxxxxx is referential to when the entry was created relative to head. > Glen -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Nov 8 18:56:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B52EC15B8D0; Fri, 8 Nov 2019 18:56:04 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478qH84KvBz3GwB; Fri, 8 Nov 2019 18:56:04 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74C8227F2; Fri, 8 Nov 2019 18:56:04 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Iu4XS091890; Fri, 8 Nov 2019 18:56:04 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8Iu39F091885; Fri, 8 Nov 2019 18:56:03 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911081856.xA8Iu39F091885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 8 Nov 2019 18:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354553 - in head/tests/sys: netinet6 netpfil/common netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/tests/sys: netinet6 netpfil/common netpfil/pf X-SVN-Commit-Revision: 354553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 18:56:04 -0000 Author: lwhsu Date: Fri Nov 8 18:56:02 2019 New Revision: 354553 URL: https://svnweb.freebsd.org/changeset/base/354553 Log: Reenable netinet6 and netpfil tests on i386, net/scapy 2.4.3_2 contains the fix PR: 239380 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netinet6/exthdr.sh head/tests/sys/netinet6/scapyi386.sh head/tests/sys/netpfil/common/forward.sh head/tests/sys/netpfil/common/tos.sh head/tests/sys/netpfil/pf/forward.sh head/tests/sys/netpfil/pf/set_tos.sh Modified: head/tests/sys/netinet6/exthdr.sh ============================================================================== --- head/tests/sys/netinet6/exthdr.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netinet6/exthdr.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -38,11 +38,6 @@ exthdr_head() { exthdr_body() { - if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ]; then - atf_skip "https://bugs.freebsd.org/241493" - fi - ids=65533 id=`printf "%x" ${ids}` if [ $$ -gt 65535 ]; then Modified: head/tests/sys/netinet6/scapyi386.sh ============================================================================== --- head/tests/sys/netinet6/scapyi386.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netinet6/scapyi386.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -38,11 +38,6 @@ scapyi386_head() { scapyi386_body() { - if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ]; then - atf_skip "https://bugs.freebsd.org/239380" - fi - ids=65533 id=`printf "%x" ${ids}` if [ $$ -gt 65535 ]; then Modified: head/tests/sys/netpfil/common/forward.sh ============================================================================== --- head/tests/sys/netpfil/common/forward.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netpfil/common/forward.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -40,10 +40,6 @@ v4_head() v4_body() { firewall=$1 - if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ] && [ "${firewall}" = "pf" ]; then - atf_skip "https://bugs.freebsd.org/240085" - fi firewall_init $firewall epair_send=$(vnet_mkepair) Modified: head/tests/sys/netpfil/common/tos.sh ============================================================================== --- head/tests/sys/netpfil/common/tos.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netpfil/common/tos.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -40,10 +40,6 @@ tos_head() tos_body() { firewall=$1 - if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ] && [ "${firewall}" = "pf" ]; then - atf_skip "https://bugs.freebsd.org/240086" - fi firewall_init $firewall epair_send=$(vnet_mkepair) Modified: head/tests/sys/netpfil/pf/forward.sh ============================================================================== --- head/tests/sys/netpfil/pf/forward.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netpfil/pf/forward.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -41,10 +41,6 @@ v4_head() v4_body() { - if [ `uname -p` = "i386" ]; then - atf_skip "https://bugs.freebsd.org/239380" - fi - pft_init epair_send=$(vnet_mkepair) @@ -104,10 +100,6 @@ v6_head() v6_body() { - if [ `uname -p` = "i386" ]; then - atf_skip "https://bugs.freebsd.org/239380" - fi - pft_init epair_send=$(vnet_mkepair) Modified: head/tests/sys/netpfil/pf/set_tos.sh ============================================================================== --- head/tests/sys/netpfil/pf/set_tos.sh Fri Nov 8 17:57:03 2019 (r354552) +++ head/tests/sys/netpfil/pf/set_tos.sh Fri Nov 8 18:56:02 2019 (r354553) @@ -41,10 +41,6 @@ v4_head() v4_body() { - if [ `uname -p` = "i386" ]; then - atf_skip "https://bugs.freebsd.org/239380" - fi - pft_init epair_send=$(vnet_mkepair) From owner-svn-src-all@freebsd.org Fri Nov 8 18:57:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9C4F15BA24; Fri, 8 Nov 2019 18:57:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478qK241WQz3HBj; Fri, 8 Nov 2019 18:57:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52FD127FB; Fri, 8 Nov 2019 18:57:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Ivg7i092150; Fri, 8 Nov 2019 18:57:42 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8Ivf2J092145; Fri, 8 Nov 2019 18:57:41 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201911081857.xA8Ivf2J092145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 8 Nov 2019 18:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354554 - in head/sys: conf dev/extres/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: conf dev/extres/clk X-SVN-Commit-Revision: 354554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 18:57:42 -0000 Author: mmel Date: Fri Nov 8 18:57:41 2019 New Revision: 354554 URL: https://svnweb.freebsd.org/changeset/base/354554 Log: Implement support for (soft)linked clocks. This kind of clock nodes represent temporary placeholder for clocks defined later in boot process. Also, these are necessary to break circular dependencies occasionally occurring in complex clock graphs. MFC after: 3 weeks Added: head/sys/dev/extres/clk/clk_link.c (contents, props changed) head/sys/dev/extres/clk/clk_link.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/extres/clk/clk.c head/sys/dev/extres/clk/clk.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Nov 8 18:56:02 2019 (r354553) +++ head/sys/conf/files Fri Nov 8 18:57:41 2019 (r354554) @@ -1681,6 +1681,7 @@ dev/extres/clk/clk_bus.c optional ext_resources clk fd dev/extres/clk/clk_div.c optional ext_resources clk fdt dev/extres/clk/clk_fixed.c optional ext_resources clk fdt dev/extres/clk/clk_gate.c optional ext_resources clk fdt +dev/extres/clk/clk_link.c optional ext_resources clk fdt dev/extres/clk/clk_mux.c optional ext_resources clk fdt dev/extres/phy/phy.c optional ext_resources phy fdt dev/extres/phy/phydev_if.m optional ext_resources phy fdt Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Fri Nov 8 18:56:02 2019 (r354553) +++ head/sys/dev/extres/clk/clk.c Fri Nov 8 18:57:41 2019 (r354554) @@ -189,6 +189,9 @@ enum clknode_sysctl_type { static int clknode_sysctl(SYSCTL_HANDLER_ARGS); static int clkdom_sysctl(SYSCTL_HANDLER_ARGS); +static void clknode_finish(void *dummy); +SYSINIT(clknode_finish, SI_SUB_LAST, SI_ORDER_ANY, clknode_finish, NULL); + /* * Default clock methods for base class. */ @@ -526,20 +529,71 @@ clknode_create(struct clkdom * clkdom, clknode_class_t { struct clknode *clknode; struct sysctl_oid *clknode_oid; + bool replaced; KASSERT(def->name != NULL, ("clock name is NULL")); KASSERT(def->name[0] != '\0', ("clock name is empty")); -#ifdef INVARIANTS + if (def->flags & CLK_NODE_LINKED) { + KASSERT(def->parent_cnt == 0, + ("Linked clock must not have parents")); + KASSERT(clknode_class->size== 0, + ("Linked clock cannot have own softc")); + } + + /* Process duplicated clocks */ CLK_TOPO_SLOCK(); - if (clknode_find_by_name(def->name) != NULL) - panic("Duplicated clock registration: %s\n", def->name); + clknode = clknode_find_by_name(def->name); CLK_TOPO_UNLOCK(); -#endif + if (clknode != NULL) { + if (!(clknode->flags & CLK_NODE_LINKED) && + def->flags & CLK_NODE_LINKED) { + /* + * New clock is linked and real already exists. + * Do nothing and return real node. It is in right + * domain, enqueued in right lists and fully initialized. + */ + return (clknode); + } else if (clknode->flags & CLK_NODE_LINKED && + !(def->flags & CLK_NODE_LINKED)) { + /* + * New clock is real but linked already exists. + * Remove old linked node from originating domain + * (real clock must be owned by another) and from + * global names link (it will be added back into it + * again in following clknode_register()). Then reuse + * original clknode structure and reinitialize it + * with new dat. By this, all lists containing this + * node remains valid, but the new node virtually + * replace the linked one. + */ + KASSERT(clkdom != clknode->clkdom, + ("linked clock must be from another " + "domain that real one")); + TAILQ_REMOVE(&clkdom->clknode_list, clknode, + clkdom_link); + TAILQ_REMOVE(&clknode_list, clknode, clklist_link); + replaced = true; + } else if (clknode->flags & CLK_NODE_LINKED && + def->flags & CLK_NODE_LINKED) { + /* + * Both clocks are linked. + * Return old one, so we hold only one copy od link. + */ + return (clknode); + } else { + /* Both clocks are real */ + panic("Duplicated clock registration: %s\n", def->name); + } + } else { + /* Create clknode object and initialize it. */ + clknode = malloc(sizeof(struct clknode), M_CLOCK, + M_WAITOK | M_ZERO); + sx_init(&clknode->lock, "Clocknode lock"); + TAILQ_INIT(&clknode->children); + replaced = false; + } - /* Create object and initialize it. */ - clknode = malloc(sizeof(struct clknode), M_CLOCK, M_WAITOK | M_ZERO); kobj_init((kobj_t)clknode, (kobj_class_t)clknode_class); - sx_init(&clknode->lock, "Clocknode lock"); /* Allocate softc if required. */ if (clknode_class->size > 0) { @@ -568,8 +622,10 @@ clknode_create(struct clkdom * clkdom, clknode_class_t clknode->parent_cnt = def->parent_cnt; clknode->parent = NULL; clknode->parent_idx = CLKNODE_IDX_NONE; - TAILQ_INIT(&clknode->children); + if (replaced) + return (clknode); + sysctl_ctx_init(&clknode->sysctl_ctx); clknode_oid = SYSCTL_ADD_NODE(&clknode->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_hw_clock), @@ -617,6 +673,10 @@ clknode_register(struct clkdom * clkdom, struct clknod { int rv; + /* Skip already registered linked node */ + if (clknode->flags & CLK_NODE_REGISTERED) + return(clknode); + rv = CLKNODE_INIT(clknode, clknode_get_device(clknode)); if (rv != 0) { printf(" CLKNODE_INIT failed: %d\n", rv); @@ -624,10 +684,24 @@ clknode_register(struct clkdom * clkdom, struct clknod } TAILQ_INSERT_TAIL(&clkdom->clknode_list, clknode, clkdom_link); - + clknode->flags |= CLK_NODE_REGISTERED; return (clknode); } + +static void +clknode_finish(void *dummy) +{ + struct clknode *clknode; + + CLK_TOPO_SLOCK(); + TAILQ_FOREACH(clknode, &clknode_list, clklist_link) { + if (clknode->flags & CLK_NODE_LINKED) + printf("Unresolved linked clock found: %s\n", + clknode->name); + } + CLK_TOPO_UNLOCK(); +} /* * Clock providers interface. */ Modified: head/sys/dev/extres/clk/clk.h ============================================================================== --- head/sys/dev/extres/clk/clk.h Fri Nov 8 18:56:02 2019 (r354553) +++ head/sys/dev/extres/clk/clk.h Fri Nov 8 18:57:41 2019 (r354554) @@ -41,7 +41,9 @@ /* clknode flags. */ #define CLK_NODE_STATIC_STRINGS 0x00000001 /* Static name strings */ #define CLK_NODE_GLITCH_FREE 0x00000002 /* Freq can change w/o stop */ -#define CLK_NODE_CANNOT_STOP 0x00000004 /* Clock cannot be disabled */ +#define CLK_NODE_CANNOT_STOP 0x00000004 /* Cannot be disabled */ +#define CLK_NODE_LINKED 0x00000008 /* Is linked clock */ +#define CLK_NODE_REGISTERED 0x00000020 /* Is already registered */ /* Flags passed to clk_set_freq() and clknode_set_freq(). */ #define CLK_SET_ROUND(x) ((x) & (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN)) Added: head/sys/dev/extres/clk/clk_link.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/extres/clk/clk_link.c Fri Nov 8 18:57:41 2019 (r354554) @@ -0,0 +1,122 @@ +/*- + * Copyright 2016 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +static int clknode_link_init(struct clknode *clk, device_t dev); +static int clknode_link_recalc(struct clknode *clk, uint64_t *freq); +static int clknode_link_set_freq(struct clknode *clk, uint64_t fin, + uint64_t *fout, int flags, int *stop); +static int clknode_link_set_mux(struct clknode *clk, int idx); +static int clknode_link_set_gate(struct clknode *clk, bool enable); + +static clknode_method_t clknode_link_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, clknode_link_init), + CLKNODEMETHOD(clknode_recalc_freq, clknode_link_recalc), + CLKNODEMETHOD(clknode_set_freq, clknode_link_set_freq), + CLKNODEMETHOD(clknode_set_gate, clknode_link_set_gate), + CLKNODEMETHOD(clknode_set_mux, clknode_link_set_mux), + CLKNODEMETHOD_END +}; +DEFINE_CLASS_1(clknode_link, clknode_link_class, clknode_link_methods, + 0, clknode_class); + +static int +clknode_link_init(struct clknode *clk, device_t dev) +{ + return(0); +} + +static int +clknode_link_recalc(struct clknode *clk, uint64_t *freq) +{ + + printf("%s: Attempt to use unresolved linked clock: %s\n", __func__, + clknode_get_name(clk)); + return (EBADF); +} + +static int +clknode_link_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout, + int flags, int *stop) +{ + + printf("%s: Attempt to use unresolved linked clock: %s\n", __func__, + clknode_get_name(clk)); + return (EBADF); +} + +static int +clknode_link_set_mux(struct clknode *clk, int idx) +{ + + printf("%s: Attempt to use unresolved linked clock: %s\n", __func__, + clknode_get_name(clk)); + return (EBADF); +} + +static int +clknode_link_set_gate(struct clknode *clk, bool enable) +{ + + printf("%s: Attempt to use unresolved linked clock: %s\n", __func__, + clknode_get_name(clk)); + return (EBADF); +} + +int +clknode_link_register(struct clkdom *clkdom, struct clk_link_def *clkdef) +{ + struct clknode *clk; + struct clknode_init_def tmp; + + tmp = clkdef->clkdef; + tmp.flags |= CLK_NODE_LINKED; + clk = clknode_create(clkdom, &clknode_link_class, &tmp); + if (clk == NULL) + return (1); + clknode_register(clkdom, clk); + return (0); +} Added: head/sys/dev/extres/clk/clk_link.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/extres/clk/clk_link.h Fri Nov 8 18:57:41 2019 (r354554) @@ -0,0 +1,47 @@ +/*- + * Copyright 2016 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_EXTRES_CLK_LINK_H_ +#define _DEV_EXTRES_CLK_LINK_H_ + +#include + +/* + * A linked clock is used as placeholder for not yet available clock. + * It will be replaced by equally named clock from other domain, created + * in future stage of system initialization. +*/ + +struct clk_link_def { + struct clknode_init_def clkdef; + +}; + +int clknode_link_register(struct clkdom *clkdom, struct clk_link_def *clkdef); + +#endif /*_DEV_EXTRES_CLK_LINK_H_*/ From owner-svn-src-all@freebsd.org Fri Nov 8 19:03:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51EB715BD4C; Fri, 8 Nov 2019 19:03:36 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478qRr1Rbdz3HgJ; Fri, 8 Nov 2019 19:03:36 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14E4029BA; Fri, 8 Nov 2019 19:03:36 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8J3ZrF098060; Fri, 8 Nov 2019 19:03:35 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8J3Ypt098054; Fri, 8 Nov 2019 19:03:34 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201911081903.xA8J3Ypt098054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 8 Nov 2019 19:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354555 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 19:03:36 -0000 Author: mmel Date: Fri Nov 8 19:03:34 2019 New Revision: 354555 URL: https://svnweb.freebsd.org/changeset/base/354555 Log: Cleanup Rockchip clocks implementation. - style - unify dprinf defines - make dprinf's 32-bit compatible Not a functional change. MFC after: 3 weeks Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D22281 Modified: head/sys/arm64/rockchip/clk/rk_clk_armclk.c head/sys/arm64/rockchip/clk/rk_clk_composite.c head/sys/arm64/rockchip/clk/rk_clk_gate.c head/sys/arm64/rockchip/clk/rk_clk_mux.c head/sys/arm64/rockchip/clk/rk_clk_pll.c head/sys/arm64/rockchip/clk/rk_cru.c Modified: head/sys/arm64/rockchip/clk/rk_clk_armclk.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_armclk.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_clk_armclk.c Fri Nov 8 19:03:34 2019 (r354555) @@ -67,15 +67,19 @@ struct rk_clk_armclk_sc { CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) #define READ4(_clk, off, val) \ CLKDEV_READ_4(clknode_get_device(_clk), off, val) -#define DEVICE_LOCK(_clk) \ +#define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) #define RK_ARMCLK_WRITE_MASK_SHIFT 16 -/* #define dprintf(format, arg...) printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) */ +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else #define dprintf(format, arg...) +#endif static int rk_clk_armclk_init(struct clknode *clk, device_t dev) @@ -132,7 +136,7 @@ rk_clk_armclk_recalc(struct clknode *clk, uint64_t *fr DEVICE_UNLOCK(clk); div = ((reg & sc->div_mask) >> sc->div_shift) + 1; - dprintf("parent_freq=%lu, div=%u\n", *freq, div); + dprintf("parent_freq=%ju, div=%u\n", *freq, div); *freq = *freq / div; @@ -152,7 +156,7 @@ rk_clk_armclk_set_freq(struct clknode *clk, uint64_t f sc = clknode_get_softc(clk); - dprintf("Finding best parent/div for target freq of %lu\n", *fout); + dprintf("Finding best parent/div for target freq of %ju\n", *fout); p_names = clknode_get_parent_names(clk); p_main = clknode_find_by_name(p_names[sc->main_parent]); @@ -162,7 +166,7 @@ rk_clk_armclk_set_freq(struct clknode *clk, uint64_t f div = sc->rates[i].div; best_p = best * div; rate = i; - dprintf("Best parent %s (%d) with best freq at %lu\n", + dprintf("Best parent %s (%d) with best freq at %ju\n", clknode_get_name(p_main), sc->main_parent, best); @@ -179,17 +183,18 @@ rk_clk_armclk_set_freq(struct clknode *clk, uint64_t f return (0); } - dprintf("Changing parent (%s) freq to %lu\n", clknode_get_name(p_main), best_p); + dprintf("Changing parent (%s) freq to %ju\n", clknode_get_name(p_main), + best_p); err = clknode_set_freq(p_main, best_p, 0, 1); if (err != 0) - printf("Cannot set %s to %lu\n", + printf("Cannot set %s to %ju\n", clknode_get_name(p_main), best_p); clknode_set_parent_by_idx(clk, sc->main_parent); clknode_get_freq(p_main, &best_p); - dprintf("main parent freq at %lu\n", best_p); + dprintf("main parent freq at %ju\n", best_p); DEVICE_LOCK(clk); val |= (div - 1) << sc->div_shift; val |= sc->div_mask << RK_ARMCLK_WRITE_MASK_SHIFT; Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Nov 8 19:03:34 2019 (r354555) @@ -61,15 +61,19 @@ struct rk_clk_composite_sc { CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) #define READ4(_clk, off, val) \ CLKDEV_READ_4(clknode_get_device(_clk), off, val) -#define DEVICE_LOCK(_clk) \ +#define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) #define RK_CLK_COMPOSITE_MASK_SHIFT 16 -/* #define dprintf(format, arg...) printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) */ +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else #define dprintf(format, arg...) +#endif static int rk_clk_composite_init(struct clknode *clk, device_t dev) @@ -158,6 +162,7 @@ rk_clk_composite_recalc(struct clknode *clk, uint64_t dprintf("parent_freq=%lu, div=%u\n", *freq, div); *freq = *freq / div; + dprintf("Final freq=%ju\n", *freq); return (0); } @@ -194,20 +199,22 @@ rk_clk_composite_set_freq(struct clknode *clk, uint64_ sc = clknode_get_softc(clk); - dprintf("Finding best parent/div for target freq of %lu\n", *fout); + dprintf("Finding best parent/div for target freq of %ju\n", *fout); p_names = clknode_get_parent_names(clk); for (best_div = 0, best = 0, p_idx = 0; p_idx != clknode_get_parents_num(clk); p_idx++) { p_clk = clknode_find_by_name(p_names[p_idx]); clknode_get_freq(p_clk, &fparent); - dprintf("Testing with parent %s (%d) at freq %lu\n", clknode_get_name(p_clk), p_idx, fparent); + dprintf("Testing with parent %s (%d) at freq %ju\n", + clknode_get_name(p_clk), p_idx, fparent); div = rk_clk_composite_find_best(sc, fparent, *fout); cur = fparent / div; if ((*fout - cur) < (*fout - best)) { best = cur; best_div = div; best_parent = p_idx; - dprintf("Best parent so far %s (%d) with best freq at %lu\n", clknode_get_name(p_clk), p_idx, best); + dprintf("Best parent so far %s (%d) with best freq at " + "%ju\n", clknode_get_name(p_clk), p_idx, best); } } @@ -233,7 +240,8 @@ rk_clk_composite_set_freq(struct clknode *clk, uint64_ p_idx = clknode_get_parent_idx(clk); if (p_idx != best_parent) { - dprintf("Switching parent index from %d to %d\n", p_idx, best_parent); + dprintf("Switching parent index from %d to %d\n", p_idx, + best_parent); clknode_set_parent_by_idx(clk, best_parent); } @@ -266,7 +274,8 @@ DEFINE_CLASS_1(rk_clk_composite_clknode, rk_clk_compos clknode_class); int -rk_clk_composite_register(struct clkdom *clkdom, struct rk_clk_composite_def *clkdef) +rk_clk_composite_register(struct clkdom *clkdom, + struct rk_clk_composite_def *clkdef) { struct clknode *clk; struct rk_clk_composite_sc *sc; Modified: head/sys/arm64/rockchip/clk/rk_clk_gate.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_gate.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_clk_gate.c Fri Nov 8 19:03:34 2019 (r354555) @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); CLKDEV_READ_4(clknode_get_device(_clk), off, val) #define MD4(_clk, off, clr, set ) \ CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set) -#define DEVICE_LOCK(_clk) \ +#define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) Modified: head/sys/arm64/rockchip/clk/rk_clk_mux.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_mux.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_clk_mux.c Fri Nov 8 19:03:34 2019 (r354555) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); CLKDEV_READ_4(clknode_get_device(_clk), off, val) #define MD4(_clk, off, clr, set ) \ CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set) -#define DEVICE_LOCK(_clk) \ +#define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_pll.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_clk_pll.c Fri Nov 8 19:03:34 2019 (r354555) @@ -58,19 +58,23 @@ struct rk_clk_pll_sc { bool normal_mode; }; -#define WRITE4(_clk, off, val) \ +#define WRITE4(_clk, off, val) \ CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) -#define READ4(_clk, off, val) \ +#define READ4(_clk, off, val) \ CLKDEV_READ_4(clknode_get_device(_clk), off, val) -#define DEVICE_LOCK(_clk) \ +#define DEVICE_LOCK(_clk) \ CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) -#define DEVICE_UNLOCK(_clk) \ +#define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) #define RK_CLK_PLL_MASK_SHIFT 16 -/* #define dprintf(format, arg...) printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) */ +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else #define dprintf(format, arg...) +#endif static int rk_clk_pll_set_gate(struct clknode *clk, bool enable) @@ -397,13 +401,18 @@ rk3399_clk_pll_recalc(struct clknode *clk, uint64_t *f dprintf("con2: %x\n", con3); dprintf("con3: %x\n", con4); - fbdiv = (con1 & RK3399_CLK_PLL_FBDIV_MASK) >> RK3399_CLK_PLL_FBDIV_SHIFT; + fbdiv = (con1 & RK3399_CLK_PLL_FBDIV_MASK) + >> RK3399_CLK_PLL_FBDIV_SHIFT; - postdiv1 = (con2 & RK3399_CLK_PLL_POSTDIV1_MASK) >> RK3399_CLK_PLL_POSTDIV1_SHIFT; - postdiv2 = (con2 & RK3399_CLK_PLL_POSTDIV2_MASK) >> RK3399_CLK_PLL_POSTDIV2_SHIFT; - refdiv = (con2 & RK3399_CLK_PLL_REFDIV_MASK) >> RK3399_CLK_PLL_REFDIV_SHIFT; + postdiv1 = (con2 & RK3399_CLK_PLL_POSTDIV1_MASK) + >> RK3399_CLK_PLL_POSTDIV1_SHIFT; + postdiv2 = (con2 & RK3399_CLK_PLL_POSTDIV2_MASK) + >> RK3399_CLK_PLL_POSTDIV2_SHIFT; + refdiv = (con2 & RK3399_CLK_PLL_REFDIV_MASK) + >> RK3399_CLK_PLL_REFDIV_SHIFT; - fracdiv = (con3 & RK3399_CLK_PLL_FRAC_MASK) >> RK3399_CLK_PLL_FRAC_SHIFT; + fracdiv = (con3 & RK3399_CLK_PLL_FRAC_MASK) + >> RK3399_CLK_PLL_FRAC_SHIFT; fracdiv >>= 24; dsmpd = (con4 & RK3399_CLK_PLL_DSMPD_MASK) >> RK3399_CLK_PLL_DSMPD_SHIFT; @@ -415,7 +424,7 @@ rk3399_clk_pll_recalc(struct clknode *clk, uint64_t *f dprintf("fracdiv: %d\n", fracdiv); dprintf("dsmpd: %d\n", dsmpd); - dprintf("parent freq=%lu\n", *freq); + dprintf("parent freq=%ju\n", *freq); if (dsmpd == 0) { /* Fractional mode */ @@ -424,10 +433,10 @@ rk3399_clk_pll_recalc(struct clknode *clk, uint64_t *f /* Integer mode */ foutvco = *freq / refdiv * fbdiv; } - dprintf("foutvco: %lu\n", foutvco); + dprintf("foutvco: %ju\n", foutvco); *freq = foutvco / postdiv1 / postdiv2; - dprintf("freq: %lu\n", *freq); + dprintf("freq: %ju\n", *freq); return (0); } Modified: head/sys/arm64/rockchip/clk/rk_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_cru.c Fri Nov 8 18:57:41 2019 (r354554) +++ head/sys/arm64/rockchip/clk/rk_cru.c Fri Nov 8 19:03:34 2019 (r354555) @@ -233,10 +233,12 @@ rk_cru_attach(device_t dev) case RK_CLK_UNDEFINED: break; case RK3328_CLK_PLL: - rk3328_clk_pll_register(sc->clkdom, sc->clks[i].clk.pll); + rk3328_clk_pll_register(sc->clkdom, + sc->clks[i].clk.pll); break; case RK3399_CLK_PLL: - rk3399_clk_pll_register(sc->clkdom, sc->clks[i].clk.pll); + rk3399_clk_pll_register(sc->clkdom, + sc->clks[i].clk.pll); break; case RK_CLK_COMPOSITE: rk_clk_composite_register(sc->clkdom, @@ -246,7 +248,8 @@ rk_cru_attach(device_t dev) rk_clk_mux_register(sc->clkdom, sc->clks[i].clk.mux); break; case RK_CLK_ARMCLK: - rk_clk_armclk_register(sc->clkdom, sc->clks[i].clk.armclk); + rk_clk_armclk_register(sc->clkdom, + sc->clks[i].clk.armclk); break; default: device_printf(dev, "Unknown clock type\n"); From owner-svn-src-all@freebsd.org Fri Nov 8 19:13:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57C3515C169; Fri, 8 Nov 2019 19:13:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478qfx1d2Pz3JTk; Fri, 8 Nov 2019 19:13:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00AFC2BA0; Fri, 8 Nov 2019 19:13:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8JDCff004004; Fri, 8 Nov 2019 19:13:12 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8JDC8L003999; Fri, 8 Nov 2019 19:13:12 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201911081913.xA8JDC8L003999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 8 Nov 2019 19:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354556 - in head/sys: arm64/rockchip/clk conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm64/rockchip/clk conf X-SVN-Commit-Revision: 354556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 19:13:13 -0000 Author: mmel Date: Fri Nov 8 19:13:11 2019 New Revision: 354556 URL: https://svnweb.freebsd.org/changeset/base/354556 Log: Enhance Rockchip clocks implementation. - add support for fractional dividers - allow to declare fixed and linked clock MFC after: 3 weeks Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D22282 Added: head/sys/arm64/rockchip/clk/rk_clk_fract.c (contents, props changed) head/sys/arm64/rockchip/clk/rk_clk_fract.h (contents, props changed) Modified: head/sys/arm64/rockchip/clk/rk_cru.c head/sys/arm64/rockchip/clk/rk_cru.h head/sys/conf/files.arm64 Added: head/sys/arm64/rockchip/clk/rk_clk_fract.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/clk/rk_clk_fract.c Fri Nov 8 19:13:11 2019 (r354556) @@ -0,0 +1,249 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +#include "clkdev_if.h" + +#define WR4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define RD4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define MD4(_clk, off, clr, set ) \ + CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +static int rk_clk_fract_init(struct clknode *clk, device_t dev); +static int rk_clk_fract_recalc(struct clknode *clk, uint64_t *req); +static int rk_clk_fract_set_freq(struct clknode *clknode, uint64_t fin, + uint64_t *fout, int flag, int *stop); + +struct rk_clk_fract_sc { + uint32_t flags; + uint32_t offset; + uint32_t numerator; + uint32_t denominator; +}; + +static clknode_method_t rk_clk_fract_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, rk_clk_fract_init), + CLKNODEMETHOD(clknode_recalc_freq, rk_clk_fract_recalc), + CLKNODEMETHOD(clknode_set_freq, rk_clk_fract_set_freq), + CLKNODEMETHOD_END +}; +DEFINE_CLASS_1(rk_clk_fract, rk_clk_fract_class, rk_clk_fract_methods, + sizeof(struct rk_clk_fract_sc), clknode_class); + + +/* + * Compute best rational approximation of input fraction + * for fixed sized fractional divider registers. + * http://en.wikipedia.org/wiki/Continued_fraction + * + * - n_input, d_input Given input fraction + * - n_max, d_max Maximum vaues of divider registers + * - n_out, d_out Computed approximation + */ + +static void +clk_compute_fract_div( + uint64_t n_input, uint64_t d_input, + uint64_t n_max, uint64_t d_max, + uint64_t *n_out, uint64_t *d_out) +{ + uint64_t n_prev, d_prev; /* previous convergents */ + uint64_t n_cur, d_cur; /* current convergents */ + uint64_t n_rem, d_rem; /* fraction remainder */ + uint64_t tmp, fact; + + /* Initialize fraction reminder */ + n_rem = n_input; + d_rem = d_input; + + /* Init convergents to 0/1 and 1/0 */ + n_prev = 0; + d_prev = 1; + n_cur = 1; + d_cur = 0; + + while (d_rem != 0 && n_cur < n_max && d_cur < d_max) { + /* Factor for this step. */ + fact = n_rem / d_rem; + + /* Adjust fraction reminder */ + tmp = d_rem; + d_rem = n_rem % d_rem; + n_rem = tmp; + + /* Compute new nominator and save last one */ + tmp = n_prev + fact * n_cur; + n_prev = n_cur; + n_cur = tmp; + + /* Compute new denominator and save last one */ + tmp = d_prev + fact * d_cur; + d_prev = d_cur; + d_cur = tmp; + } + + if (n_cur > n_max || d_cur > d_max) { + *n_out = n_prev; + *d_out = d_prev; + } else { + *n_out = n_cur; + *d_out = d_cur; + } +} + +static int +rk_clk_fract_init(struct clknode *clk, device_t dev) +{ + uint32_t reg; + struct rk_clk_fract_sc *sc; + + sc = clknode_get_softc(clk); + DEVICE_LOCK(clk); + RD4(clk, sc->offset, ®); + DEVICE_UNLOCK(clk); + + sc->numerator = (reg >> 16) & 0xFFFF; + sc->denominator = reg & 0xFFFF; + clknode_init_parent_idx(clk, 0); + + return(0); +} +static int +rk_clk_fract_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout, + int flags, int *stop); +static int +rk_clk_fract_recalc(struct clknode *clk, uint64_t *freq) +{ + struct rk_clk_fract_sc *sc; + + sc = clknode_get_softc(clk); + if (sc->denominator == 0) { + printf("%s: %s denominator is zero!\n", clknode_get_name(clk), + __func__); + *freq = 0; + return(EINVAL); + } + + *freq *= sc->numerator; + *freq /= sc->denominator; + + return (0); +} + +static int +rk_clk_fract_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout, + int flags, int *stop) +{ + struct rk_clk_fract_sc *sc; + uint64_t div_n, div_d, _fout; + + sc = clknode_get_softc(clk); + + clk_compute_fract_div(*fout, fin, 0xFFFF, 0xFFFF, &div_n, &div_d); + _fout = fin * div_n; + _fout /= div_d; + + /* Rounding. */ + if ((flags & CLK_SET_ROUND_UP) && (_fout < *fout)) { + if (div_n > div_d && div_d > 1) + div_n++; + else + div_d--; + } else if ((flags & CLK_SET_ROUND_DOWN) && (_fout > *fout)) { + if (div_n > div_d && div_n > 1) + div_n--; + else + div_d++; + } + + /* Check range after rounding */ + if (div_n > 0xFFFF || div_d > 0xFFFF) + return (ERANGE); + + if (div_d == 0) { + printf("%s: %s divider is zero!\n", + clknode_get_name(clk), __func__); + return(EINVAL); + } + /* Recompute final output frequency */ + _fout = fin * div_n; + _fout /= div_d; + + *stop = 1; + + if ((flags & CLK_SET_DRYRUN) == 0) { + if (*stop != 0 && + (flags & (CLK_SET_ROUND_UP | CLK_SET_ROUND_DOWN)) == 0 && + *fout != _fout) + return (ERANGE); + + sc->numerator = (uint32_t)div_n; + sc->denominator = (uint32_t)div_d; + + DEVICE_LOCK(clk); + WR4(clk, sc->offset, sc->numerator << 16 | sc->denominator); + DEVICE_UNLOCK(clk); + } + + *fout = _fout; + return (0); +} + +int +rk_clk_fract_register(struct clkdom *clkdom, struct rk_clk_fract_def *clkdef) +{ + struct clknode *clk; + struct rk_clk_fract_sc *sc; + + clk = clknode_create(clkdom, &rk_clk_fract_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + sc->flags = clkdef->flags; + sc->offset = clkdef->offset; + + clknode_register(clkdom, clk); + return (0); +} Added: head/sys/arm64/rockchip/clk/rk_clk_fract.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/clk/rk_clk_fract.h Fri Nov 8 19:13:11 2019 (r354556) @@ -0,0 +1,44 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _RK_CLK_FRACT_H_ +#define _RK_CLK_FRACT_H_ + +#include + +struct rk_clk_fract_def { + struct clknode_init_def clkdef; + uint32_t offset; + uint32_t flags; +}; + +int rk_clk_fract_register(struct clkdom *clkdom, + struct rk_clk_fract_def *clkdef); + +#endif /* _RK_CLK_FRACT_H_ */ Modified: head/sys/arm64/rockchip/clk/rk_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_cru.c Fri Nov 8 19:03:34 2019 (r354555) +++ head/sys/arm64/rockchip/clk/rk_cru.c Fri Nov 8 19:13:11 2019 (r354556) @@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -251,12 +253,24 @@ rk_cru_attach(device_t dev) rk_clk_armclk_register(sc->clkdom, sc->clks[i].clk.armclk); break; + case RK_CLK_FIXED: + clknode_fixed_register(sc->clkdom, + sc->clks[i].clk.fixed); + break; + case RK_CLK_FRACT: + rk_clk_fract_register(sc->clkdom, + sc->clks[i].clk.fract); + break; + case RK_CLK_LINK: + clknode_link_register(sc->clkdom, + sc->clks[i].clk.link); + break; default: device_printf(dev, "Unknown clock type\n"); return (ENXIO); - break; } } + if (sc->gates) rk_cru_register_gates(sc); Modified: head/sys/arm64/rockchip/clk/rk_cru.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_cru.h Fri Nov 8 19:03:34 2019 (r354555) +++ head/sys/arm64/rockchip/clk/rk_cru.h Fri Nov 8 19:13:11 2019 (r354556) @@ -31,8 +31,15 @@ #ifndef __RK_CRU_H__ #define __RK_CRU_H__ +#include +#include +#include +#include +#include + #include #include +#include #include #include #include @@ -59,8 +66,11 @@ enum rk_clk_type { RK3328_CLK_PLL, RK3399_CLK_PLL, RK_CLK_COMPOSITE, + RK_CLK_FIXED, + RK_CLK_FRACT, RK_CLK_MUX, RK_CLK_ARMCLK, + RK_CLK_LINK, }; struct rk_clk { @@ -70,6 +80,9 @@ struct rk_clk { struct rk_clk_composite_def *composite; struct rk_clk_mux_def *mux; struct rk_clk_armclk_def *armclk; + struct clk_fixed_def *fixed; + struct rk_clk_fract_def *fract; + struct clk_link_def *link; } clk; }; Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Nov 8 19:03:34 2019 (r354555) +++ head/sys/conf/files.arm64 Fri Nov 8 19:13:11 2019 (r354556) @@ -309,6 +309,7 @@ dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip arm64/rockchip/clk/rk_cru.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk_clk_armclk.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk_clk_composite.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 +arm64/rockchip/clk/rk_clk_fract.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk_clk_gate.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk_clk_mux.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/clk/rk_clk_pll.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 From owner-svn-src-all@freebsd.org Fri Nov 8 19:15:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67C7F15C33C; Fri, 8 Nov 2019 19:15:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478qjz2373z3JmB; Fri, 8 Nov 2019 19:15:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A82F2BB7; Fri, 8 Nov 2019 19:15:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8JFpT6004175; Fri, 8 Nov 2019 19:15:51 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8JFokc004173; Fri, 8 Nov 2019 19:15:50 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201911081915.xA8JFokc004173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 8 Nov 2019 19:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354557 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 19:15:51 -0000 Author: mmel Date: Fri Nov 8 19:15:50 2019 New Revision: 354557 URL: https://svnweb.freebsd.org/changeset/base/354557 Log: Tidy up Rockchip composite clock. - add support for log2 based dividers - use proper write mask when writing to divider register MFC after: 3 weeks Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D22283 Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c head/sys/arm64/rockchip/clk/rk_clk_composite.h Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Nov 8 19:13:11 2019 (r354556) +++ head/sys/arm64/rockchip/clk/rk_clk_composite.c Fri Nov 8 19:15:50 2019 (r354557) @@ -158,31 +158,44 @@ rk_clk_composite_recalc(struct clknode *clk, uint64_t DEVICE_UNLOCK(clk); - div = ((reg & sc->div_mask) >> sc->div_shift) + 1; - dprintf("parent_freq=%lu, div=%u\n", *freq, div); + div = ((reg & sc->div_mask) >> sc->div_shift); + if (sc->flags & RK_CLK_COMPOSITE_DIV_EXP) + div = 1 << div; + else + div += 1; + dprintf("parent_freq=%ju, div=%u\n", *freq, div); *freq = *freq / div; - dprintf("Final freq=%ju\n", *freq); return (0); } static uint32_t rk_clk_composite_find_best(struct rk_clk_composite_sc *sc, uint64_t fparent, - uint64_t freq) + uint64_t freq, uint32_t *reg) { uint64_t best, cur; - uint32_t best_div, div; + uint32_t best_div, best_div_reg; + uint32_t div, div_reg; - for (best = 0, best_div = 0, div = 0; - div <= ((sc->div_mask >> sc->div_shift) + 1); div++) { + best = 0; + best_div = 0; + best_div_reg = 0; + + for (div_reg = 0; div_reg <= ((sc->div_mask >> sc->div_shift) + 1); + div_reg++) { + if (sc->flags == RK_CLK_COMPOSITE_DIV_EXP) + div = 1 << div_reg; + else + div = div_reg + 1; cur = fparent / div; if ((freq - cur) < (freq - best)) { best = cur; best_div = div; + best_div_reg = div_reg; break; } } - + *reg = div_reg; return (best_div); } @@ -194,11 +207,10 @@ rk_clk_composite_set_freq(struct clknode *clk, uint64_ struct clknode *p_clk; const char **p_names; uint64_t best, cur; - uint32_t div, best_div, val = 0; + uint32_t div, div_reg, best_div, best_div_reg, val; int p_idx, best_parent; sc = clknode_get_softc(clk); - dprintf("Finding best parent/div for target freq of %ju\n", *fout); p_names = clknode_get_parent_names(clk); for (best_div = 0, best = 0, p_idx = 0; @@ -207,34 +219,31 @@ rk_clk_composite_set_freq(struct clknode *clk, uint64_ clknode_get_freq(p_clk, &fparent); dprintf("Testing with parent %s (%d) at freq %ju\n", clknode_get_name(p_clk), p_idx, fparent); - div = rk_clk_composite_find_best(sc, fparent, *fout); + div = rk_clk_composite_find_best(sc, fparent, *fout, &div_reg); cur = fparent / div; if ((*fout - cur) < (*fout - best)) { best = cur; best_div = div; + best_div_reg = div_reg; best_parent = p_idx; dprintf("Best parent so far %s (%d) with best freq at " "%ju\n", clknode_get_name(p_clk), p_idx, best); } } + *stop = 1; if (best_div == 0) - return (0); + return (ERANGE); - if ((best < *fout) && - ((flags & CLK_SET_ROUND_DOWN) == 0)) { - *stop = 1; + if ((best < *fout) && ((flags & CLK_SET_ROUND_DOWN) == 0)) return (ERANGE); - } - if ((best > *fout) && - ((flags & CLK_SET_ROUND_UP) == 0)) { - *stop = 1; + + if ((best > *fout) && ((flags & CLK_SET_ROUND_UP) == 0)) { return (ERANGE); } if ((flags & CLK_SET_DRYRUN) != 0) { *fout = best; - *stop = 1; return (0); } @@ -245,17 +254,18 @@ rk_clk_composite_set_freq(struct clknode *clk, uint64_ clknode_set_parent_by_idx(clk, best_parent); } - dprintf("Setting divider to %d\n", best_div); + dprintf("Setting divider to %d (reg: %d)\n", best_div, best_div_reg); + dprintf(" div_mask: 0x%X, div_shift: %d\n", sc->div_mask, + sc->div_shift); + DEVICE_LOCK(clk); - val |= (best_div - 1) << sc->div_shift; - val |= (sc->div_mask << sc->div_shift) << RK_CLK_COMPOSITE_MASK_SHIFT; + val = best_div_reg << sc->div_shift; + val |= sc->div_mask << RK_CLK_COMPOSITE_MASK_SHIFT; dprintf("Write: muxdiv_offset=%x, val=%x\n", sc->muxdiv_offset, val); WRITE4(clk, sc->muxdiv_offset, val); DEVICE_UNLOCK(clk); *fout = best; - *stop = 1; - return (0); } Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_composite.h Fri Nov 8 19:13:11 2019 (r354556) +++ head/sys/arm64/rockchip/clk/rk_clk_composite.h Fri Nov 8 19:15:50 2019 (r354557) @@ -52,7 +52,8 @@ struct rk_clk_composite_def { #define RK_CLK_COMPOSITE_HAVE_MUX 0x0001 #define RK_CLK_COMPOSITE_HAVE_GATE 0x0002 - +#define RK_CLK_COMPOSITE_DIV_EXP 0x0004 /* Register 0, 1, 2, 2, ... */ + /* Divider 1, 2, 4, 8, ... */ int rk_clk_composite_register(struct clkdom *clkdom, struct rk_clk_composite_def *clkdef); From owner-svn-src-all@freebsd.org Fri Nov 8 19:29:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5CE415D064; Fri, 8 Nov 2019 19:29:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478r1Q4s35z3Kbg; Fri, 8 Nov 2019 19:29:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 870C52DA0; Fri, 8 Nov 2019 19:29:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8JTEW1010394; Fri, 8 Nov 2019 19:29:14 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8JTE4F010393; Fri, 8 Nov 2019 19:29:14 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201911081929.xA8JTE4F010393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 8 Nov 2019 19:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354558 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 19:29:14 -0000 Author: mmel Date: Fri Nov 8 19:29:14 2019 New Revision: 354558 URL: https://svnweb.freebsd.org/changeset/base/354558 Log: Remove explicit declaration of rk_clk_fract_set_freq() function forgotten in r354556. MFC after: 3 weeks MFC with: r354556 Noticed by: manu Modified: head/sys/arm64/rockchip/clk/rk_clk_fract.c Modified: head/sys/arm64/rockchip/clk/rk_clk_fract.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_fract.c Fri Nov 8 19:15:50 2019 (r354557) +++ head/sys/arm64/rockchip/clk/rk_clk_fract.c Fri Nov 8 19:29:14 2019 (r354558) @@ -149,9 +149,7 @@ rk_clk_fract_init(struct clknode *clk, device_t dev) return(0); } -static int -rk_clk_fract_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout, - int flags, int *stop); + static int rk_clk_fract_recalc(struct clknode *clk, uint64_t *freq) { From owner-svn-src-all@freebsd.org Fri Nov 8 20:08:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84C1815E342; Fri, 8 Nov 2019 20:08:45 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478rv12vg2z3Mkm; Fri, 8 Nov 2019 20:08:45 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42D0036CB; Fri, 8 Nov 2019 20:08:45 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8K8jn2033597; Fri, 8 Nov 2019 20:08:45 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8K8j7C033596; Fri, 8 Nov 2019 20:08:45 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911082008.xA8K8j7C033596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 8 Nov 2019 20:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354559 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 354559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:08:45 -0000 Author: manu Date: Fri Nov 8 20:08:44 2019 New Revision: 354559 URL: https://svnweb.freebsd.org/changeset/base/354559 Log: loader.efi: Default to serial if we don't have a ConOut variable In the EFI implementation in U-Boot no ConOut efi variable is created, this cause loader to fallback to TERM_EMU implementation which is very very very slow (and uses the ConOut device in the system table anyway). The UEFI spec aren't clear as if this variable needs to exists or not. Reviewed by: imp, kevans Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Fri Nov 8 19:29:14 2019 (r354558) +++ head/stand/efi/loader/main.c Fri Nov 8 20:08:44 2019 (r354559) @@ -703,8 +703,11 @@ parse_uefi_con_out(void) how = 0; sz = sizeof(buf); rv = efi_global_getenv("ConOut", buf, &sz); - if (rv != EFI_SUCCESS) + if (rv != EFI_SUCCESS) { + /* If we don't have any ConOut default to serial */ + how = RB_SERIAL; goto out; + } ep = buf + sz; node = (EFI_DEVICE_PATH *)buf; while ((char *)node < ep) { From owner-svn-src-all@freebsd.org Fri Nov 8 20:12:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC8CA15E8CD; Fri, 8 Nov 2019 20:12:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478rzs61Klz3NLj; Fri, 8 Nov 2019 20:12:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1930389E; Fri, 8 Nov 2019 20:12:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8KCvkS039285; Fri, 8 Nov 2019 20:12:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8KCvP0039284; Fri, 8 Nov 2019 20:12:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911082012.xA8KCvP0039284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 8 Nov 2019 20:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354560 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:12:58 -0000 Author: kevans Date: Fri Nov 8 20:12:57 2019 New Revision: 354560 URL: https://svnweb.freebsd.org/changeset/base/354560 Log: bcm2835_sdhci: add some very basic support for rpi4 DMA is currently disabled while I work out why it's broken, but this is enough for upstream U-Boot + rpi-firmware + our rpi3-psci-monitor to boot with the right config. The RPi 4 is still not in a good "supported" state, as we have no USB/PCI-E/Ethernet drivers, but if air-gapped pies only able to operate over cereal is your thing, here's your guy. Submitted by: Robert Crowston (with modifications) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 8 20:08:44 2019 (r354559) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 8 20:12:57 2019 (r354560) @@ -58,9 +58,12 @@ __FBSDID("$FreeBSD$"); #include "bcm2835_dma.h" #include -#include "bcm2835_vcbus.h" +#ifdef NOTYET +#include +#endif #define BCM2835_DEFAULT_SDHCI_FREQ 50 +#define BCM2838_DEFAULT_SDHCI_FREQ 100 #define BCM_SDHCI_BUFFER_SIZE 512 #define NUM_DMA_SEGS 2 @@ -84,10 +87,40 @@ SYSCTL_INT(_hw_sdhci, OID_AUTO, bcm2835_sdhci_debug, C static int bcm2835_sdhci_hs = 1; static int bcm2835_sdhci_pio_mode = 0; +struct bcm_mmc_conf { + int clock_id; + int clock_src; + int default_freq; + int power_id; + int quirks; + bool use_dma; +}; + +struct bcm_mmc_conf bcm2835_sdhci_conf = { + .clock_id = BCM2835_MBOX_CLOCK_ID_EMMC, + .clock_src = -1, + .default_freq = BCM2835_DEFAULT_SDHCI_FREQ, + .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_DONT_SET_HISPD_BIT | + SDHCI_QUIRK_MISSING_CAPS, + .use_dma = true +}; + +struct bcm_mmc_conf bcm2838_emmc2_conf = { + .clock_id = BCM2838_MBOX_CLOCK_ID_EMMC2, + .clock_src = -1, + .default_freq = BCM2838_DEFAULT_SDHCI_FREQ, + .quirks = 0, + /* XXX DMA is currently broken, but it shouldn't be. */ + .use_dma = false +}; + static struct ofw_compat_data compat_data[] = { - {"broadcom,bcm2835-sdhci", 1}, - {"brcm,bcm2835-sdhci", 1}, - {"brcm,bcm2835-mmc", 1}, + {"broadcom,bcm2835-sdhci", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2835-sdhci", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2835-mmc", (uintptr_t)&bcm2835_sdhci_conf}, + {"brcm,bcm2711-emmc2", (uintptr_t)&bcm2838_emmc2_conf}, + {"brcm,bcm2838-emmc2", (uintptr_t)&bcm2838_emmc2_conf}, {NULL, 0} }; @@ -115,6 +148,10 @@ struct bcm_sdhci_softc { uint32_t blksz_and_count; uint32_t cmd_and_mode; bool need_update_blk; +#ifdef NOTYET + device_t clkman; +#endif + struct bcm_mmc_conf * conf; }; static int bcm_sdhci_probe(device_t); @@ -168,8 +205,12 @@ bcm_sdhci_attach(device_t dev) sc->sc_dev = dev; sc->sc_req = NULL; - err = bcm2835_mbox_set_power_state(BCM2835_MBOX_POWER_ID_EMMC, - TRUE); + sc->conf = (struct bcm_mmc_conf *)ofw_bus_search_compatible(dev, + compat_data)->ocd_data; + if (sc->conf == 0) + return (ENXIO); + + err = bcm2835_mbox_set_power_state(BCM2835_MBOX_POWER_ID_EMMC, TRUE); if (err != 0) { if (bootverbose) device_printf(dev, "Unable to enable the power\n"); @@ -177,8 +218,7 @@ bcm_sdhci_attach(device_t dev) } default_freq = 0; - err = bcm2835_mbox_get_clock_rate(BCM2835_MBOX_CLOCK_ID_EMMC, - &default_freq); + err = bcm2835_mbox_get_clock_rate(sc->conf->clock_id, &default_freq); if (err == 0) { /* Convert to MHz */ default_freq /= 1000000; @@ -190,11 +230,28 @@ bcm_sdhci_attach(device_t dev) default_freq = cell / 1000000; } if (default_freq == 0) - default_freq = BCM2835_DEFAULT_SDHCI_FREQ; + default_freq = sc->conf->default_freq; if (bootverbose) device_printf(dev, "SDHCI frequency: %dMHz\n", default_freq); +#ifdef NOTYET + if (sc->conf->clock_src > 0) { + uint32_t f; + sc->clkman = devclass_get_device(devclass_find("bcm2835_clkman"), 0); + if (sc->clkman == NULL) { + device_printf(dev, "cannot find Clock Manager\n"); + return (ENXIO); + } + f = bcm2835_clkman_set_frequency(sc->clkman, sc->conf->clock_src, default_freq); + if (f == 0) + return (EINVAL); + + if (bootverbose) + device_printf(dev, "Clock source frequency: %dMHz\n", f); + } +#endif + rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -209,7 +266,7 @@ bcm_sdhci_attach(device_t dev) rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (!sc->sc_irq_res) { device_printf(dev, "cannot allocate interrupt\n"); err = ENXIO; @@ -230,36 +287,39 @@ bcm_sdhci_attach(device_t dev) if (bcm2835_sdhci_hs) sc->sc_slot.caps |= SDHCI_CAN_DO_HISPD; sc->sc_slot.caps |= (default_freq << SDHCI_CLOCK_BASE_SHIFT); - sc->sc_slot.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK - | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL - | SDHCI_QUIRK_DONT_SET_HISPD_BIT - | SDHCI_QUIRK_MISSING_CAPS; + sc->sc_slot.quirks = sc->conf->quirks; sdhci_init_slot(dev, &sc->sc_slot, 0); - sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); - if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) - goto fail; + if (sc->conf->use_dma) { + sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); + if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) + goto fail; - bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); + if (bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc) != 0) { + device_printf(dev, "cannot setup dma interrupt handler\n"); + err = ENXIO; + goto fail; + } - /* Allocate bus_dma resources. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), - 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, - BCM_SDHCI_BUFFER_SIZE, NUM_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, - BUS_DMA_ALLOCNOW, NULL, NULL, - &sc->sc_dma_tag); + /* Allocate bus_dma resources. */ + err = bus_dma_tag_create(bus_get_dma_tag(dev), + 1, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, + BCM_SDHCI_BUFFER_SIZE, NUM_DMA_SEGS, BCM_SDHCI_BUFFER_SIZE, + BUS_DMA_ALLOCNOW, NULL, NULL, + &sc->sc_dma_tag); - if (err) { - device_printf(dev, "failed allocate DMA tag"); - goto fail; - } + if (err) { + device_printf(dev, "failed allocate DMA tag"); + goto fail; + } - err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map); - if (err) { - device_printf(dev, "bus_dmamap_create failed\n"); - goto fail; + err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map); + if (err) { + device_printf(dev, "bus_dmamap_create failed\n"); + goto fail; + } } /* FIXME: Fix along with other BUS_SPACE_PHYSADDR instances */ @@ -454,26 +514,25 @@ bcm_sdhci_start_dma_seg(struct bcm_sdhci_softc *sc) { struct sdhci_slot *slot; vm_paddr_t pdst, psrc; - int err, idx, len, sync_op; + int err, idx, len, sync_op, width; slot = &sc->sc_slot; idx = sc->dmamap_seg_index++; len = sc->dmamap_seg_sizes[idx]; slot->offset += len; + width = (len & 0xf ? BCM_DMA_32BIT : BCM_DMA_128BIT); if (slot->curcmd->data->flags & MMC_DATA_READ) { bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, - BCM_DMA_INC_ADDR, - (len & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT); + BCM_DMA_INC_ADDR, width); psrc = sc->sc_sdhci_buffer_phys; pdst = sc->dmamap_seg_addrs[idx]; sync_op = BUS_DMASYNC_PREREAD; } else { bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, - BCM_DMA_INC_ADDR, - (len & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT); + BCM_DMA_INC_ADDR, width); bcm_dma_setup_dst(sc->sc_dma_ch, BCM_DMA_DREQ_EMMC, BCM_DMA_SAME_ADDR, BCM_DMA_32BIT); psrc = sc->dmamap_seg_addrs[idx]; @@ -664,8 +723,12 @@ bcm_sdhci_write_dma(device_t dev, struct sdhci_slot *s static int bcm_sdhci_will_handle_transfer(device_t dev, struct sdhci_slot *slot) { + struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); size_t left; + if (!sc->conf->use_dma) + return (0); + /* * Do not use DMA for transfers less than block size or with a length * that is not a multiple of four. @@ -744,6 +807,9 @@ static driver_t bcm_sdhci_driver = { DRIVER_MODULE(sdhci_bcm, simplebus, bcm_sdhci_driver, bcm_sdhci_devclass, NULL, NULL); +#ifdef NOTYET +MODULE_DEPEND(sdhci_bcm, bcm2835_clkman, 1, 1, 1); +#endif SDHCI_DEPEND(sdhci_bcm); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_bcm); From owner-svn-src-all@freebsd.org Fri Nov 8 20:14:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F11915E9BF; Fri, 8 Nov 2019 20:14:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478s1n3jTxz3NVf; Fri, 8 Nov 2019 20:14:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5EAAB389F; Fri, 8 Nov 2019 20:14:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8KEbME039403; Fri, 8 Nov 2019 20:14:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8KEbVU039402; Fri, 8 Nov 2019 20:14:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911082014.xA8KEbVU039402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 8 Nov 2019 20:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354561 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354561 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:14:37 -0000 Author: kevans Date: Fri Nov 8 20:14:36 2019 New Revision: 354561 URL: https://svnweb.freebsd.org/changeset/base/354561 Log: bcm2835_sdhci: remove unused power_id field This was once set, but I removed it by the time I committed it because both configurations use the same POWER_ID. This can be separated back out if the situation changes. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 8 20:12:57 2019 (r354560) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 8 20:14:36 2019 (r354561) @@ -91,7 +91,6 @@ struct bcm_mmc_conf { int clock_id; int clock_src; int default_freq; - int power_id; int quirks; bool use_dma; }; From owner-svn-src-all@freebsd.org Fri Nov 8 20:43:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79F3615F647; Fri, 8 Nov 2019 20:43:05 +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 478sfc0CRRz3Pyk; Fri, 8 Nov 2019 20:43:03 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id TB5uiXdQfnCigTB5viiuSg; Fri, 08 Nov 2019 13:43:01 -0700 X-Authority-Analysis: v=2.3 cv=cZisUULM c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MeAgGD-zjQ4A:10 a=iKhvJSA4AAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=pb_jOsI30yJrBfHcqsIA:9 a=QEXdDO2ut3YA:10 a=fDx4lTW7LADd24os25wA:9 a=mvTd8gQ2dj9sSofm:21 a=_W_S_7VecoQA:10 a=odh9cflL3HIXMm4fY7Wr:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from [10.199.244.203] (unknown [24.244.29.97]) by spqr.komquats.com (Postfix) with ESMTPSA id 3B4678EA; Fri, 8 Nov 2019 12:42:57 -0800 (PST) Date: Fri, 08 Nov 2019 13:42:33 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <201911081826.xA8IQIUn021142@gndrsh.dnsmgr.net> References: <201911081826.xA8IQIUn021142@gndrsh.dnsmgr.net> MIME-Version: 1.0 Subject: Re: svn commit: r350089 - head To: rgrimes@freebsd.org, "Rodney W. Grimes" , Glen Barber CC: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfD3aJqaR01dvctBVnTCCJ2wm3MRhUei0r9/U27NVLd/hrfIBdBYH1VitmqqElQg8jB3EON22RTs7luUClfXEMstDVeu+3lnJFGvcl4hN6Xst+EhiuPk1 sAnomQFH0Zxnnb2POzeelEj2+AuyI90g9FvOLzye3o5hd8PkAUvgtsCp+s7mUCJnScVAIBAF82A3uLwtO5oNvAdZsXVAjznFpeSScbbyD4kIZOMgw1BS57MM vyReuY5QiccfUKe9RewbIc1vKV7SIzJPTfY9+MAhPm6ffW+/qmKJkhlbTYhKBMJRamZu6peoChTmKpcPqE5bFurQ8PF0N2EcPG3w2LyrtWScY7+Qr8xzRyPA 0H+BGo21sDCcMrS79L37l6im1gcwNw== X-Rspamd-Queue-Id: 478sfc0CRRz3Pyk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.13) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.57 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[13.134.59.64.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-2.37)[ip: (-6.40), ipnet: 64.59.128.0/20(-3.02), asn: 6327(-2.33), country: CA(-0.09)]; FROM_EQ_ENVFROM(0.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:43:05 -0000 Those were my initial thoughts at the time=2E If an MFC is performed, its a= ssociated RELNOTES should also be committed=2E If committing an MFC, it mak= es sense to commit the same RELNOTES text through an MFC as well=2E On November 8, 2019 11:26:18 AM MST, "Rodney W=2E Grimes" wrote: >> On Wed, Jul 17, 2019 at 07:09:06PM +0000, Mark Johnston wrote: >> > Author: markj >> > Date: Wed Jul 17 19:09:05 2019 >> > New Revision: 350089 >> > URL: https://svnweb=2Efreebsd=2Eorg/changeset/base/350089 >> >=20 >> > Log: >> > Add an initial RELNOTES file=2E >> > =20 >> > The intent is to provide a convenient location to document >changes >> > that are relevant to users of binary FreeBSD distributions, in >contrast >> > with UPDATING, which exists to document caveats for users who >build >> > FreeBSD from source=2E >> > =20 >> > This complements the "Relnotes:" tag in commit messages by >providing a >> > place to document the change in more detail, or in case a >"Relnotes:" >> > tag was accidentally omitted=2E In particular, "Relnotes:" should >be >> > used if you do not intend to document the change in RELNOTES for >some >> > reason=2E >> > =20 >> > Changes to the file should not be MFCed=2E For now the file will >exist >> > only in head, but may be updated via direct commits to stable >branches >> > depending on how things go=2E >> > =20 >>=20 >> I had to go look at the original thread to remind myself about this, >but >> regarding not MFCing changes from head to stable branches, I think >there >> may have been some confusion in the discussion=2E >>=20 >> By "changes should not be MFCed", at least based on my recollection >of >> how the conversation was going, I (at least) meant "not MFCed, but >> committed as a direct commit to stable branches=2E" In other words, >> merging the RELNOTES change from head to stable/X does not really >make >> sense, as the revision numbers will have changed, and would >inevitably >> cause merge conflicts=2E >>=20 >> Now that 12=2E1 is out, maybe we can expand the idea of this file into >> stable/12 and even stable/11=2E One additional idea that came to mind >is >> with the formatting for stable branches=2E >>=20 >> For example, in head, there is: >>=20 >> rNNNNNN: >> The foo(8) utility was added=2E >>=20 >> For stable branches, I would propose the format of: >>=20 >> rNNNNNM, MFC of rNNNNNN: >> The foo(8) utility was added=2E >>=20 >> Thoughts? > >My thoughs originally on this was that when a release noteable item >is merged from head to stable the exact related commit to RELNOTES >should also be merged unaltered=2E > >The RELNOTES file should state that revision numbers in this file >are ^/HEAD revision numbers, and that a merge serach may be needed >to find the branch verson of the MFC=2E > >The ^/head RELNOTES file should be trunkated to length 0 when a =2E0 >branch is crated POST branch creation, thus all the relevant >entries are in the file on the new branch and can grow as things >are merged to it=2E Thus keeps the RELNOTES file in a state that >matches the branch as far as entires, just the Rxxxxx is referential >to when the entry was created relative to head=2E > >> Glen >--=20 >Rod Grimes =20 >rgrimes@freebsd=2Eorg --=20 Pardon the typos and autocorrect, small keyboard in use=2E=20 Cy Schubert FreeBSD UNIX: Web: https://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E From owner-svn-src-all@freebsd.org Fri Nov 8 20:48:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8564515F7C0; Fri, 8 Nov 2019 20:48:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478smJ2jKMz3Q8k; Fri, 8 Nov 2019 20:48:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C33C3E86; Fri, 8 Nov 2019 20:48:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8Km0dg057176; Fri, 8 Nov 2019 20:48:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8Km0V3057174; Fri, 8 Nov 2019 20:48:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911082048.xA8Km0V3057174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 8 Nov 2019 20:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354562 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:48:00 -0000 Author: markj Date: Fri Nov 8 20:47:59 2019 New Revision: 354562 URL: https://svnweb.freebsd.org/changeset/base/354562 Log: Add new iwm(4) files to sys/conf/files. Submitted by: rea MFC with: r354504 Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Nov 8 20:14:36 2019 (r354561) +++ head/sys/conf/files Fri Nov 8 20:47:59 2019 (r354562) @@ -1918,6 +1918,8 @@ iwi_monitor.fw optional iwimonitorfw | iwifw \ dev/iwm/if_iwm.c optional iwm dev/iwm/if_iwm_7000.c optional iwm dev/iwm/if_iwm_8000.c optional iwm +dev/iwm/if_iwm_9000.c optional iwm +dev/iwm/if_iwm_9260.c optional iwm dev/iwm/if_iwm_binding.c optional iwm dev/iwm/if_iwm_fw.c optional iwm dev/iwm/if_iwm_led.c optional iwm From owner-svn-src-all@freebsd.org Fri Nov 8 20:53:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95A3415FA8B; Fri, 8 Nov 2019 20:53:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478sv93QM6z3QYs; Fri, 8 Nov 2019 20:53:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 585714074; Fri, 8 Nov 2019 20:53:57 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8KrvpW062919; Fri, 8 Nov 2019 20:53:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8KrvRZ062918; Fri, 8 Nov 2019 20:53:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201911082053.xA8KrvRZ062918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 8 Nov 2019 20:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354563 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 354563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 20:53:57 -0000 Author: kevans Date: Fri Nov 8 20:53:56 2019 New Revision: 354563 URL: https://svnweb.freebsd.org/changeset/base/354563 Log: bcm2835: commit missing constant from r354560 Surgically pulling the patch from my debugging work lead to this slopiness- my apologies. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Fri Nov 8 20:47:59 2019 (r354562) +++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Fri Nov 8 20:53:56 2019 (r354563) @@ -118,6 +118,7 @@ int bcm2835_mbox_set_power_state(uint32_t, boolean_t); #define BCM2835_MBOX_CLOCK_ID_SDRAM 0x00000008 #define BCM2835_MBOX_CLOCK_ID_PIXEL 0x00000009 #define BCM2835_MBOX_CLOCK_ID_PWM 0x0000000a +#define BCM2838_MBOX_CLOCK_ID_EMMC2 0x0000000c #define BCM2835_MBOX_TAG_GET_CLOCK_RATE 0x00030002 #define BCM2835_MBOX_TAG_SET_CLOCK_RATE 0x00038002 From owner-svn-src-all@freebsd.org Fri Nov 8 23:39:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2FCF1648E0; Fri, 8 Nov 2019 23:39:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478xYx6D3Wz44mJ; Fri, 8 Nov 2019 23:39:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9AE15DF1; Fri, 8 Nov 2019 23:39:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8NdHCR056811; Fri, 8 Nov 2019 23:39:17 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8NdHm7056810; Fri, 8 Nov 2019 23:39:17 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911082339.xA8NdHm7056810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 8 Nov 2019 23:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354564 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 23:39:18 -0000 Author: rmacklem Date: Fri Nov 8 23:39:17 2019 New Revision: 354564 URL: https://svnweb.freebsd.org/changeset/base/354564 Log: Update copy_file_range(2) to be Linux5 compatible. The current linux man page and testing done on a fairly recent linux5.n kernel have identified two changes to the semantics of the linux copy_file_range system call. Since the copy_file_range(2) system call is intended to be linux compatible and is only currently in head/current and not used by any commands, it seems appropriate to update the system call to be compatible with the current linux one. The old linux man page stated that, if the offset + len exceeded file_size for the input file, EINVAL should be returned. Now, the semantics is to copy up to at most file_size bytes and return that number of bytes copied. If the offset is at or beyond file_size, a return of 0 bytes is done. This patch modifies copy_file_range(2) to be linux compatible for this semantic change. A separate patch will change copy_file_range(2) for the other semantic change, which allows the infd and outfd to refer to the same file, so long as the byte ranges do not overlap. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Nov 8 20:53:56 2019 (r354563) +++ head/sys/kern/vfs_vnops.c Fri Nov 8 23:39:17 2019 (r354564) @@ -2679,7 +2679,6 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, off_t *outoffp, size_t *lenp, unsigned int flags, struct ucred *incred, struct ucred *outcred, struct thread *fsize_td) { - struct vattr va; int error; size_t len; uint64_t uvalin, uvalout; @@ -2705,17 +2704,6 @@ vn_copy_file_range(struct vnode *invp, off_t *inoffp, if (error != 0) goto out; - error = vn_lock(invp, LK_SHARED); - if (error != 0) - goto out; - /* Check that the offset + len does not go past EOF of invp. */ - error = VOP_GETATTR(invp, &va, incred); - if (error == 0 && va.va_size < *inoffp + len) - error = EINVAL; - VOP_UNLOCK(invp, 0); - if (error != 0) - goto out; - /* * If the two vnode are for the same file system, call * VOP_COPY_FILE_RANGE(), otherwise call vn_generic_copy_file_range() @@ -2917,7 +2905,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * off_t startoff, endoff, xfer, xfer2; u_long blksize; int error; - bool cantseek, readzeros; + bool cantseek, readzeros, eof, lastblock; ssize_t aresid; size_t copylen, len, savlen; char *dat; @@ -3004,7 +2992,8 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may * support holes on the server, but do not support FIOSEEKHOLE. */ - while (len > 0 && error == 0) { + eof = false; + while (len > 0 && error == 0 && !eof) { endoff = 0; /* To shut up compilers. */ cantseek = true; startoff = *inoffp; @@ -3086,7 +3075,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * xfer -= (*inoffp % blksize); } /* Loop copying the data block. */ - while (copylen > 0 && error == 0) { + while (copylen > 0 && error == 0 && !eof) { if (copylen < xfer) xfer = copylen; error = vn_lock(invp, LK_SHARED); @@ -3097,12 +3086,13 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * curthread->td_ucred, incred, &aresid, curthread); VOP_UNLOCK(invp, 0); - /* - * Linux considers a range that exceeds EOF to - * be an error, so we will too. - */ - if (error == 0 && aresid > 0) - error = EINVAL; + lastblock = false; + if (error == 0 && aresid > 0) { + /* Stop the copy at EOF on the input file. */ + xfer -= aresid; + eof = true; + lastblock = true; + } if (error == 0) { /* * Skip the write for holes past the initial EOF @@ -3111,11 +3101,13 @@ vn_generic_copy_file_range(struct vnode *invp, off_t * */ readzeros = cantseek ? mem_iszero(dat, xfer) : false; + if (xfer == len) + lastblock = true; if (!cantseek || *outoffp < va.va_size || - xfer == len || !readzeros) + lastblock || !readzeros) error = vn_write_outvp(outvp, dat, *outoffp, xfer, blksize, - readzeros && xfer == len && + readzeros && lastblock && *outoffp >= va.va_size, false, outcred); if (error == 0) { From owner-svn-src-all@freebsd.org Fri Nov 8 23:49:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6636C164BCB; Fri, 8 Nov 2019 23:49:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478xnh1xPtz459h; Fri, 8 Nov 2019 23:49:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26F105FA8; Fri, 8 Nov 2019 23:49:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8NnRld062656; Fri, 8 Nov 2019 23:49:27 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8NnR5k062655; Fri, 8 Nov 2019 23:49:27 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911082349.xA8NnR5k062655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 8 Nov 2019 23:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354565 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 354565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 23:49:28 -0000 Author: rmacklem Date: Fri Nov 8 23:49:27 2019 New Revision: 354565 URL: https://svnweb.freebsd.org/changeset/base/354565 Log: Update the copy_file_range.2 man page to reflect the semantic change implemented by r354564. This is a content change. Modified: head/lib/libc/sys/copy_file_range.2 Modified: head/lib/libc/sys/copy_file_range.2 ============================================================================== --- head/lib/libc/sys/copy_file_range.2 Fri Nov 8 23:39:17 2019 (r354564) +++ head/lib/libc/sys/copy_file_range.2 Fri Nov 8 23:49:27 2019 (r354565) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2019 +.Dd November 8, 2019 .Dt COPY_FILE_RANGE 2 .Os .Sh NAME @@ -113,6 +113,14 @@ data ranges found. If it succeeds, the call returns the number of bytes copied, which can be fewer than .Fa len . +Returning fewer bytes than +.Fa len +does not necessarily indicate that EOF was reached. +However, a return of zero for a non-zero +.Fa len +argument indicates that the offset for +.Fa infd +is at or beyond EOF. .Fn copy_file_range should be used in a loop until copying of the desired byte range has been completed. @@ -154,13 +162,6 @@ and .Fa outoffp are reset to the initial values for the system call. .It Bq Er EINVAL -If the initial offset for -.Fa infd -plus -.Fa len -exceeds EOF for -.Fa infd -or .Fa flags is not zero. From owner-svn-src-all@freebsd.org Fri Nov 8 23:58:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D0AA1651CB; Fri, 8 Nov 2019 23:58:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478y0B1Nwjz45dQ; Fri, 8 Nov 2019 23:58:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12E106195; Fri, 8 Nov 2019 23:58:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8NwXdf068692; Fri, 8 Nov 2019 23:58:33 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA8NwXNw068691; Fri, 8 Nov 2019 23:58:33 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201911082358.xA8NwXNw068691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 8 Nov 2019 23:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354566 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 354566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 23:58:34 -0000 Author: rmacklem Date: Fri Nov 8 23:58:33 2019 New Revision: 354566 URL: https://svnweb.freebsd.org/changeset/base/354566 Log: Update the VOP_COPY_FILE_RANGE.9 man page to reflect the semantic change implemented by r354564. This is a content change. Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9 ============================================================================== --- head/share/man/man9/VOP_COPY_FILE_RANGE.9 Fri Nov 8 23:49:27 2019 (r354565) +++ head/share/man/man9/VOP_COPY_FILE_RANGE.9 Fri Nov 8 23:58:33 2019 (r354566) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd November 8, 2019 .Dt VOP_COPY_FILE_RANGE 9 .Os .Sh NAME @@ -94,6 +94,13 @@ Upon a successful return will be updated to the number of bytes actually copied. Normally, this will be the number of bytes requested to be copied, however a copy of fewer bytes than requested is permitted. +This does not necessarily indicate that the copy reached EOF on the input file. +However, if the value pointed to by the +.Fa len +argument is zero upon a successful return, +it indicates that the offset pointed to by +.Fa inoff +is at or beyond EOF on the input file. .Sh LOCKS The vnode are unlocked on entry and must be unlocked on return. The byte ranges for both From owner-svn-src-all@freebsd.org Sat Nov 9 02:26:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 085C717A642; Sat, 9 Nov 2019 02:26:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4791GM71b2z4DYM; Sat, 9 Nov 2019 02:26:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D10687D24; Sat, 9 Nov 2019 02:26:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA92Q3rG057016; Sat, 9 Nov 2019 02:26:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA92Q2SH057008; Sat, 9 Nov 2019 02:26:02 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201911090226.xA92Q2SH057008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 9 Nov 2019 02:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354568 - in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris... X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 354568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 02:26:04 -0000 Author: asomers Date: Sat Nov 9 02:26:01 2019 New Revision: 354568 URL: https://svnweb.freebsd.org/changeset/base/354568 Log: MFC r354116, r354120 r354116: MFZoL: Avoid retrieving unused snapshot props This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it to take input parameters that alter the way looping through the list of snapshots is performed. The idea here is to restrict functions that throw away some of the snapshots returned by the ioctl to a range of snapshots that these functions actually use. This improves efficiency and execution speed for some rollback and send operations. Reviewed-by: Tom Caputi Reviewed-by: Brian Behlendorf Reviewed by: Matt Ahrens Signed-off-by: Alek Pinchuk Closes #8077 zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 r354120: Commit missing file from r354116 Pointy-hat-to: Me Reported by: Dan Mack MFC-With: 354116 Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/lib/libbe/be_info.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Nov 9 02:26:01 2019 (r354568) @@ -139,7 +139,7 @@ zfs_callback(zfs_handle_t *zhp, void *data) ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) (void) zfs_iter_snapshots(zhp, (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, - data); + data, 0, 0); if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) (void) zfs_iter_bookmarks(zhp, zfs_callback, data); Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Nov 9 02:26:01 2019 (r354568) @@ -30,7 +30,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov . * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2018 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #include @@ -1174,7 +1174,7 @@ destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_ int err = 0; assert(cb->cb_firstsnap == NULL); assert(cb->cb_prevsnap == NULL); - err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb, 0, 0); if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { @@ -3437,6 +3437,7 @@ zfs_do_promote(int argc, char **argv) */ typedef struct rollback_cbdata { uint64_t cb_create; + uint8_t cb_younger_ds_printed; boolean_t cb_first; int cb_doclones; char *cb_target; @@ -3467,15 +3468,20 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data } /* - * Report any snapshots more recent than the one specified. Used when '-r' is - * not specified. We reuse this same callback for the snapshot dependents - if - * 'cb_dependent' is set, then this is a dependent and we should report it - * without checking the transaction group. + * Report some snapshots/bookmarks more recent than the one specified. + * Used when '-r' is not specified. We reuse this same callback for the + * snapshot dependents - if 'cb_dependent' is set, then this is a + * dependent and we should report it without checking the transaction group. */ static int rollback_check(zfs_handle_t *zhp, void *data) { rollback_cbdata_t *cbp = data; + /* + * Max number of younger snapshots and/or bookmarks to display before + * we stop the iteration. + */ + const uint8_t max_younger = 32; if (cbp->cb_doclones) { zfs_close(zhp); @@ -3504,9 +3510,24 @@ rollback_check(zfs_handle_t *zhp, void *data) } else { (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); + cbp->cb_younger_ds_printed++; } } zfs_close(zhp); + + if (cbp->cb_younger_ds_printed == max_younger) { + /* + * This non-recursive rollback is going to fail due to the + * presence of snapshots and/or bookmarks that are younger than + * the rollback target. + * We printed some of the offending objects, now we stop + * zfs_iter_snapshot/bookmark iteration so we can fail fast and + * avoid iterating over the rest of the younger objects + */ + (void) fprintf(stderr, gettext("Output limited to %d " + "snapshots/bookmarks\n"), max_younger); + return (-1); + } return (0); } @@ -3520,6 +3541,7 @@ zfs_do_rollback(int argc, char **argv) zfs_handle_t *zhp, *snap; char parentname[ZFS_MAX_DATASET_NAME_LEN]; char *delim; + uint64_t min_txg = 0; /* check options */ while ((c = getopt(argc, argv, "rRf")) != -1) { @@ -3575,7 +3597,12 @@ zfs_do_rollback(int argc, char **argv) cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); cb.cb_first = B_TRUE; cb.cb_error = 0; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb, + min_txg, 0)) != 0) goto out; if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) goto out; Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Nov 9 02:26:01 2019 (r354568) @@ -28,7 +28,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #ifndef _LIBZFS_H @@ -570,8 +570,10 @@ extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); +extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, + uint64_t, uint64_t); +extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, + uint64_t, uint64_t); extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Nov 9 02:26:01 2019 (r354568) @@ -31,6 +31,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov * Copyright 2017-2018 RackTop Systems. + * Copyright (c) 2019 Datto Inc. */ #include @@ -4163,7 +4164,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo rollback_data_t cb = { 0 }; int err; boolean_t restore_resv = 0; - uint64_t old_volsize = 0, new_volsize; + uint64_t min_txg = 0, old_volsize = 0, new_volsize; zfs_prop_t resv_prop; assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || @@ -4175,7 +4176,13 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo cb.cb_force = force; cb.cb_target = snap->zfs_name; cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); - (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb); + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb, + min_txg, 0); + (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb); if (cb.cb_error) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Nov 9 02:26:01 2019 (r354568) @@ -24,6 +24,7 @@ * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2019 Datto Inc. */ #include @@ -139,11 +140,12 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f fun */ int zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func, - void *data) + void *data, uint64_t min_txg, uint64_t max_txg) { zfs_cmd_t zc = { 0 }; zfs_handle_t *nzhp; int ret; + nvlist_t *range_nvl = NULL; if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || zhp->zfs_type == ZFS_TYPE_BOOKMARK) @@ -153,6 +155,24 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0) return (-1); + + if (min_txg != 0) { + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MIN_TXG, min_txg); + } + if (max_txg != 0) { + if (range_nvl == NULL) + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MAX_TXG, max_txg); + } + + if (range_nvl != NULL && + zcmd_write_src_nvlist(zhp->zfs_hdl, &zc, range_nvl) != 0) { + zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); + return (-1); + } + while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT, &zc)) == 0) { @@ -165,10 +185,12 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if ((ret = func(nzhp, data)) != 0) { zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return (ret); } } zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return ((ret < 0) ? ret : 0); } @@ -276,7 +298,8 @@ zfs_snapshot_compare(const void *larg, const void *rar } int -zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data) +zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data, + uint64_t min_txg, uint64_t max_txg) { int ret = 0; zfs_node_t *node; @@ -286,7 +309,8 @@ zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_ avl_create(&avl, zfs_snapshot_compare, sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode)); - ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl); + ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg, + max_txg); for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node)) ret |= callback(node->zn_handle, data); @@ -389,7 +413,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp } err = zfs_iter_snapshots_sorted(fs_zhp, - snapspec_cb, &ssa); + snapspec_cb, &ssa, 0, 0); if (ret == 0) ret = err; if (ret == 0 && (!ssa.ssa_seenfirst || @@ -429,7 +453,7 @@ zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, { int ret; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0) return (ret); return (zfs_iter_filesystems(zhp, func, data)); @@ -495,7 +519,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida); if (err == 0) { err = zfs_iter_snapshots(zhp, B_FALSE, - iter_dependents_cb, ida); + iter_dependents_cb, ida, 0, 0); } ida->stack = isf.next; } Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Nov 9 02:26:01 2019 (r354568) @@ -28,6 +28,7 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright (c) 2019 Datto Inc. */ #include @@ -612,6 +613,7 @@ typedef struct send_data { const char *tosnap; boolean_t recursive; boolean_t verbose; + boolean_t replicate; /* * The header nvlist is of the following format: @@ -789,6 +791,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) send_data_t *sd = arg; nvlist_t *nvfs, *nv; int rv = 0; + uint64_t min_txg = 0, max_txg = 0; uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; uint64_t fromsnap_txg_save = sd->fromsnap_txg; uint64_t tosnap_txg_save = sd->tosnap_txg; @@ -832,10 +835,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) goto out; } - VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); - VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); - VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", - sd->parent_fromsnap_guid)); + nvfs = fnvlist_alloc(); + fnvlist_add_string(nvfs, "name", zhp->zfs_name); + fnvlist_add_uint64(nvfs, "parentfromsnap", + sd->parent_fromsnap_guid); if (zhp->zfs_dmustats.dds_origin[0]) { zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, @@ -855,14 +858,19 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) nvlist_free(nv); /* iterate over snaps, and set sd->parent_fromsnap_guid */ + if (!sd->replicate && fromsnap_txg != 0) + min_txg = fromsnap_txg; + if (!sd->replicate && tosnap_txg != 0) + max_txg = tosnap_txg; sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, + min_txg, max_txg); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); - nvlist_free(sd->parent_snaps); - nvlist_free(sd->snapprops); + fnvlist_free(sd->parent_snaps); + fnvlist_free(sd->snapprops); /* add this fs to nvlist */ (void) snprintf(guidstring, sizeof (guidstring), @@ -886,11 +894,12 @@ out: static int gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, const char *tosnap, boolean_t recursive, boolean_t verbose, - nvlist_t **nvlp, avl_tree_t **avlp) + boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) { zfs_handle_t *zhp; - send_data_t sd = { 0 }; int error; + uint64_t min_txg = 0, max_txg = 0; + send_data_t sd = { 0 }; zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); if (zhp == NULL) @@ -902,6 +911,7 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname sd.tosnap = tosnap; sd.recursive = recursive; sd.verbose = verbose; + sd.replicate = replicate; if ((error = send_iterate_fs(zhp, &sd)) != 0) { nvlist_free(sd.fss); @@ -1338,6 +1348,7 @@ static int dump_filesystem(zfs_handle_t *zhp, void *arg) { int rv = 0; + uint64_t min_txg = 0, max_txg = 0; send_dump_data_t *sdd = arg; boolean_t missingfrom = B_FALSE; zfs_cmd_t zc = { 0 }; @@ -1373,7 +1384,15 @@ dump_filesystem(zfs_handle_t *zhp, void *arg) if (sdd->fromsnap == NULL || missingfrom) sdd->seenfrom = B_TRUE; - rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg); + if (!sdd->replicate && sdd->fromsnap != NULL) + min_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->fromsnap); + if (!sdd->replicate && sdd->tosnap != NULL) + max_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->tosnap); + + rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg, + min_txg, max_txg); if (!sdd->seenfrom) { (void) fprintf(stderr, dgettext(TEXT_DOMAIN, "WARNING: could not send %s@%s:\n" @@ -1834,7 +1853,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, fromsnap, tosnap, flags->replicate, flags->verbose, - &fss, &fsavl); + flags->replicate, &fss, &fsavl); if (err) goto err_out; VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); @@ -2477,7 +2496,7 @@ again: VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, - recursive, B_FALSE, &local_nv, &local_avl)) != 0) + recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) return (error); /* @@ -3554,7 +3573,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const */ *cp = '\0'; if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, - B_FALSE, &local_nv, &local_avl) == 0) { + B_FALSE, B_FALSE, &local_nv, &local_avl) == 0) { *cp = '@'; fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); fsavl_destroy(local_avl); Modified: stable/12/lib/libbe/be_info.c ============================================================================== --- stable/12/lib/libbe/be_info.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/lib/libbe/be_info.c Sat Nov 9 02:26:01 2019 (r354568) @@ -257,7 +257,8 @@ static int snapshot_proplist_update(zfs_handle_t *hdl, prop_data_t *data) { - return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data)); + return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data, + 0, 0)); } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Nov 9 02:26:01 2019 (r354568) @@ -33,7 +33,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 RackTop Systems. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* @@ -2345,7 +2345,8 @@ dataset_name_hidden(const char *name) * inputs: * zc_name name of filesystem * zc_cookie zap cursor - * zc_nvlist_dst_size size of buffer for property nvlist + * zc_nvlist_src iteration range nvlist + * zc_nvlist_src_size size of iteration range nvlist * * outputs: * zc_name name of next filesystem @@ -2414,9 +2415,24 @@ top: static int zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) { - objset_t *os; int error; + objset_t *os, *ossnap; + dsl_dataset_t *ds; + uint64_t min_txg = 0, max_txg = 0; + if (zc->zc_nvlist_src_size != 0) { + nvlist_t *props = NULL; + error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, + zc->zc_iflags, &props); + if (error != 0) + return (error); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MIN_TXG, + &min_txg); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MAX_TXG, + &max_txg); + nvlist_free(props); + } + error = dmu_objset_hold(zc->zc_name, FTAG, &os); if (error != 0) { return (error == ENOENT ? ESRCH : error); @@ -2432,26 +2448,52 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) return (SET_ERROR(ESRCH)); } - error = dmu_snapshot_list_next(os, - sizeof (zc->zc_name) - strlen(zc->zc_name), - zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie, - NULL); + while (error == 0) { + if (issig(JUSTLOOKING) && issig(FORREAL)) { + error = SET_ERROR(EINTR); + break; + } - if (error == 0 && !zc->zc_simple) { - dsl_dataset_t *ds; - dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool; + error = dmu_snapshot_list_next(os, + sizeof (zc->zc_name) - strlen(zc->zc_name), + zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, + &zc->zc_cookie, NULL); + if (error == ENOENT) { + error = SET_ERROR(ESRCH); + break; + } else if (error != 0) { + break; + } - error = dsl_dataset_hold_obj(dp, zc->zc_obj, FTAG, &ds); - if (error == 0) { - objset_t *ossnap; + error = dsl_dataset_hold_obj(dmu_objset_pool(os), zc->zc_obj, + FTAG, &ds); + if (error != 0) + break; - error = dmu_objset_from_ds(ds, &ossnap); - if (error == 0) - error = zfs_ioc_objset_stats_impl(zc, ossnap); + if ((min_txg != 0 && dsl_get_creationtxg(ds) < min_txg) || + (max_txg != 0 && dsl_get_creationtxg(ds) > max_txg)) { dsl_dataset_rele(ds, FTAG); + /* undo snapshot name append */ + *(strchr(zc->zc_name, '@') + 1) = '\0'; + /* skip snapshot */ + continue; } - } else if (error == ENOENT) { - error = SET_ERROR(ESRCH); + + if (zc->zc_simple) { + dsl_dataset_rele(ds, FTAG); + break; + } + + if ((error = dmu_objset_from_ds(ds, &ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + if ((error = zfs_ioc_objset_stats_impl(zc, ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + dsl_dataset_rele(ds, FTAG); + break; } dmu_objset_rele(os, FTAG); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Nov 9 00:14:42 2019 (r354567) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Nov 9 02:26:01 2019 (r354568) @@ -26,7 +26,7 @@ * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Joyent, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1122,6 +1122,13 @@ typedef enum { #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) + +/* + * nvlist name constants. Facilitate restricting snapshot iteration range for + * the "list next snapshot" ioctl + */ +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" /* * Sysevent payload members. ZFS will generate the following sysevents with the From owner-svn-src-all@freebsd.org Sat Nov 9 04:16:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8572117CAAD; Sat, 9 Nov 2019 04:16:26 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4793jk14jjz4JxZ; Sat, 9 Nov 2019 04:16:25 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xA94GNIK068522 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 8 Nov 2019 20:16:23 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xA94GNGo068521; Fri, 8 Nov 2019 20:16:23 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 8 Nov 2019 20:16:23 -0800 From: Gleb Smirnoff To: Renato Botelho Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354149 - head/sys/net Message-ID: <20191109041623.GS2195@FreeBSD.org> References: <201910291736.x9THa6Gd018030@repo.freebsd.org> <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qp4W5+cUSnZs0RIF" Content-Disposition: inline In-Reply-To: <781d285f-0b6d-45f1-f4b4-4bab60b789ae@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 4793jk14jjz4JxZ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 04:16:26 -0000 --qp4W5+cUSnZs0RIF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Renato, can you please try out the attached patch? On Fri, Nov 08, 2019 at 01:27:30PM -0300, Renato Botelho wrote: R> On 29/10/19 14:36, Gleb Smirnoff wrote: R> > Author: glebius R> > Date: Tue Oct 29 17:36:06 2019 R> > New Revision: 354149 R> > URL: https://svnweb.freebsd.org/changeset/base/354149 R> > R> > Log: R> > There is a long standing problem with multicast programming for NICs R> > and IPv6. With IPv6 we may call if_addmulti() in context of processing R> > of an incoming packet. Usually this is interrupt context. While most R> > of the NIC drivers are able to reprogram multicast filters without R> > sleeping, some of them can't. An example is e1000 family of drivers. R> > With iflib conversion the problem was somewhat hidden. Iflib processes R> > packets in private taskqueue, so going to sleep doesn't trigger an R> > assertion. However, the sleep would block operation of the driver and R> > following incoming packets would fill the ring and eventually would R> > start being dropped. Enabling epoch for the full time of a packet R> > processing again started to trigger assertions for e1000. R> > R> > Fix this problem once and for all using a general taskqueue to call R> > if_ioctl() method in all cases when if_addmulti() is called in a R> > non sleeping context. Note that nobody cares about returned value. R> > R> > Reviewed by: hselasky, kib R> > Differential Revision: https://reviews.freebsd.org/D22154 R> R> Hi Gleb, R> R> I upgraded my laptop running 13-CURRENT from r354133 to r354437 and it R> crashed during boot as you can see in the pictures [1]. It seems like R> it crashed while it was configuring network. R> R> After bisect I managed to boot fine with r354148 and reproduce the crash R> with this revision applied. R> R> Here is the relevant portion of my /etc/rc.conf: R> R> # Lagg R> ifconfig_em0="up" R> wlans_iwn0="wlan0" R> ifconfig_wlan0="WPA" R> create_args_wlan0="wlanaddr 3c:97:0e:48:3f:f8 up" R> cloned_interfaces="lagg0" R> ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP" R> ifconfig_lagg0_ipv6="inet6 accept_rtadv" R> rtsold_enable="YES" R> R> [1] https://imgur.com/a/lBtq3FW R> -- R> Renato Botelho -- Gleb Smirnoff --qp4W5+cUSnZs0RIF Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="if_siocaddmulti.diff" Index: sys/net/if.c =================================================================== --- sys/net/if.c (revision 354565) +++ sys/net/if.c (working copy) @@ -3571,7 +3571,9 @@ if_siocaddmulti(void *arg, int pending) if (pending > 1) if_printf(ifp, "%d SIOCADDMULTI coalesced\n", pending); #endif + CURVNET_SET(ifp->if_vnet); (void )(*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); + CURVNET_RESTORE(); } /* --qp4W5+cUSnZs0RIF-- From owner-svn-src-all@freebsd.org Sat Nov 9 11:55:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4D381A71CC; Sat, 9 Nov 2019 11:55:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479Ftv5Jvjz4fTX; Sat, 9 Nov 2019 11:55:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97BE9E51B; Sat, 9 Nov 2019 11:55:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA9Bt3N0097581; Sat, 9 Nov 2019 11:55:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA9Bt1Wv097573; Sat, 9 Nov 2019 11:55:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911091155.xA9Bt1Wv097573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 9 Nov 2019 11:55:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354569 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 11:55:03 -0000 Author: kib Date: Sat Nov 9 11:55:01 2019 New Revision: 354569 URL: https://svnweb.freebsd.org/changeset/base/354569 Log: MFC r354095, r354118, r354132: amd64: move pcb out of kstack to struct thread. Modified: stable/12/sys/amd64/amd64/cpu_switch.S stable/12/sys/amd64/amd64/genassym.c stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/amd64/vm_machdep.c stable/12/sys/amd64/include/md_var.h stable/12/sys/amd64/include/pcb.h stable/12/sys/amd64/include/pcpu_aux.h stable/12/sys/amd64/include/proc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/12/sys/amd64/amd64/cpu_switch.S Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/amd64/cpu_switch.S Sat Nov 9 11:55:01 2019 (r354569) @@ -86,7 +86,7 @@ END(cpu_throw) */ ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ - movq TD_PCB(%rdi),%r8 + leaq TD_MD_PCB(%rdi),%r8 movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -152,7 +152,7 @@ ctx_switch_xsave: callq pmap_activate_sw SETLK %r15,TD_LOCK(%r13) /* Release the old thread */ sw1: - movq TD_PCB(%r12),%r8 + leaq TD_MD_PCB(%r12),%r8 #if defined(SCHED_ULE) && defined(SMP) /* Wait for the new thread to become unblocked */ movq $blocked_lock, %rdx @@ -207,11 +207,12 @@ do_kthread: cmpq %rax,%rdx jne do_tss done_tss: - movq %r8,PCPU(RSP0) + movq TD_MD_STACK_BASE(%r12),%r9 + movq %r9,PCPU(RSP0) movq %r8,PCPU(CURPCB) movq PCPU(PTI_RSP0),%rax cmpq $~0,PCPU(UCR3) - cmove %r8,%rax + cmove %r9,%rax movq %rax,TSS_RSP0(%rdx) movq %r12,PCPU(CURTHREAD) /* into next thread */ Modified: stable/12/sys/amd64/amd64/genassym.c ============================================================================== --- stable/12/sys/amd64/amd64/genassym.c Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/amd64/genassym.c Sat Nov 9 11:55:01 2019 (r354569) @@ -87,6 +87,8 @@ ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); ASSYM(TD_MD, offsetof(struct thread, td_md)); +ASSYM(TD_MD_PCB, offsetof(struct thread, td_md.md_pcb)); +ASSYM(TD_MD_STACK_BASE, offsetof(struct thread, td_md.md_stack_base)); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/amd64/machdep.c Sat Nov 9 11:55:01 2019 (r354569) @@ -1805,12 +1805,12 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) amd64_conf_fast_syscall(); /* - * Temporary forge some valid pointer to PCB, for exception - * handlers. It is reinitialized properly below after FPU is - * set up. Also set up td_critnest to short-cut the page - * fault handler. + * We initialize the PCB pointer early so that exception + * handlers will work. Also set up td_critnest to short-cut + * the page fault handler. */ cpu_max_ext_state_size = sizeof(struct savefpu); + set_top_of_stack_td(&thread0); thread0.td_pcb = get_pcb_td(&thread0); thread0.td_critnest = 1; @@ -1866,11 +1866,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) fpuinit(); /* - * Set up thread0 pcb after fpuinit calculated pcb + fpu save + * Set up thread0 pcb save area after fpuinit calculated fpu save * area size. Zero out the extended state header in fpu save * area. */ - thread0.td_pcb = get_pcb_td(&thread0); thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size); if (use_xsave) { @@ -1879,7 +1878,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) xhdr->xstate_bv = xsave_mask; } /* make an initial tss so cpu can get interrupt stack on syscall! */ - rsp0 = (vm_offset_t)thread0.td_pcb; + rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; common_tss[0].tss_rsp0 = rsp0; @@ -1915,7 +1914,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TSEXIT(); /* Location of kernel stack for locore */ - return ((u_int64_t)thread0.td_pcb); + return (thread0.td_md.md_stack_base); } void Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/amd64/pmap.c Sat Nov 9 11:55:01 2019 (r354569) @@ -8370,7 +8370,7 @@ pmap_activate_sw_pti_post(struct thread *td, pmap_t pm { PCPU_GET(tssp)->tss_rsp0 = pmap->pm_ucr3 != PMAP_NO_CR3 ? - PCPU_GET(pti_rsp0) : (uintptr_t)td->td_pcb; + PCPU_GET(pti_rsp0) : (uintptr_t)td->td_md.md_stack_base; } static void inline Modified: stable/12/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/vm_machdep.c Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/amd64/vm_machdep.c Sat Nov 9 11:55:01 2019 (r354569) @@ -87,37 +87,41 @@ __FBSDID("$FreeBSD$"); _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); -struct savefpu * -get_pcb_user_save_td(struct thread *td) +void +set_top_of_stack_td(struct thread *td) { - vm_offset_t p; - - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - + td->td_md.md_stack_base = td->td_kstack + + td->td_kstack_pages * PAGE_SIZE - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); - KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area")); - return ((struct savefpu *)p); } struct savefpu * -get_pcb_user_save_pcb(struct pcb *pcb) +get_pcb_user_save_td(struct thread *td) { vm_offset_t p; - p = (vm_offset_t)(pcb + 1); + p = td->td_md.md_stack_base; + KASSERT((p % XSAVE_AREA_ALIGN) == 0, + ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); return ((struct savefpu *)p); } struct pcb * get_pcb_td(struct thread *td) { - vm_offset_t p; - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) - - sizeof(struct pcb); - return ((struct pcb *)p); + return (&td->td_md.md_pcb); } +struct savefpu * +get_pcb_user_save_pcb(struct pcb *pcb) +{ + struct thread *td; + + td = __containerof(pcb, struct thread, td_md.md_pcb); + return (get_pcb_user_save_td(td)); +} + void * alloc_fpusave(int flags) { @@ -165,9 +169,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t fpuexit(td1); update_pcb_bases(td1->td_pcb); - /* Point the pcb to the top of the stack */ - pcb2 = get_pcb_td(td2); - td2->td_pcb = pcb2; + /* Point the stack and pcb to the actual location */ + set_top_of_stack_td(td2); + td2->td_pcb = pcb2 = get_pcb_td(td2); /* Copy td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); @@ -187,7 +191,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - td2->td_frame = (struct trapframe *)td2->td_pcb - 1; + td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); td2->td_frame->tf_rax = 0; /* Child returns zero */ @@ -352,8 +356,9 @@ cpu_thread_alloc(struct thread *td) struct pcb *pcb; struct xstate_hdr *xhdr; + set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); - td->td_frame = (struct trapframe *)pcb - 1; + td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -491,7 +496,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) { struct pcb *pcb2; - /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; /* Modified: stable/12/sys/amd64/include/md_var.h ============================================================================== --- stable/12/sys/amd64/include/md_var.h Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/include/md_var.h Sat Nov 9 11:55:01 2019 (r354569) @@ -83,6 +83,7 @@ void fpstate_drop(struct thread *td); void pagezero(void *addr); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); void sse2_pagezero(void *addr); +void set_top_of_stack_td(struct thread *td); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); void pci_early_quirks(void); Modified: stable/12/sys/amd64/include/pcb.h ============================================================================== --- stable/12/sys/amd64/include/pcb.h Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/include/pcb.h Sat Nov 9 11:55:01 2019 (r354569) @@ -116,6 +116,10 @@ struct susppcb { /* fpu context for suspend/resume */ void *sp_fpususpend; }; +#else /* 32bit */ +struct pcb { + uint64_t pcb_dummy[40]; +}; #endif #ifdef _KERNEL Modified: stable/12/sys/amd64/include/pcpu_aux.h ============================================================================== --- stable/12/sys/amd64/include/pcpu_aux.h Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/include/pcpu_aux.h Sat Nov 9 11:55:01 2019 (r354569) @@ -57,16 +57,6 @@ __curthread(void) return (td); } #define curthread (__curthread()) - -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu, - pc_curpcb))); - return (pcb); -} -#define curpcb (__curpcb()) +#define curpcb (&curthread->td_md.md_pcb) #endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/amd64/include/proc.h ============================================================================== --- stable/12/sys/amd64/include/proc.h Sat Nov 9 02:26:01 2019 (r354568) +++ stable/12/sys/amd64/include/proc.h Sat Nov 9 11:55:01 2019 (r354569) @@ -36,6 +36,7 @@ #define _MACHINE_PROC_H_ #include +#include #include /* @@ -72,6 +73,8 @@ struct mdthread { struct pmap_invl_gen md_invl_gen; register_t md_efirt_tmp; /* (k) */ int md_efirt_dis_pf; /* (k) */ + struct pcb md_pcb; + vm_offset_t md_stack_base; }; struct mdproc { From owner-svn-src-all@freebsd.org Sat Nov 9 12:55:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED72C1A945C; Sat, 9 Nov 2019 12:55:08 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479HDC6X35z3Dy7; Sat, 9 Nov 2019 12:55:07 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: by mail-ed1-f67.google.com with SMTP id b72so8231685edf.1; Sat, 09 Nov 2019 04:55:07 -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=JngLqI+BCOho9bx7N226LanVksiuFczUOT2A9807o4w=; b=Pqx+Y5Hordxk2MCum/vOiVfmz75ya+LA6mVTODmPIY5w3T0M3bo5ChhARKPGqTVFTd E6/Y0sZRsr+KzI3fUK6XFwlLZNmgPH3irfjOknA2GKzUWuw6+qHWCo/A9rlcZd+FF9MV P+t6ezA0AsRs33DruOPe3FsNA3oVb47H8G7NTbC4ySgspNo5UL55IYMDYKLwHRoHdOeV nOWHYhPo95+WPSdZs3c7emOuMDw5Ki78uqfRWRTg8Xcf3no4laf1NxVaA6fWdzWX/1/G ce9Es8K/qpM6a9sjDutnM57ifHKSbTczfoja3MkqUAXjsuRHP6GflGhbkaHNSVmRsOqr 087g== X-Gm-Message-State: APjAAAWR0JqQ2ecTjVcy6rgIWrG+bljhvaXnXNQtZarQnSvQ9jNwo1+s oQmfUa9i3Rx/k5Kp25yLlB89865ydbmNa2HFN3FBmMlzmT8= X-Google-Smtp-Source: APXvYqyHKfE/3+ZJmgL0nDMZu53s0hlf8nJOsGXw+7nEHBcbSONt1Cadrw08ln+TLgWK/Ocmrh2yZFrqEA++BqkATL0= X-Received: by 2002:a50:9fc1:: with SMTP id c59mr16283411edf.305.1573304105513; Sat, 09 Nov 2019 04:55:05 -0800 (PST) MIME-Version: 1.0 References: <201909132303.x8DN3uw3026373@repo.freebsd.org> <20191002220807.GA3971@spathi.chuq.com> In-Reply-To: <20191002220807.GA3971@spathi.chuq.com> From: Mariusz Zaborski Date: Sat, 9 Nov 2019 13:54:59 +0100 Message-ID: Subject: Re: svn commit: r352312 - in head: lib/geom/nop sys/geom/nop To: Chuck Silvers Cc: Alan Somers , svn-src-head , svn-src-all , src-committers , Warner Losh Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 479HDC6X35z3Dy7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of oshogbovx@gmail.com designates 209.85.208.67 as permitted sender) smtp.mailfrom=oshogbovx@gmail.com X-Spamd-Result: default: False [-3.99 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[67.208.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.99)[ip: (-4.68), ipnet: 209.85.128.0/17(-3.19), asn: 15169(-2.00), country: US(-0.05)]; FORGED_SENDER(0.30)[oshogbo@freebsd.org,oshogbovx@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[67.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[oshogbo@freebsd.org,oshogbovx@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 12:55:09 -0000 Hello Chuck :) I wonder if we shouldn't change this option a bit. Shouldn't we have an option which says more like: ``` Specifies the number of I/O requests to allow before setting the read and write failure rate. ``` In some cases, I don't want to have 100% of failure probabilities, but on the early stage, I would like to allow some read/writes requests. If the options would only specify the amount of the requests not the failure probabilities could be used in other cases? Those that make sens? Mariusz On Thu, 3 Oct 2019 at 00:08, Chuck Silvers wrote: > > On Wed, Oct 02, 2019 at 08:11:57AM -0600, Alan Somers wrote: > > On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers wrote: > > > > > Author: chs > > > Date: Fri Sep 13 23:03:56 2019 > > > New Revision: 352312 > > > URL: https://svnweb.freebsd.org/changeset/base/352312 > > > > > > Log: > > > Add a "count_until_fail" option to gnop, which says to start failing > > > I/O requests after the given number have been allowed though. > > > > > > Approved by: imp (mentor) > > > Reviewed by: rpokala kib 0mp mckusick > > > Sponsored by: Netflix > > > Differential Revision: https://reviews.freebsd.org/D21593 > > > > > > Modified: > > > head/lib/geom/nop/geom_nop.c > > > head/lib/geom/nop/gnop.8 > > > head/sys/geom/nop/g_nop.c > > > head/sys/geom/nop/g_nop.h > > > > > > > This patch introduces a backwards-compatibility bug. On a system with a > > post-352312 kernel but a pre-352312 userland, the gnop command will always > > fail with the error "gnop: Missing count_until_fail argument". > > -Alan > > Thanks for pointing this out, I'll see about fixing it right away. > > -Chuck > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Sat Nov 9 17:08:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9143B1AEEC9; Sat, 9 Nov 2019 17:08:28 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479NrX2pBgz3xVV; Sat, 9 Nov 2019 17:08:28 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4487719D10; Sat, 9 Nov 2019 17:08:28 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA9H8SV4080214; Sat, 9 Nov 2019 17:08:28 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA9H8R5M080213; Sat, 9 Nov 2019 17:08:27 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201911091708.xA9H8R5M080213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 9 Nov 2019 17:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354570 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 17:08:28 -0000 Author: dougm Date: Sat Nov 9 17:08:27 2019 New Revision: 354570 URL: https://svnweb.freebsd.org/changeset/base/354570 Log: For vm_map, #defining DIAGNOSTIC to turn on full assertion-based consistency checking slows performance dramatically. This change reduces the number of assertions checked by completely walking the vm_map tree only when the write-lock is released, and only then if the number of modifications to the tree since the last walk exceeds the number of tree nodes. Reviewed by: alc, kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22163 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Nov 9 11:55:01 2019 (r354569) +++ head/sys/vm/vm_map.c Sat Nov 9 17:08:27 2019 (r354570) @@ -596,10 +596,54 @@ vm_map_process_deferred(void) } } +#ifdef INVARIANTS +static void +_vm_map_assert_locked(vm_map_t map, const char *file, int line) +{ + + if (map->system_map) + mtx_assert_(&map->system_mtx, MA_OWNED, file, line); + else + sx_assert_(&map->lock, SA_XLOCKED, file, line); +} + +#define VM_MAP_ASSERT_LOCKED(map) \ + _vm_map_assert_locked(map, LOCK_FILE, LOCK_LINE) + +enum { VMMAP_CHECK_NONE, VMMAP_CHECK_UNLOCK, VMMAP_CHECK_ALL }; +#ifdef DIAGNOSTIC +static int enable_vmmap_check = VMMAP_CHECK_UNLOCK; +#else +static int enable_vmmap_check = VMMAP_CHECK_NONE; +#endif +SYSCTL_INT(_debug, OID_AUTO, vmmap_check, CTLFLAG_RWTUN, + &enable_vmmap_check, 0, "Enable vm map consistency checking"); + +static void _vm_map_assert_consistent(vm_map_t map, int check); + +#define VM_MAP_ASSERT_CONSISTENT(map) \ + _vm_map_assert_consistent(map, VMMAP_CHECK_ALL) +#ifdef DIAGNOSTIC +#define VM_MAP_UNLOCK_CONSISTENT(map) do { \ + if (map->nupdates > map->nentries) { \ + _vm_map_assert_consistent(map, VMMAP_CHECK_UNLOCK); \ + map->nupdates = 0; \ + } \ +} while (0) +#else +#define VM_MAP_UNLOCK_CONSISTENT(map) +#endif +#else +#define VM_MAP_ASSERT_LOCKED(map) +#define VM_MAP_ASSERT_CONSISTENT(map) +#define VM_MAP_UNLOCK_CONSISTENT(map) +#endif /* INVARIANTS */ + void _vm_map_unlock(vm_map_t map, const char *file, int line) { + VM_MAP_UNLOCK_CONSISTENT(map); if (map->system_map) mtx_unlock_flags_(&map->system_mtx, 0, file, line); else { @@ -697,8 +741,10 @@ _vm_map_lock_downgrade(vm_map_t map, const char *file, if (map->system_map) { mtx_assert_(&map->system_mtx, MA_OWNED, file, line); - } else + } else { + VM_MAP_UNLOCK_CONSISTENT(map); sx_downgrade_(&map->lock, file, line); + } } /* @@ -717,37 +763,6 @@ vm_map_locked(vm_map_t map) return (sx_xlocked(&map->lock)); } -#ifdef INVARIANTS -static void -_vm_map_assert_locked(vm_map_t map, const char *file, int line) -{ - - if (map->system_map) - mtx_assert_(&map->system_mtx, MA_OWNED, file, line); - else - sx_assert_(&map->lock, SA_XLOCKED, file, line); -} - -#define VM_MAP_ASSERT_LOCKED(map) \ - _vm_map_assert_locked(map, LOCK_FILE, LOCK_LINE) - -#ifdef DIAGNOSTIC -static int enable_vmmap_check = 1; -#else -static int enable_vmmap_check = 0; -#endif -SYSCTL_INT(_debug, OID_AUTO, vmmap_check, CTLFLAG_RWTUN, - &enable_vmmap_check, 0, "Enable vm map consistency checking"); - -static void _vm_map_assert_consistent(vm_map_t map); - -#define VM_MAP_ASSERT_CONSISTENT(map) \ - _vm_map_assert_consistent(map) -#else -#define VM_MAP_ASSERT_LOCKED(map) -#define VM_MAP_ASSERT_CONSISTENT(map) -#endif /* INVARIANTS */ - /* * _vm_map_unlock_and_wait: * @@ -766,6 +781,7 @@ int _vm_map_unlock_and_wait(vm_map_t map, int timo, const char *file, int line) { + VM_MAP_UNLOCK_CONSISTENT(map); mtx_lock(&map_sleep_mtx); if (map->system_map) mtx_unlock_flags_(&map->system_mtx, 0, file, line); @@ -874,6 +890,9 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t mi map->timestamp = 0; map->busy = 0; map->anon_loc = 0; +#ifdef DIAGNOSTIC + map->nupdates = 0; +#endif } void @@ -1132,6 +1151,9 @@ vm_map_splay_merge(vm_map_t map, vm_map_entry_t root, } root->max_free = MAX(max_free_left, max_free_right); map->root = root; +#ifdef DIAGNOSTIC + ++map->nupdates; +#endif } /* @@ -1330,8 +1352,10 @@ vm_map_lookup_entry( * on a temporary upgrade. */ cur = vm_map_splay(map, address); - if (!locked) + if (!locked) { + VM_MAP_UNLOCK_CONSISTENT(map); sx_downgrade(&map->lock); + } /* * If "address" is contained within a map entry, the new root @@ -4786,12 +4810,12 @@ vm_map_pmap_KBI(vm_map_t map) #ifdef INVARIANTS static void -_vm_map_assert_consistent(vm_map_t map) +_vm_map_assert_consistent(vm_map_t map, int check) { vm_map_entry_t entry, prev; vm_size_t max_left, max_right; - if (!enable_vmmap_check) + if (enable_vmmap_check != check) return; prev = &map->header; Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sat Nov 9 11:55:01 2019 (r354569) +++ head/sys/vm/vm_map.h Sat Nov 9 17:08:27 2019 (r354570) @@ -207,6 +207,9 @@ struct vm_map { pmap_t pmap; /* (c) Physical map */ vm_offset_t anon_loc; int busy; +#ifdef DIAGNOSTIC + int nupdates; +#endif }; /* From owner-svn-src-all@freebsd.org Sat Nov 9 17:30:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24BB81AF531; Sat, 9 Nov 2019 17:30:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479PKp077Kz3yLY; Sat, 9 Nov 2019 17:30:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB9CD1A0A8; Sat, 9 Nov 2019 17:30:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA9HULPO091889; Sat, 9 Nov 2019 17:30:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA9HUKGn091881; Sat, 9 Nov 2019 17:30:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201911091730.xA9HUKGn091881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 9 Nov 2019 17:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354571 - in head: sys/cam/ata sys/cam/mmc sys/cam/nvme sys/cam/scsi sys/geom usr.sbin/diskinfo X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: sys/cam/ata sys/cam/mmc sys/cam/nvme sys/cam/scsi sys/geom usr.sbin/diskinfo X-SVN-Commit-Revision: 354571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 17:30:22 -0000 Author: trasz Date: Sat Nov 9 17:30:19 2019 New Revision: 354571 URL: https://svnweb.freebsd.org/changeset/base/354571 Log: Add GEOM attribute to report physical device name, and report it via 'diskinfo -v'. This avoids the need to track it down via CAM, and should also work for disks that don't use CAM. And since it's inherited thru the GEOM hierarchy, in most cases one doesn't need to walk the GEOM graph either, eg you can use it on a partition instead of disk itself. Reviewed by: allanjude, imp Sponsored by: Klara Inc Differential Revision: https://reviews.freebsd.org/D22249 Modified: head/sys/cam/ata/ata_da.c head/sys/cam/mmc/mmc_da.c head/sys/cam/nvme/nvme_da.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h head/usr.sbin/diskinfo/diskinfo.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/cam/ata/ata_da.c Sat Nov 9 17:30:19 2019 (r354571) @@ -3420,6 +3420,8 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev softc->disk->d_fwheads = softc->params.heads; ata_disk_firmware_geom_adjust(softc->disk); softc->disk->d_rotation_rate = cgd->ident_data.media_rotation_rate; + snprintf(softc->disk->d_attachment, sizeof(softc->disk->d_attachment), + "%s%d", softc->cpi.dev_name, softc->cpi.unit_number); } static void Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/cam/mmc/mmc_da.c Sat Nov 9 17:30:19 2019 (r354571) @@ -1532,6 +1532,8 @@ sdda_add_part(struct cam_periph *periph, u_int type, c part->disk->d_hba_device = cpi.hba_device; part->disk->d_hba_subvendor = cpi.hba_subvendor; part->disk->d_hba_subdevice = cpi.hba_subdevice; + snprintf(part->disk->d_attachment, sizeof(part->disk->d_attachment), + "%s%d", cpi.dev_name, cpi.unit_number); part->disk->d_sectorsize = mmc_get_sector_size(periph); part->disk->d_mediasize = media_size; Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/cam/nvme/nvme_da.c Sat Nov 9 17:30:19 2019 (r354571) @@ -815,6 +815,8 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_hba_device = cpi.hba_device; disk->d_hba_subvendor = cpi.hba_subvendor; disk->d_hba_subdevice = cpi.hba_subdevice; + snprintf(disk->d_attachment, sizeof(disk->d_attachment), + "%s%d", cpi.dev_name, cpi.unit_number); disk->d_stripesize = disk->d_sectorsize; disk->d_stripeoffset = 0; disk->d_devstat = devstat_new_entry(periph->periph_name, Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/cam/scsi/scsi_cd.c Sat Nov 9 17:30:19 2019 (r354571) @@ -702,6 +702,8 @@ cdregister(struct cam_periph *periph, void *arg) softc->disk->d_hba_device = cpi.hba_device; softc->disk->d_hba_subvendor = cpi.hba_subvendor; softc->disk->d_hba_subdevice = cpi.hba_subdevice; + snprintf(softc->disk->d_attachment, sizeof(softc->disk->d_attachment), + "%s%d", cpi.dev_name, cpi.unit_number); /* * Acquire a reference to the periph before we register with GEOM. Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/cam/scsi/scsi_da.c Sat Nov 9 17:30:19 2019 (r354571) @@ -2875,6 +2875,8 @@ daregister(struct cam_periph *periph, void *arg) softc->disk->d_hba_device = cpi.hba_device; softc->disk->d_hba_subvendor = cpi.hba_subvendor; softc->disk->d_hba_subdevice = cpi.hba_subdevice; + snprintf(softc->disk->d_attachment, sizeof(softc->disk->d_attachment), + "%s%d", cpi.dev_name, cpi.unit_number); /* * Acquire a reference to the periph before we register with GEOM. Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/geom/geom_disk.c Sat Nov 9 17:30:19 2019 (r354571) @@ -528,7 +528,10 @@ g_disk_start(struct bio *bp) else if (g_handleattr_uint16_t(bp, "GEOM::rotation_rate", dp->d_rotation_rate)) break; - else + else if (g_handleattr_str(bp, "GEOM::attachment", + dp->d_attachment)) + break; + else error = ENOIOCTL; break; case BIO_FLUSH: Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Sat Nov 9 17:08:27 2019 (r354570) +++ head/sys/geom/geom_disk.h Sat Nov 9 17:30:19 2019 (r354571) @@ -118,6 +118,7 @@ struct disk { uint16_t d_hba_subvendor; uint16_t d_hba_subdevice; uint16_t d_rotation_rate; + char d_attachment[DISK_IDENT_SIZE]; /* Fields private to the driver */ void *d_drv1; Modified: head/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- head/usr.sbin/diskinfo/diskinfo.c Sat Nov 9 17:08:27 2019 (r354570) +++ head/usr.sbin/diskinfo/diskinfo.c Sat Nov 9 17:30:19 2019 (r354571) @@ -251,6 +251,10 @@ main(int argc, char **argv) printf("\t%-12s\t# Disk descr.\n", arg.value.str); if (ioctl(fd, DIOCGIDENT, ident) == 0) printf("\t%-12s\t# Disk ident.\n", ident); + strlcpy(arg.name, "GEOM::attachment", sizeof(arg.name)); + arg.len = sizeof(arg.value.str); + if (ioctl(fd, DIOCGATTR, &arg) == 0) + printf("\t%-12s\t# Attachment\n", arg.value.str); if (ioctl(fd, DIOCGPHYSPATH, physpath) == 0) printf("\t%-12s\t# Physical path\n", physpath); printf("\t%-12s\t# TRIM/UNMAP support\n", From owner-svn-src-all@freebsd.org Sat Nov 9 17:55:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 505CD1AFBC6; Sat, 9 Nov 2019 17:55:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479Ptk1F1Zz40Mr; Sat, 9 Nov 2019 17:55:26 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id D303FB7AC; Sat, 9 Nov 2019 17:55:25 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [10.0.1.237] (78-22-44-167.access.telenet.be [78.22.44.167]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 2DEC9F8CD; Sat, 9 Nov 2019 18:55:24 +0100 (CET) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Kristof Provost Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r354553 - in head/tests/sys: netinet6 netpfil/common netpfil/pf Date: Sat, 9 Nov 2019 18:55:23 +0100 Message-Id: References: <201911081856.xA8Iu39F091885@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201911081856.xA8Iu39F091885@repo.freebsd.org> To: Li-Wen Hsu X-Mailer: iPhone Mail (17B84) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 17:55:26 -0000 Thank you! Kristof > On 8 Nov 2019, at 19:56, Li-Wen Hsu wrote: >=20 > =EF=BB=BFAuthor: lwhsu > Date: Fri Nov 8 18:56:02 2019 > New Revision: 354553 > URL: https://svnweb.freebsd.org/changeset/base/354553 >=20 > Log: > Reenable netinet6 and netpfil tests on i386, net/scapy 2.4.3_2 contains t= he fix >=20 > PR: 239380 > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/tests/sys/netinet6/exthdr.sh > head/tests/sys/netinet6/scapyi386.sh > head/tests/sys/netpfil/common/forward.sh > head/tests/sys/netpfil/common/tos.sh > head/tests/sys/netpfil/pf/forward.sh > head/tests/sys/netpfil/pf/set_tos.sh >=20 > Modified: head/tests/sys/netinet6/exthdr.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netinet6/exthdr.sh Fri Nov 8 17:57:03 2019 (r354= 552) > +++ head/tests/sys/netinet6/exthdr.sh Fri Nov 8 18:56:02 2019 (r354= 553) > @@ -38,11 +38,6 @@ exthdr_head() { >=20 > exthdr_body() { >=20 > - if [ "$(atf_config_get ci false)" =3D "true" ] && \ > - [ "$(uname -p)" =3D "i386" ]; then > - atf_skip "https://bugs.freebsd.org/241493" > - fi > - > ids=3D65533 > id=3D`printf "%x" ${ids}` > if [ $$ -gt 65535 ]; then >=20 > Modified: head/tests/sys/netinet6/scapyi386.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netinet6/scapyi386.sh Fri Nov 8 17:57:03 2019 (r= 354552) > +++ head/tests/sys/netinet6/scapyi386.sh Fri Nov 8 18:56:02 2019 (r= 354553) > @@ -38,11 +38,6 @@ scapyi386_head() { >=20 > scapyi386_body() { >=20 > - if [ "$(atf_config_get ci false)" =3D "true" ] && \ > - [ "$(uname -p)" =3D "i386" ]; then > - atf_skip "https://bugs.freebsd.org/239380" > - fi > - > ids=3D65533 > id=3D`printf "%x" ${ids}` > if [ $$ -gt 65535 ]; then >=20 > Modified: head/tests/sys/netpfil/common/forward.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netpfil/common/forward.sh Fri Nov 8 17:57:03 2019 = (r354552) > +++ head/tests/sys/netpfil/common/forward.sh Fri Nov 8 18:56:02 2019 = (r354553) > @@ -40,10 +40,6 @@ v4_head() > v4_body() > { > firewall=3D$1 > - if [ "$(atf_config_get ci false)" =3D "true" ] && \ > - [ "$(uname -p)" =3D "i386" ] && [ "${firewall}" =3D "pf" ]; then > - atf_skip "https://bugs.freebsd.org/240085" > - fi > firewall_init $firewall >=20 > epair_send=3D$(vnet_mkepair) >=20 > Modified: head/tests/sys/netpfil/common/tos.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netpfil/common/tos.sh Fri Nov 8 17:57:03 2019 (r= 354552) > +++ head/tests/sys/netpfil/common/tos.sh Fri Nov 8 18:56:02 2019 (r= 354553) > @@ -40,10 +40,6 @@ tos_head() > tos_body() > { > firewall=3D$1 > - if [ "$(atf_config_get ci false)" =3D "true" ] && \ > - [ "$(uname -p)" =3D "i386" ] && [ "${firewall}" =3D "pf" ]; then > - atf_skip "https://bugs.freebsd.org/240086" > - fi > firewall_init $firewall >=20 > epair_send=3D$(vnet_mkepair) >=20 > Modified: head/tests/sys/netpfil/pf/forward.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netpfil/pf/forward.sh Fri Nov 8 17:57:03 2019 (r= 354552) > +++ head/tests/sys/netpfil/pf/forward.sh Fri Nov 8 18:56:02 2019 (r= 354553) > @@ -41,10 +41,6 @@ v4_head() >=20 > v4_body() > { > - if [ `uname -p` =3D "i386" ]; then > - atf_skip "https://bugs.freebsd.org/239380" > - fi > - > pft_init >=20 > epair_send=3D$(vnet_mkepair) > @@ -104,10 +100,6 @@ v6_head() >=20 > v6_body() > { > - if [ `uname -p` =3D "i386" ]; then > - atf_skip "https://bugs.freebsd.org/239380" > - fi > - > pft_init >=20 > epair_send=3D$(vnet_mkepair) >=20 > Modified: head/tests/sys/netpfil/pf/set_tos.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/tests/sys/netpfil/pf/set_tos.sh Fri Nov 8 17:57:03 2019 (r= 354552) > +++ head/tests/sys/netpfil/pf/set_tos.sh Fri Nov 8 18:56:02 2019 (r= 354553) > @@ -41,10 +41,6 @@ v4_head() >=20 > v4_body() > { > - if [ `uname -p` =3D "i386" ]; then > - atf_skip "https://bugs.freebsd.org/239380" > - fi > - > pft_init >=20 > epair_send=3D$(vnet_mkepair) >=20 From owner-svn-src-all@freebsd.org Sat Nov 9 19:50:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 688A717B06F; Sat, 9 Nov 2019 19:50:05 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from mailgate.Leidinger.net (mailgate.leidinger.net [IPv6:2a00:1828:2000:313::1:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 479SR02Rtyz45Zh; Sat, 9 Nov 2019 19:50:04 +0000 (UTC) (envelope-from Alexander@leidinger.net) Received: from outgoing.leidinger.net (p5B165DF1.dip0.t-ipconnect.de [91.22.93.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (Client did not present a certificate) by mailgate.Leidinger.net (Postfix) with ESMTPSA id 06F7C145A; Sat, 9 Nov 2019 20:50:01 +0100 (CET) Received: from webmail.leidinger.net (webmail.Leidinger.net [IPv6:fd73:10c7:2053:1::3:102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by outgoing.leidinger.net (Postfix) with ESMTPS id 8AA4CA11D; Sat, 9 Nov 2019 20:49:58 +0100 (CET) Received: (from www@localhost) by webmail.leidinger.net (8.15.2/8.14.4/Submit) id xA9Jnwui092096; Sat, 9 Nov 2019 20:49:58 +0100 (CET) (envelope-from Alexander@leidinger.net) X-Authentication-Warning: webmail.leidinger.net: www set sender to Alexander@leidinger.net using -f Received: from [::ffff:192.168.1.28] ([::ffff:192.168.1.28]) by webmail.leidinger.net (Horde Framework) with HTTPS; Sat, 09 Nov 2019 20:49:58 +0100 Date: Sat, 09 Nov 2019 20:49:58 +0100 Message-ID: <20191109204958.Horde.B0ynnS_aur1OZimnDNObsAt@webmail.leidinger.net> From: Alexander Leidinger To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354458 - head/libexec/rc/rc.d In-Reply-To: <201911071815.xA7IFOhI070066@repo.freebsd.org> User-Agent: Horde Application Framework 5 Accept-Language: de,en Content-Type: multipart/signed; boundary="=_HNo1qBiWgvcf_L5sQpvCu0i"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 479SR02Rtyz45Zh X-Spamd-Bar: ------- X-Spamd-Result: default: False [-7.82 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[leidinger.net:s=outgoing-alex]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; XAW_SERVICE_ACCT(1.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[leidinger.net:+]; DMARC_POLICY_ALLOW(-0.50)[leidinger.net,quarantine]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-3.72)[ip: (-9.81), ipnet: 2a00:1828::/32(-4.89), asn: 34240(-3.90), country: DE(-0.01)]; ASN(0.00)[asn:34240, ipnet:2a00:1828::/32, country:DE]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[241.93.22.91.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 19:50:05 -0000 This message is in MIME format and has been PGP signed. --=_HNo1qBiWgvcf_L5sQpvCu0i Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Quoting Edward Tomasz Napierala (from Thu, 7 Nov=20=20 2019=2018:15:24 +0000 (UTC)): > Author: trasz > Date: Thu Nov 7 18:15:24 2019 > New Revision: 354458 > URL: https://svnweb.freebsd.org/changeset/base/354458 > > Log: > Extend the linux rc script to mount the neccessary file systems, > set ELF fallback brand, and load pty(4). We never did something like that. We have it documented everywhere=20=20 that=20it needs to be done manually. So this is at least a POLA=20=20 violation.=20It is great that the nocover option is used in the mount,=20= =20 but=20it's still some kind of layering violation (I may want to have=20=20 only=20a subset mounted, or nothing at all). I do not object to the functionality, but I think it needs to be=20=20 configurable=20(an option to influence if the auto-mount is done or not,=20= =20 doesn't=20matter to me what the default behavior is, as long as it is=20=20 configurable)=20and documented (UPDATING, handbook, man-pages, maybe=20=20 even=20the release notes). Bye, Alexander. --=20 http://www.Leidinger.net=20Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_HNo1qBiWgvcf_L5sQpvCu0i Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJdxxhmAAoJEBINsJsD+NiGlFIP/2IHcnBe5tDBtAcisS/HONgw Qrbwweqcsf2THYewkCIXt36e6G5iq3vVgP9quQ3ZHVba3KauP83mg2a7BR0JsC7W R8fOE9AVQ4R4NNg8p6qqhfMVIMUCSDWhkfuDYYkfKiaiQezZHXp39YfkvM1aFcsV 5gqcP/upbZ1YDE0GrfuZhwn78ulbFJYVi6ysgdk+XRPzIp8jkvX2Rqjp/zpxFAxY OZvazCOFH4+Kj3wPmpkZ4G7ZbwQ5itWXr/g2KP3M2u+SYuxolEf/hMD+WEcHQqr1 zJ+xB3XQSjeqwipuKRf3Y5BFzEMLBu8QMDATO+nawv3BMvAHSQYy2OHSjfLG8hq/ xV/8RBysjJfyqXiFfM2GACsyo/x1FsxrmOYry7hpsxrrl/zi5wFeyeQMZ2GhGNos iWXvnoSAHH1XB3fy4fM8+5hbcj1ELP7Pa1eygY0ewM6bqOC0xL1Cg6hBcXj4UIUa +UeKmywvJBtcnmRVFoqigvO/hFkE4GYgboVJEk67zX9JkEX272A4gOsEk0/o8NwK HSmdAPUJICEFv9xehf6hZ6OrKoxr5CgcBxYxQuNk3gwuz0KCDDFNsQ/1IBfQF8Hj 6PFOOkz7UDV2FKD9u5WpDoW6f7ccZn5ObTHt4AAbngQp6WSXqmige3bB8l6iHB+8 uIdgQDqoad9UGLzRMAtU =6vFC -----END PGP SIGNATURE----- --=_HNo1qBiWgvcf_L5sQpvCu0i-- From owner-svn-src-all@freebsd.org Sat Nov 9 21:59:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D91217E68E; Sat, 9 Nov 2019 21:59:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479WJL1FFGz4CNx; Sat, 9 Nov 2019 21:59:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E47C1D1F1; Sat, 9 Nov 2019 21:59:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA9LxTEK051747; Sat, 9 Nov 2019 21:59:29 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA9LxTVF051745; Sat, 9 Nov 2019 21:59:29 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201911092159.xA9LxTVF051745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 9 Nov 2019 21:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354572 - head/lib/libipsec X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/lib/libipsec X-SVN-Commit-Revision: 354572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 21:59:30 -0000 Author: bz Date: Sat Nov 9 21:59:29 2019 New Revision: 354572 URL: https://svnweb.freebsd.org/changeset/base/354572 Log: libipsec: correct a typo Correct a typo in the ipsec_errlist and replicated in a comment. No functional changes. MFC after: 3 weeks Modified: head/lib/libipsec/ipsec_strerror.c head/lib/libipsec/ipsec_strerror.h Modified: head/lib/libipsec/ipsec_strerror.c ============================================================================== --- head/lib/libipsec/ipsec_strerror.c Sat Nov 9 17:30:19 2019 (r354571) +++ head/lib/libipsec/ipsec_strerror.c Sat Nov 9 21:59:29 2019 (r354572) @@ -62,7 +62,7 @@ static const char *ipsec_errlist[] = { "Invalid key length", /*EIPSEC_INVAL_KEYLEN*/ "Invalid address family", /*EIPSEC_INVAL_FAMILY*/ "Invalid prefix length", /*EIPSEC_INVAL_PREFIXLEN*/ -"Invalid direciton", /*EIPSEC_INVAL_DIR*/ +"Invalid direction", /*EIPSEC_INVAL_DIR*/ "SPI range violation", /*EIPSEC_INVAL_SPI*/ "No protocol specified", /*EIPSEC_NO_PROTO*/ "No algorithm specified", /*EIPSEC_NO_ALGS*/ Modified: head/lib/libipsec/ipsec_strerror.h ============================================================================== --- head/lib/libipsec/ipsec_strerror.h Sat Nov 9 17:30:19 2019 (r354571) +++ head/lib/libipsec/ipsec_strerror.h Sat Nov 9 21:59:29 2019 (r354572) @@ -52,7 +52,7 @@ extern void __ipsec_set_strerror(const char *); #define EIPSEC_INVAL_KEYLEN 14 /*invalid key length*/ #define EIPSEC_INVAL_FAMILY 15 /*invalid address family*/ #define EIPSEC_INVAL_PREFIXLEN 16 /*SPI range violation*/ -#define EIPSEC_INVAL_DIR 17 /*Invalid direciton*/ +#define EIPSEC_INVAL_DIR 17 /*Invalid direction*/ #define EIPSEC_INVAL_SPI 18 /*invalid prefixlen*/ #define EIPSEC_NO_PROTO 19 /*no protocol specified*/ #define EIPSEC_NO_ALGS 20 /*No algorithm specified*/ From owner-svn-src-all@freebsd.org Sat Nov 9 22:25:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81F2D17F3A7; Sat, 9 Nov 2019 22:25:46 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479Wtf2LLsz4Flk; Sat, 9 Nov 2019 22:25:46 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F9781D751; Sat, 9 Nov 2019 22:25:46 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA9MPkUR071153; Sat, 9 Nov 2019 22:25:46 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA9MPkxg071152; Sat, 9 Nov 2019 22:25:46 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201911092225.xA9MPkxg071152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 9 Nov 2019 22:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354573 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 354573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2019 22:25:46 -0000 Author: manu Date: Sat Nov 9 22:25:45 2019 New Revision: 354573 URL: https://svnweb.freebsd.org/changeset/base/354573 Log: generic_ehci_fdt: Fix compile when EXT_RESOURCES isn't present Modified: head/sys/dev/usb/controller/generic_ehci_fdt.c Modified: head/sys/dev/usb/controller/generic_ehci_fdt.c ============================================================================== --- head/sys/dev/usb/controller/generic_ehci_fdt.c Sat Nov 9 21:59:29 2019 (r354572) +++ head/sys/dev/usb/controller/generic_ehci_fdt.c Sat Nov 9 22:25:45 2019 (r354573) @@ -114,6 +114,7 @@ generic_ehci_fdt_probe(device_t self) static int generic_ehci_fdt_attach(device_t dev) { + int err; #ifdef EXT_RESOURCES struct generic_ehci_fdt_softc *sc; struct clk_list *clkp; @@ -122,7 +123,7 @@ generic_ehci_fdt_attach(device_t dev) hwreset_t rst; struct phy_list *phyp; phy_t phy; - int err, off; + int off; sc = device_get_softc(dev);