From owner-dev-commits-src-main@freebsd.org Mon Sep 13 04:11:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90B8D674824; Mon, 13 Sep 2021 04:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Chy3RVXz4S1S; Mon, 13 Sep 2021 04:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58002200CC; Mon, 13 Sep 2021 04:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D4BUJR004806; Mon, 13 Sep 2021 04:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D4BUs3004805; Mon, 13 Sep 2021 04:11:30 GMT (envelope-from git) Date: Mon, 13 Sep 2021 04:11:30 GMT Message-Id: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 6fa041d7f125 - main - Measure latency of PMC interruptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fa041d7f125db65f400af7f520a41ff78d19cd7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 04:11:30 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=6fa041d7f125db65f400af7f520a41ff78d19cd7 commit 6fa041d7f125db65f400af7f520a41ff78d19cd7 Author: Wojciech Macek AuthorDate: 2021-09-13 04:08:32 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 04:08:32 +0000 Measure latency of PMC interruptions Add HWPMC events to measure latency. Provide sysctl to choose the number of outstanding events which trigger HWPMC event. Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D31283 --- sys/kern/kern_intr.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 1660414a50ef..19401877dfbd 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_hwpmc_hooks.h" #include "opt_kstack_usage_prof.h" #include @@ -75,6 +76,7 @@ struct intr_thread { struct thread *it_thread; /* Kernel thread. */ int it_flags; /* (j) IT_* flags. */ int it_need; /* Needs service. */ + int it_waiting; /* Waiting in the runq. */ }; /* Interrupt thread flags kept in it_flags */ @@ -100,13 +102,19 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, CTLFLAG_RWTUN, static int intr_epoch_batch = 1000; SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, &intr_epoch_batch, 0, "Maximum interrupt handler executions without re-entering epoch(9)"); +#ifdef HWPMC_HOOKS +static int intr_hwpmc_waiting_report_threshold = 1; +SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, CTLFLAG_RWTUN, + &intr_hwpmc_waiting_report_threshold, 1, + "Threshold for reporting number of events in a workq"); +#endif static TAILQ_HEAD(, intr_event) event_list = TAILQ_HEAD_INITIALIZER(event_list); static struct mtx event_lock; MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF); static void intr_event_update(struct intr_event *ie); -static int intr_event_schedule_thread(struct intr_event *ie); +static int intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame); static struct intr_thread *ithread_create(const char *name); static void ithread_destroy(struct intr_thread *ithread); static void ithread_execute_handlers(struct proc *p, @@ -115,6 +123,16 @@ static void ithread_loop(void *); static void ithread_update(struct intr_thread *ithd); static void start_softintr(void *); +#ifdef HWPMC_HOOKS +#include +PMC_SOFT_DEFINE( , , intr, all); +PMC_SOFT_DEFINE( , , intr, ithread); +PMC_SOFT_DEFINE( , , intr, filter); +PMC_SOFT_DEFINE( , , intr, stray); +PMC_SOFT_DEFINE( , , intr, schedule); +PMC_SOFT_DEFINE( , , intr, waiting); +#endif + /* Map an interrupt type to an ithread priority. */ u_char intr_priority(enum intr_type flags) @@ -773,7 +791,7 @@ intr_handler_barrier(struct intr_handler *handler) } if ((handler->ih_flags & IH_CHANGED) == 0) { handler->ih_flags |= IH_CHANGED; - intr_event_schedule_thread(ie); + intr_event_schedule_thread(ie, NULL); } while ((handler->ih_flags & IH_CHANGED) != 0) msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); @@ -872,7 +890,7 @@ intr_event_remove_handler(void *cookie) KASSERT((handler->ih_flags & IH_DEAD) == 0, ("duplicate handle remove")); handler->ih_flags |= IH_DEAD; - intr_event_schedule_thread(ie); + intr_event_schedule_thread(ie, NULL); while (handler->ih_flags & IH_DEAD) msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0); intr_event_update(ie); @@ -944,7 +962,7 @@ intr_event_resume_handler(void *cookie) } static int -intr_event_schedule_thread(struct intr_event *ie) +intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) { struct intr_entropy entropy; struct intr_thread *it; @@ -986,11 +1004,28 @@ intr_event_schedule_thread(struct intr_event *ie) atomic_store_rel_int(&it->it_need, 1); thread_lock(td); if (TD_AWAITING_INTR(td)) { +#ifdef HWPMC_HOOKS + atomic_set_int(&it->it_waiting, 0); + if (frame != NULL) + PMC_SOFT_CALL_TF( , , intr, schedule, frame); + else + PMC_SOFT_CALL( , , intr, schedule); +#endif CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid, td->td_name); TD_CLR_IWAIT(td); sched_add(td, SRQ_INTR); } else { +#ifdef HWPMC_HOOKS + atomic_add_int(&it->it_waiting, 1); + + if (atomic_load_int(&it->it_waiting) >= intr_hwpmc_waiting_report_threshold) { + if (frame != NULL) + PMC_SOFT_CALL_TF( , , intr, waiting, frame); + else + PMC_SOFT_CALL( , , intr, waiting); + } +#endif CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", __func__, td->td_proc->p_pid, td->td_name, it->it_need, TD_GET_STATE(td)); thread_unlock(td); @@ -1083,7 +1118,7 @@ swi_sched(void *cookie, int flags) #endif } else { VM_CNT_INC(v_soft); - error = intr_event_schedule_thread(ie); + error = intr_event_schedule_thread(ie, NULL); KASSERT(error == 0, ("stray software interrupt")); } } @@ -1374,12 +1409,23 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame) ret = ih->ih_filter(frame); else ret = ih->ih_filter(ih->ih_argument); +#ifdef HWPMC_HOOKS + PMC_SOFT_CALL_TF( , , intr, all, frame); +#endif KASSERT(ret == FILTER_STRAY || ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), ("%s: incorrect return value %#x from %s", __func__, ret, ih->ih_name)); filter = filter || ret == FILTER_HANDLED; +#ifdef HWPMC_HOOKS + if (ret & FILTER_SCHEDULE_THREAD) + PMC_SOFT_CALL_TF( , , intr, ithread, frame); + else if (ret & FILTER_HANDLED) + PMC_SOFT_CALL_TF( , , intr, filter, frame); + else if (ret == FILTER_STRAY) + PMC_SOFT_CALL_TF( , , intr, stray, frame); +#endif /* * Wrapper handler special handling: @@ -1416,7 +1462,7 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame) if (thread) { int error __unused; - error = intr_event_schedule_thread(ie); + error = intr_event_schedule_thread(ie, frame); KASSERT(error == 0, ("bad stray interrupt")); } critical_exit(); From owner-dev-commits-src-main@freebsd.org Mon Sep 13 08:01:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D14367752A; Mon, 13 Sep 2021 08:01:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Jpb1WBdz4YQj; Mon, 13 Sep 2021 08:01:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12a.google.com with SMTP id h16so19229963lfk.10; Mon, 13 Sep 2021 01:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WxhzR+ifsHB2h6NyocYKbhdgVzU8llJQ+Y24f2h6pH4=; b=AbBrtdIA1xoAB5OxFLITaBTi5a6SmalHEKUVeG2270RDwiD+TqJhlS5M6JWL/nEeiD IyIOQ7z1hxnQEJMe/noVlQMA1XiViyNnxWaOUF8iiZHWaF+FjFlNYQRyjI6JCZB2hVWQ XPSFGkATEmy6iiZkGbsilzzfxLChvUuF/f6Kclc+UijjPNdnK6kqgAhfa6wsiJbaF5aZ YvuRammobK7RWFU/jyThd7dwapvvhHROLDFwchKDAJp5kr16Ux6Na+MAMuvhCUuQvtOK FCuuJnWDZHGFIgCc3SE/4o8sH/0JnzK1kRlz4mWYXvxHT52PTj2WIp6l849OX73tdQDg eyJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WxhzR+ifsHB2h6NyocYKbhdgVzU8llJQ+Y24f2h6pH4=; b=w8AEFoqTneePDJMR9leP3yi3SWCHKypno4qIjcAYoEGPSsLAc3Xi1VBDR9EM9cEa/C VAgBzq78KkXaK8bazRdYt8OlFJfbKktauHScrNW9rPqezMDuFwDd2JA5w034ZNvF8KF1 FEOY7AI9JFoV2jKiz90StFL/eAOfMtYJvO/XwWrROBkvvt+8bZhv1mGbO5XTm6ld4VAZ TZrzFtSo7Jw8TXDAUZsvlkAYEHo03H9evbwH6cu9G0ZSTaEg8w31ctlQhp+dOOS0i6Zo HHJgtIHL9GTDTVKoK7r4F3XspofZDn28DAWdoBLN30bfDbx5tPdza0kHUy0AUCGEND2g 2puQ== X-Gm-Message-State: AOAM532tBIauOr2AgDFO7lfM7VPjLg7EdDZwu9HMMkbk+GHa7vwPM6Fg vtfbtDVHWqwnxssTor5/t7cWQgerAuJdN4v+HGuYb7h/ X-Google-Smtp-Source: ABdhPJxt+3Kwn4jnKWza/PUdusakBPWE8sHsTcZoHk+9dPHJ0BEa3N2tJqE/zWMtWa92DjeXs1dy+gkC+SEUI/0YUro= X-Received: by 2002:a05:6512:1296:: with SMTP id u22mr7876016lfs.650.1631520101842; Mon, 13 Sep 2021 01:01:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:6f04:0:0:0:0:0 with HTTP; Mon, 13 Sep 2021 01:01:41 -0700 (PDT) In-Reply-To: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> References: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> From: Mateusz Guzik Date: Mon, 13 Sep 2021 10:01:41 +0200 Message-ID: Subject: Re: git: 6fa041d7f125 - main - Measure latency of PMC interruptions To: Wojciech Macek Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H7Jpb1WBdz4YQj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 08:01:43 -0000 On 9/13/21, Wojciech Macek wrote: > The branch main has been updated by wma: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=6fa041d7f125db65f400af7f520a41ff78d19cd7 > > commit 6fa041d7f125db65f400af7f520a41ff78d19cd7 > Author: Wojciech Macek > AuthorDate: 2021-09-13 04:08:32 +0000 > Commit: Wojciech Macek > CommitDate: 2021-09-13 04:08:32 +0000 > > Measure latency of PMC interruptions > > Add HWPMC events to measure latency. > Provide sysctl to choose the number of outstanding events which > trigger HWPMC event. > > Obtained from: Semihalf > Sponsored by: Stormshield > Differential revision: https://reviews.freebsd.org/D31283 > --- > sys/kern/kern_intr.c | 58 > ++++++++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 52 insertions(+), 6 deletions(-) > > diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c > index 1660414a50ef..19401877dfbd 100644 > --- a/sys/kern/kern_intr.c > +++ b/sys/kern/kern_intr.c > @@ -30,6 +30,7 @@ > __FBSDID("$FreeBSD$"); > > #include "opt_ddb.h" > +#include "opt_hwpmc_hooks.h" > #include "opt_kstack_usage_prof.h" > > #include > @@ -75,6 +76,7 @@ struct intr_thread { > struct thread *it_thread; /* Kernel thread. */ > int it_flags; /* (j) IT_* flags. */ > int it_need; /* Needs service. */ > + int it_waiting; /* Waiting in the runq. */ > }; > > /* Interrupt thread flags kept in it_flags */ > @@ -100,13 +102,19 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, > CTLFLAG_RWTUN, > static int intr_epoch_batch = 1000; > SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, > &intr_epoch_batch, > 0, "Maximum interrupt handler executions without re-entering > epoch(9)"); > +#ifdef HWPMC_HOOKS > +static int intr_hwpmc_waiting_report_threshold = 1; > +SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, > CTLFLAG_RWTUN, > + &intr_hwpmc_waiting_report_threshold, 1, > + "Threshold for reporting number of events in a workq"); > +#endif > static TAILQ_HEAD(, intr_event) event_list = > TAILQ_HEAD_INITIALIZER(event_list); > static struct mtx event_lock; > MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF); > > static void intr_event_update(struct intr_event *ie); > -static int intr_event_schedule_thread(struct intr_event *ie); > +static int intr_event_schedule_thread(struct intr_event *ie, struct > trapframe *frame); > static struct intr_thread *ithread_create(const char *name); > static void ithread_destroy(struct intr_thread *ithread); > static void ithread_execute_handlers(struct proc *p, > @@ -115,6 +123,16 @@ static void ithread_loop(void *); > static void ithread_update(struct intr_thread *ithd); > static void start_softintr(void *); > > +#ifdef HWPMC_HOOKS > +#include > +PMC_SOFT_DEFINE( , , intr, all); > +PMC_SOFT_DEFINE( , , intr, ithread); > +PMC_SOFT_DEFINE( , , intr, filter); > +PMC_SOFT_DEFINE( , , intr, stray); > +PMC_SOFT_DEFINE( , , intr, schedule); > +PMC_SOFT_DEFINE( , , intr, waiting); > +#endif > + > /* Map an interrupt type to an ithread priority. */ > u_char > intr_priority(enum intr_type flags) > @@ -773,7 +791,7 @@ intr_handler_barrier(struct intr_handler *handler) > } > if ((handler->ih_flags & IH_CHANGED) == 0) { > handler->ih_flags |= IH_CHANGED; > - intr_event_schedule_thread(ie); > + intr_event_schedule_thread(ie, NULL); > } > while ((handler->ih_flags & IH_CHANGED) != 0) > msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); > @@ -872,7 +890,7 @@ intr_event_remove_handler(void *cookie) > KASSERT((handler->ih_flags & IH_DEAD) == 0, > ("duplicate handle remove")); > handler->ih_flags |= IH_DEAD; > - intr_event_schedule_thread(ie); > + intr_event_schedule_thread(ie, NULL); > while (handler->ih_flags & IH_DEAD) > msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0); > intr_event_update(ie); > @@ -944,7 +962,7 @@ intr_event_resume_handler(void *cookie) > } > > static int > -intr_event_schedule_thread(struct intr_event *ie) > +intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) > { > struct intr_entropy entropy; > struct intr_thread *it; > @@ -986,11 +1004,28 @@ intr_event_schedule_thread(struct intr_event *ie) > atomic_store_rel_int(&it->it_need, 1); > thread_lock(td); > if (TD_AWAITING_INTR(td)) { > +#ifdef HWPMC_HOOKS > + atomic_set_int(&it->it_waiting, 0); atomic_set does not assign the passed value, it or's it. > + if (frame != NULL) > + PMC_SOFT_CALL_TF( , , intr, schedule, frame); > + else > + PMC_SOFT_CALL( , , intr, schedule); > +#endif > CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid, > td->td_name); > TD_CLR_IWAIT(td); > sched_add(td, SRQ_INTR); > } else { > +#ifdef HWPMC_HOOKS > + atomic_add_int(&it->it_waiting, 1); Why is this using atomics to begin with? To my reading the field is de facto protected by thread lock, so you can just it->it_waiting++ > + > + if (atomic_load_int(&it->it_waiting) >= > intr_hwpmc_waiting_report_threshold) { The option is enabled by default but hwpmc itself is rarely loaded. Then this avoidable loads intr_hwpmc_waiting_report_threshold to begin with. Instead you can do something in the lines: #define PMC_HOOK_INSTALLED_ANY() __predict_false(pmc_hook != NULL) and use that to guard the other branches. Later on this will be hot patchable so it wont be a problem by default. > + if (frame != NULL) > + PMC_SOFT_CALL_TF( , , intr, waiting, frame); > + else > + PMC_SOFT_CALL( , , intr, waiting); > + } > +#endif > CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", > __func__, td->td_proc->p_pid, td->td_name, it->it_need, > TD_GET_STATE(td)); > thread_unlock(td); > @@ -1083,7 +1118,7 @@ swi_sched(void *cookie, int flags) > #endif > } else { > VM_CNT_INC(v_soft); > - error = intr_event_schedule_thread(ie); > + error = intr_event_schedule_thread(ie, NULL); > KASSERT(error == 0, ("stray software interrupt")); > } > } > @@ -1374,12 +1409,23 @@ intr_event_handle(struct intr_event *ie, struct > trapframe *frame) > ret = ih->ih_filter(frame); > else > ret = ih->ih_filter(ih->ih_argument); > +#ifdef HWPMC_HOOKS > + PMC_SOFT_CALL_TF( , , intr, all, frame); > +#endif > KASSERT(ret == FILTER_STRAY || > ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && > (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), > ("%s: incorrect return value %#x from %s", __func__, ret, > ih->ih_name)); > filter = filter || ret == FILTER_HANDLED; > +#ifdef HWPMC_HOOKS > + if (ret & FILTER_SCHEDULE_THREAD) > + PMC_SOFT_CALL_TF( , , intr, ithread, frame); > + else if (ret & FILTER_HANDLED) > + PMC_SOFT_CALL_TF( , , intr, filter, frame); > + else if (ret == FILTER_STRAY) > + PMC_SOFT_CALL_TF( , , intr, stray, frame); > +#endif > > /* > * Wrapper handler special handling: > @@ -1416,7 +1462,7 @@ intr_event_handle(struct intr_event *ie, struct > trapframe *frame) > if (thread) { > int error __unused; > > - error = intr_event_schedule_thread(ie); > + error = intr_event_schedule_thread(ie, frame); > KASSERT(error == 0, ("bad stray interrupt")); > } > critical_exit(); > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Mon Sep 13 08:01:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E16C677456; Mon, 13 Sep 2021 08:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Jpk2CXbz4YQv; Mon, 13 Sep 2021 08:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DC2F237EA; Mon, 13 Sep 2021 08:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D81oA2012721; Mon, 13 Sep 2021 08:01:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D81odG012720; Mon, 13 Sep 2021 08:01:50 GMT (envelope-from git) Date: Mon, 13 Sep 2021 08:01:50 GMT Message-Id: <202109130801.18D81odG012720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: d00c1f7f2f4a - main - sdhci: add sysctls to dump sdhci registers and capabilites MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d00c1f7f2f4a811d5c756cbb0d585c56661839f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 08:01:50 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d00c1f7f2f4a811d5c756cbb0d585c56661839f7 commit d00c1f7f2f4a811d5c756cbb0d585c56661839f7 Author: Bartlomiej Grzesik AuthorDate: 2021-09-13 08:00:25 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 08:00:25 +0000 sdhci: add sysctls to dump sdhci registers and capabilites Add sysctls dev.sdhci.X.slotY.dumpregs and dev.sdhci.X.slotY.dumpcaps which dumps sdhci registers or capabilities. Obtained from: Semihalf Reviewed by: mw Differential revision: https://reviews.freebsd.org/D31406 --- sys/dev/sdhci/sdhci.c | 223 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 165 insertions(+), 58 deletions(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 573e6949b57e..09df5e972ab6 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -134,11 +135,18 @@ static int sdhci_cam_update_ios(struct sdhci_slot *slot); /* helper routines */ static int sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps); static void sdhci_dma_free(struct sdhci_slot *slot); +static void sdhci_dumpcaps(struct sdhci_slot *slot); +static void sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s); static void sdhci_dumpregs(struct sdhci_slot *slot); +static void sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s); +static int sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS); +static int sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS); static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static int slot_printf(const struct sdhci_slot *slot, const char * fmt, ...) __printflike(2, 3); +static int slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, + const char * fmt, ...) __printflike(3, 4); static uint32_t sdhci_tuning_intmask(const struct sdhci_slot *slot); #define SDHCI_LOCK(_slot) mtx_lock(&(_slot)->mtx) @@ -202,40 +210,156 @@ slot_printf(const struct sdhci_slot *slot, const char * fmt, ...) return (retval); } -static void -sdhci_dumpregs(struct sdhci_slot *slot) +static int +slot_sprintf(const struct sdhci_slot *slot, struct sbuf *s, + const char * fmt, ...) { + va_list ap; + int retval; - slot_printf(slot, - "============== REGISTER DUMP ==============\n"); + retval = sbuf_printf(s, "%s-slot%d: ", device_get_nameunit(slot->bus), slot->num); - slot_printf(slot, "Sys addr: 0x%08x | Version: 0x%08x\n", + va_start(ap, fmt); + retval += sbuf_vprintf(s, fmt, ap); + va_end(ap); + + return (retval); +} + +static void +sdhci_dumpregs_buf(struct sdhci_slot *slot, struct sbuf *s) +{ + slot_sprintf(slot, s, "============== REGISTER DUMP ==============\n"); + + slot_sprintf(slot, s, "Sys addr: 0x%08x | Version: 0x%08x\n", RD4(slot, SDHCI_DMA_ADDRESS), RD2(slot, SDHCI_HOST_VERSION)); - slot_printf(slot, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", + slot_sprintf(slot, s, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", RD2(slot, SDHCI_BLOCK_SIZE), RD2(slot, SDHCI_BLOCK_COUNT)); - slot_printf(slot, "Argument: 0x%08x | Trn mode: 0x%08x\n", + slot_sprintf(slot, s, "Argument: 0x%08x | Trn mode: 0x%08x\n", RD4(slot, SDHCI_ARGUMENT), RD2(slot, SDHCI_TRANSFER_MODE)); - slot_printf(slot, "Present: 0x%08x | Host ctl: 0x%08x\n", + slot_sprintf(slot, s, "Present: 0x%08x | Host ctl: 0x%08x\n", RD4(slot, SDHCI_PRESENT_STATE), RD1(slot, SDHCI_HOST_CONTROL)); - slot_printf(slot, "Power: 0x%08x | Blk gap: 0x%08x\n", + slot_sprintf(slot, s, "Power: 0x%08x | Blk gap: 0x%08x\n", RD1(slot, SDHCI_POWER_CONTROL), RD1(slot, SDHCI_BLOCK_GAP_CONTROL)); - slot_printf(slot, "Wake-up: 0x%08x | Clock: 0x%08x\n", + slot_sprintf(slot, s, "Wake-up: 0x%08x | Clock: 0x%08x\n", RD1(slot, SDHCI_WAKE_UP_CONTROL), RD2(slot, SDHCI_CLOCK_CONTROL)); - slot_printf(slot, "Timeout: 0x%08x | Int stat: 0x%08x\n", + slot_sprintf(slot, s, "Timeout: 0x%08x | Int stat: 0x%08x\n", RD1(slot, SDHCI_TIMEOUT_CONTROL), RD4(slot, SDHCI_INT_STATUS)); - slot_printf(slot, "Int enab: 0x%08x | Sig enab: 0x%08x\n", + slot_sprintf(slot, s, "Int enab: 0x%08x | Sig enab: 0x%08x\n", RD4(slot, SDHCI_INT_ENABLE), RD4(slot, SDHCI_SIGNAL_ENABLE)); - slot_printf(slot, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", + slot_sprintf(slot, s, "AC12 err: 0x%08x | Host ctl2:0x%08x\n", RD2(slot, SDHCI_ACMD12_ERR), RD2(slot, SDHCI_HOST_CONTROL2)); - slot_printf(slot, "Caps: 0x%08x | Caps2: 0x%08x\n", + slot_sprintf(slot, s, "Caps: 0x%08x | Caps2: 0x%08x\n", RD4(slot, SDHCI_CAPABILITIES), RD4(slot, SDHCI_CAPABILITIES2)); - slot_printf(slot, "Max curr: 0x%08x | ADMA err: 0x%08x\n", + slot_sprintf(slot, s, "Max curr: 0x%08x | ADMA err: 0x%08x\n", RD4(slot, SDHCI_MAX_CURRENT), RD1(slot, SDHCI_ADMA_ERR)); - slot_printf(slot, "ADMA addr:0x%08x | Slot int: 0x%08x\n", + slot_sprintf(slot, s, "ADMA addr:0x%08x | Slot int: 0x%08x\n", RD4(slot, SDHCI_ADMA_ADDRESS_LO), RD2(slot, SDHCI_SLOT_INT_STATUS)); - slot_printf(slot, - "===========================================\n"); + slot_sprintf(slot, s, "===========================================\n"); +} + +static void +sdhci_dumpregs(struct sdhci_slot *slot) +{ + struct sbuf s; + + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); + sdhci_dumpregs_buf(slot, &s); + sbuf_finish(&s); + sbuf_delete(&s); +} + +static int +sdhci_syctl_dumpregs(SYSCTL_HANDLER_ARGS) +{ + struct sdhci_slot *slot = arg1; + struct sbuf s; + + sbuf_new_for_sysctl(&s, NULL, 1024, req); + sbuf_putc(&s, '\n'); + sdhci_dumpregs_buf(slot, &s); + sbuf_finish(&s); + sbuf_delete(&s); + + return (0); +} + +static void +sdhci_dumpcaps_buf(struct sdhci_slot *slot, struct sbuf *s) +{ + int host_caps = slot->host.caps; + int caps = slot->caps; + + slot_sprintf(slot, s, + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", + slot->max_clk / 1000000, + (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", + (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : + ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), + (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", + (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", + ((caps & SDHCI_CAN_VDD_180) && + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", + (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", + (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", + (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", + (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", + (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : + "removable"); + if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | + MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) + slot_sprintf(slot, s, "eMMC:%s%s%s%s\n", + (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", + (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", + (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", + ((host_caps & + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == + (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? + " HS400ES" : ""); + if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) + slot_sprintf(slot, s, "UHS-I:%s%s%s%s%s\n", + (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", + (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", + (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", + (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", + (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); + if (slot->opt & SDHCI_TUNING_SUPPORTED) + slot_sprintf(slot, s, + "Re-tuning count %d secs, mode %d\n", + slot->retune_count, slot->retune_mode + 1); +} + +static void +sdhci_dumpcaps(struct sdhci_slot *slot) +{ + struct sbuf s; + + sbuf_new(&s, NULL, 1024, SBUF_AUTOEXTEND); + sbuf_set_drain(&s, &sbuf_printf_drain, NULL); + sdhci_dumpcaps_buf(slot, &s); + sbuf_finish(&s); + sbuf_delete(&s); +} + +static int +sdhci_syctl_dumpcaps(SYSCTL_HANDLER_ARGS) +{ + struct sdhci_slot *slot = arg1; + struct sbuf s; + + sbuf_new_for_sysctl(&s, NULL, 1024, req); + sbuf_putc(&s, '\n'); + sdhci_dumpcaps_buf(slot, &s); + sbuf_finish(&s); + sbuf_delete(&s); + + return (0); } static void @@ -799,6 +923,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) kobj_method_t *kobj_method; uint32_t caps, caps2, freq, host_caps; int err; + char node_name[8]; + struct sysctl_oid *node_oid; SDHCI_LOCK_INIT(slot); @@ -1047,46 +1173,7 @@ no_tuning: } if (bootverbose || sdhci_debug) { - slot_printf(slot, - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", - slot->max_clk / 1000000, - (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", - (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : - ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), - (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", - (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", - ((caps & SDHCI_CAN_VDD_180) && - (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", - (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", - (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", - (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", - (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", - (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", - (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : - (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : - "removable"); - if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | - MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) - slot_printf(slot, "eMMC:%s%s%s%s\n", - (host_caps & MMC_CAP_MMC_DDR52) ? " DDR52" : "", - (host_caps & MMC_CAP_MMC_HS200) ? " HS200" : "", - (host_caps & MMC_CAP_MMC_HS400) ? " HS400" : "", - ((host_caps & - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) == - (MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) ? - " HS400ES" : ""); - if (host_caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | - MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104)) - slot_printf(slot, "UHS-I:%s%s%s%s%s\n", - (host_caps & MMC_CAP_UHS_SDR12) ? " SDR12" : "", - (host_caps & MMC_CAP_UHS_SDR25) ? " SDR25" : "", - (host_caps & MMC_CAP_UHS_SDR50) ? " SDR50" : "", - (host_caps & MMC_CAP_UHS_SDR104) ? " SDR104" : "", - (host_caps & MMC_CAP_UHS_DDR50) ? " DDR50" : ""); - if (slot->opt & SDHCI_TUNING_SUPPORTED) - slot_printf(slot, "Re-tuning count %d secs, mode %d\n", - slot->retune_count, slot->retune_mode + 1); + sdhci_dumpcaps(slot); sdhci_dumpregs(slot); } @@ -1110,6 +1197,26 @@ no_tuning: sdhci_init(slot); + snprintf(node_name, sizeof(node_name), "slot%d", slot->num); + + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, node_name, CTLFLAG_RW, 0, "slot specific node"); + + node_oid = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(node_oid), OID_AUTO, "debug", CTLFLAG_RW, 0, + "Debugging node"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), + OID_AUTO, "dumpregs", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + slot, 0, &sdhci_syctl_dumpregs, + "A", "Dump SDHCI registers"); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(node_oid), + OID_AUTO, "dumpcaps", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + slot, 0, &sdhci_syctl_dumpcaps, + "A", "Dump SDHCI capabilites"); + return (0); } From owner-dev-commits-src-main@freebsd.org Mon Sep 13 08:57:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 554A7677CDD; Mon, 13 Sep 2021 08:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7L2d1yHnz4p1Q; Mon, 13 Sep 2021 08:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22E5724456; Mon, 13 Sep 2021 08:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D8vDmO079374; Mon, 13 Sep 2021 08:57:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D8vDnb079373; Mon, 13 Sep 2021 08:57:13 GMT (envelope-from git) Date: Mon, 13 Sep 2021 08:57:13 GMT Message-Id: <202109130857.18D8vDnb079373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: ddd74e40e27d - main - stress2: Added missing unmount MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddd74e40e27db29494e9591b837c2a01b543ef80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 08:57:13 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=ddd74e40e27db29494e9591b837c2a01b543ef80 commit ddd74e40e27db29494e9591b837c2a01b543ef80 Author: Peter Holm AuthorDate: 2021-09-13 08:55:19 +0000 Commit: Peter Holm CommitDate: 2021-09-13 08:55:19 +0000 stress2: Added missing unmount --- tools/test/stress2/misc/unionfs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/test/stress2/misc/unionfs.sh b/tools/test/stress2/misc/unionfs.sh index dbf3ba0fbc2e..6e04e809b501 100755 --- a/tools/test/stress2/misc/unionfs.sh +++ b/tools/test/stress2/misc/unionfs.sh @@ -45,8 +45,10 @@ mount -t unionfs -o noatime $mntpoint /tmp export RUNDIR=/tmp/stressX export runRUNTIME=10m # Run tests for 10 minutes (cd ..; ./run.sh disk.cfg) +umount /tmp while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart rm -f $diskimage +exit 0 From owner-dev-commits-src-main@freebsd.org Mon Sep 13 08:57:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 992A4677C31; Mon, 13 Sep 2021 08:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7L2f2yXkz4p8S; Mon, 13 Sep 2021 08:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F859244E0; Mon, 13 Sep 2021 08:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D8vE6D079398; Mon, 13 Sep 2021 08:57:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D8vElp079397; Mon, 13 Sep 2021 08:57:14 GMT (envelope-from git) Date: Mon, 13 Sep 2021 08:57:14 GMT Message-Id: <202109130857.18D8vElp079397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 89379af43f11 - main - stress2: Update test to the sysctl 'vfs.lookup_shared' being removed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89379af43f110243788ee1bd63506223d5858c0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 08:57:14 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=89379af43f110243788ee1bd63506223d5858c0b commit 89379af43f110243788ee1bd63506223d5858c0b Author: Peter Holm AuthorDate: 2021-09-13 08:56:06 +0000 Commit: Peter Holm CommitDate: 2021-09-13 08:56:06 +0000 stress2: Update test to the sysctl 'vfs.lookup_shared' being removed --- tools/test/stress2/misc/unionfs2.sh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/tools/test/stress2/misc/unionfs2.sh b/tools/test/stress2/misc/unionfs2.sh index 7af786ae9ce4..29e1847714c8 100755 --- a/tools/test/stress2/misc/unionfs2.sh +++ b/tools/test/stress2/misc/unionfs2.sh @@ -28,19 +28,15 @@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 -saved=`sysctl vfs.lookup_shared | awk '{print $NF}'` -for i in 1 0; do - sysctl vfs.lookup_shared=$i - [ -d /var/tmp/unionfs ] || mkdir -p /var/tmp/unionfs - mount_unionfs /var/tmp/unionfs /tmp/stressX +[ -d /var/tmp/unionfs ] || mkdir -p /var/tmp/unionfs +mount_unionfs /var/tmp/unionfs /tmp/stressX - export RUNDIR=/var/tmp/unionfs/stressX - export runRUNTIME=10m # Run tests for 10 minutes - (cd ..; ./run.sh disk.cfg) - false - while mount | grep -q /unionfs; do - umount /tmp/stressX > /dev/null 2>&1 - done - rm -rf /var/tmp/unionfs +export RUNDIR=/var/tmp/unionfs/stressX +export runRUNTIME=10m # Run tests for 10 minutes +(cd ..; ./run.sh disk.cfg) +false +while mount | grep -q /unionfs; do + umount /tmp/stressX > /dev/null 2>&1 done -sysctl vfs.lookup_shared=$saved +rm -rf /var/tmp/unionfs +exit 0 From owner-dev-commits-src-main@freebsd.org Mon Sep 13 09:33:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19FCF67852D; Mon, 13 Sep 2021 09:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7LrQ74nHz3DVD; Mon, 13 Sep 2021 09:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D342C24BA5; Mon, 13 Sep 2021 09:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D9XQiT032485; Mon, 13 Sep 2021 09:33:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D9XQqg032484; Mon, 13 Sep 2021 09:33:26 GMT (envelope-from git) Date: Mon, 13 Sep 2021 09:33:26 GMT Message-Id: <202109130933.18D9XQqg032484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d7d962ead0b6 - main - Add a test for https://reviews.freebsd.org/D31858 (PR 258310) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7d962ead0b6e5e8a39202d0590022082bf5bfb6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 09:33:27 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d7d962ead0b6e5e8a39202d0590022082bf5bfb6 commit d7d962ead0b6e5e8a39202d0590022082bf5bfb6 Author: Alex Richardson AuthorDate: 2021-09-13 09:16:05 +0000 Commit: Alex Richardson CommitDate: 2021-09-13 09:16:05 +0000 Add a test for https://reviews.freebsd.org/D31858 (PR 258310) This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654) fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed as 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0) and passes with the patch applied. Reviewed By: kib, imp Differential Revision: https://reviews.freebsd.org/D31862 --- tests/sys/kqueue/Makefile | 2 + tests/sys/kqueue/kqueue_peek_signal.c | 106 ++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/tests/sys/kqueue/Makefile b/tests/sys/kqueue/Makefile index 40f892d36fbd..1bf13772f0f2 100644 --- a/tests/sys/kqueue/Makefile +++ b/tests/sys/kqueue/Makefile @@ -5,6 +5,8 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel/kqueue TESTSDIR= ${TESTSBASE}/sys/kqueue BINDIR= ${TESTSDIR} +ATF_TESTS_C+= kqueue_peek_signal + NETBSD_ATF_TESTS_C= proc1_test # XXX: fails `ke.fflags & NOTE_TRACKERR` invariant #NETBSD_ATF_TESTS_C+= proc2_test diff --git a/tests/sys/kqueue/kqueue_peek_signal.c b/tests/sys/kqueue/kqueue_peek_signal.c new file mode 100644 index 000000000000..16dbce68a57c --- /dev/null +++ b/tests/sys/kqueue/kqueue_peek_signal.c @@ -0,0 +1,106 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2021 Jan Kokemüller + * Copyright 2021 Alex Richardson + * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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 +#include + +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(main); + +ATF_TC_BODY(main, tc) +{ + int rv; + + sigset_t set; + rv = sigemptyset(&set); + ATF_REQUIRE_EQ(0, rv); + rv = sigaddset(&set, SIGUSR1); + ATF_REQUIRE_EQ(0, rv); + rv = sigprocmask(SIG_BLOCK, &set, NULL); + ATF_REQUIRE_EQ(0, rv); + + int skq = kqueue(); + ATF_REQUIRE(skq >= 0); + + struct kevent kev; + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_ADD, 0, 0, 0); + rv = kevent(skq, &kev, 1, NULL, 0, NULL); + ATF_REQUIRE_EQ(0, rv); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + EV_SET(&kev, skq, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + rv = kevent(kq, &kev, 1, NULL, 0, NULL); + ATF_REQUIRE_EQ(0, rv); + + /* + * It was previously not guaranteed that sending a signal to self would + * be immediately visible in the nested kqueue activation with a zero + * timeout. As of https://reviews.freebsd.org/D31858, the kqueue task + * queue will be processed in this case, so we are guaranteed to see the + * SIGUSR1 here even with a zero timeout. We run the code below in a + * loop to make it more likely that older kernels without the fix fail + * this test. + */ + for (int i = 0; i < 100; i++) { + rv = kill(getpid(), SIGUSR1); + ATF_REQUIRE_EQ(0, rv); + + rv = kevent(kq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_EQ_MSG(1, rv, + "Unexpected result %d from kevent() after %d iterations", + rv, i); + rv = kevent(kq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_EQ(0, rv); + + rv = kevent(skq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_EQ(1, rv); + rv = kevent(skq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_EQ(0, rv); + + siginfo_t siginfo; + rv = sigtimedwait(&set, &siginfo, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_EQ(SIGUSR1, rv); + + rv = sigtimedwait(&set, &siginfo, &(struct timespec) { 0, 0 }); + ATF_REQUIRE_ERRNO(EAGAIN, rv < 0); + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, main); + + return (atf_no_error()); +} From owner-dev-commits-src-main@freebsd.org Mon Sep 13 09:37:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BC00678247; Mon, 13 Sep 2021 09:37:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Lwz0HpZz3FPV; Mon, 13 Sep 2021 09:37:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEBC8249A8; Mon, 13 Sep 2021 09:37:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D9bMKO032882; Mon, 13 Sep 2021 09:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D9bMjp032881; Mon, 13 Sep 2021 09:37:22 GMT (envelope-from git) Date: Mon, 13 Sep 2021 09:37:22 GMT Message-Id: <202109130937.18D9bMjp032881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 1e1253510ab4 - main - e6000sw: Use taskqueue subsytem for MDIO polling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e1253510ab434484472ee2a4ce94426d18f3764 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 09:37:23 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=1e1253510ab434484472ee2a4ce94426d18f3764 commit 1e1253510ab434484472ee2a4ce94426d18f3764 Author: Hubert Mazur AuthorDate: 2021-09-13 09:35:51 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 09:37:11 +0000 e6000sw: Use taskqueue subsytem for MDIO polling Previosuly the link status was pooled in an infinite loop in a separate kproc. Use taskqueue subsytem instead. This is a prequisite for making this driver work as a loadable module. Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D31579 --- sys/dev/etherswitch/e6000sw/e6000sw.c | 65 ++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c index 4803e200e8fb..e6c76c578d14 100644 --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,7 +80,8 @@ typedef struct e6000sw_softc { struct ifnet *ifp[E6000SW_MAX_PORTS]; char *ifname[E6000SW_MAX_PORTS]; device_t miibus[E6000SW_MAX_PORTS]; - struct proc *kproc; + struct taskqueue *sc_tq; + struct timeout_task sc_tt; int vlans[E6000SW_NUM_VLANS]; uint32_t swid; @@ -127,7 +129,7 @@ static int e6000sw_setvgroup_wrapper(device_t, etherswitch_vlangroup_t *); static int e6000sw_setvgroup(device_t, etherswitch_vlangroup_t *); static int e6000sw_getvgroup(device_t, etherswitch_vlangroup_t *); static void e6000sw_setup(device_t, e6000sw_softc_t *); -static void e6000sw_tick(void *); +static void e6000sw_tick(void *, int); static void e6000sw_set_atustat(device_t, e6000sw_softc_t *, int, int); static int e6000sw_atu_flush(device_t, e6000sw_softc_t *, int); static int e6000sw_vtu_flush(e6000sw_softc_t *); @@ -450,8 +452,13 @@ e6000sw_attach(device_t dev) E6000SW_LOCK(sc); e6000sw_setup(dev, sc); - ports = ofw_bus_find_child(sc->node, "ports"); + sc->sc_tq = taskqueue_create("e6000sw_taskq", M_NOWAIT, + taskqueue_thread_enqueue, &sc->sc_tq); + + TIMEOUT_TASK_INIT(sc->sc_tq, &sc->sc_tt, 0, e6000sw_tick, sc); + taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", + device_get_nameunit(dev)); if (ports == 0) { device_printf(dev, "failed to parse DTS: no ports found for " @@ -544,7 +551,7 @@ e6000sw_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); - kproc_create(e6000sw_tick, sc, &sc->kproc, 0, 0, "e6000sw tick kproc"); + taskqueue_enqueue_timeout(sc->sc_tq, &sc->sc_tt, hz); return (0); @@ -711,6 +718,13 @@ e6000sw_detach(device_t dev) e6000sw_softc_t *sc; sc = device_get_softc(dev); + + if (device_is_attached(dev)) + taskqueue_drain_timeout(sc->sc_tq, &sc->sc_tt); + + if (sc->sc_tq != NULL) + taskqueue_free(sc->sc_tq); + bus_generic_detach(dev); sx_destroy(&sc->sx); for (phy = 0; phy < sc->num_ports; phy++) { @@ -1460,7 +1474,7 @@ e6000sw_update_ifmedia(uint16_t portstatus, u_int *media_status, u_int *media_ac } static void -e6000sw_tick(void *arg) +e6000sw_tick(void *arg, int p __unused) { e6000sw_softc_t *sc; struct mii_data *mii; @@ -1472,34 +1486,31 @@ e6000sw_tick(void *arg) E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); - for (;;) { - E6000SW_LOCK(sc); - for (port = 0; port < sc->num_ports; port++) { - /* Tick only on PHY ports */ - if (!e6000sw_is_portenabled(sc, port) || - !e6000sw_is_phyport(sc, port)) - continue; + E6000SW_LOCK(sc); + for (port = 0; port < sc->num_ports; port++) { + /* Tick only on PHY ports */ + if (!e6000sw_is_portenabled(sc, port) || + !e6000sw_is_phyport(sc, port)) + continue; - mii = e6000sw_miiforphy(sc, port); - if (mii == NULL) - continue; + mii = e6000sw_miiforphy(sc, port); + if (mii == NULL) + continue; - portstatus = e6000sw_readreg(sc, REG_PORT(sc, port), - PORT_STATUS); + portstatus = e6000sw_readreg(sc, REG_PORT(sc, port), + PORT_STATUS); - e6000sw_update_ifmedia(portstatus, - &mii->mii_media_status, &mii->mii_media_active); + e6000sw_update_ifmedia(portstatus, + &mii->mii_media_status, &mii->mii_media_active); - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { - if (IFM_INST(mii->mii_media.ifm_cur->ifm_media) - != miisc->mii_inst) - continue; - mii_phy_update(miisc, MII_POLLSTAT); - } + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + if (IFM_INST(mii->mii_media.ifm_cur->ifm_media) + != miisc->mii_inst) + continue; + mii_phy_update(miisc, MII_POLLSTAT); } - E6000SW_UNLOCK(sc); - pause("e6000sw tick", 1000); } + E6000SW_UNLOCK(sc); } static void From owner-dev-commits-src-main@freebsd.org Mon Sep 13 09:43:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC856678B06; Mon, 13 Sep 2021 09:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7M3b4mzjz3Gyn; Mon, 13 Sep 2021 09:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83B51249CC; Mon, 13 Sep 2021 09:43:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D9h7Cr045528; Mon, 13 Sep 2021 09:43:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D9h7ai045527; Mon, 13 Sep 2021 09:43:07 GMT (envelope-from git) Date: Mon, 13 Sep 2021 09:43:07 GMT Message-Id: <202109130943.18D9h7ai045527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: ee1b7811a3e1 - main - e6000sw: Build the driver as a kernel module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee1b7811a3e19633aad02eab8bc81eae2ccbd8af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 09:43:07 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=ee1b7811a3e19633aad02eab8bc81eae2ccbd8af commit ee1b7811a3e19633aad02eab8bc81eae2ccbd8af Author: Hubert Mazur AuthorDate: 2021-09-13 09:42:16 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 09:42:16 +0000 e6000sw: Build the driver as a kernel module Fix detach routine. Driver was tested on EspressoBin. Remove it from GENERIC, since now it can be loaded automatically. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31580 --- sys/arm64/conf/std.marvell | 1 - sys/dev/etherswitch/e6000sw/e6000sw.c | 75 ++++++++++++++--------------------- sys/modules/Makefile | 2 + sys/modules/e6000sw/Makefile | 10 +++++ 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/sys/arm64/conf/std.marvell b/sys/arm64/conf/std.marvell index d6437a426d48..cb49d8aedc2b 100644 --- a/sys/arm64/conf/std.marvell +++ b/sys/arm64/conf/std.marvell @@ -42,7 +42,6 @@ device neta # Marvell Armada 370/38x/XP/3700 NIC # Etherswitch devices device etherswitch # Enable etherswitch support device miiproxy # Required for etherswitch -device e6000sw # Marvell mv88e6085 based switches # USB support device ehci_mv # Marvell EHCI USB interface diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c index e6c76c578d14..68caf61f9358 100644 --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -122,8 +122,6 @@ static int e6000sw_setport(device_t, etherswitch_port_t *); static int e6000sw_set_vlan_mode(e6000sw_softc_t *, uint32_t); static int e6000sw_readreg_wrapper(device_t, int); static int e6000sw_writereg_wrapper(device_t, int, int); -static int e6000sw_readphy_wrapper(device_t, int, int); -static int e6000sw_writephy_wrapper(device_t, int, int, int); static int e6000sw_getvgroup_wrapper(device_t, etherswitch_vlangroup_t *); static int e6000sw_setvgroup_wrapper(device_t, etherswitch_vlangroup_t *); static int e6000sw_setvgroup(device_t, etherswitch_vlangroup_t *); @@ -174,8 +172,8 @@ static device_method_t e6000sw_methods[] = { DEVMETHOD(etherswitch_setport, e6000sw_setport), DEVMETHOD(etherswitch_readreg, e6000sw_readreg_wrapper), DEVMETHOD(etherswitch_writereg, e6000sw_writereg_wrapper), - DEVMETHOD(etherswitch_readphyreg, e6000sw_readphy_wrapper), - DEVMETHOD(etherswitch_writephyreg, e6000sw_writephy_wrapper), + DEVMETHOD(etherswitch_readphyreg, e6000sw_readphy), + DEVMETHOD(etherswitch_writephyreg, e6000sw_writephy), DEVMETHOD(etherswitch_setvgroup, e6000sw_setvgroup_wrapper), DEVMETHOD(etherswitch_getvgroup, e6000sw_getvgroup_wrapper), @@ -463,6 +461,7 @@ e6000sw_attach(device_t dev) if (ports == 0) { device_printf(dev, "failed to parse DTS: no ports found for " "switch\n"); + E6000SW_UNLOCK(sc); return (ENXIO); } @@ -531,11 +530,20 @@ e6000sw_attach(device_t dev) if (!e6000sw_is_phyport(sc, port)) continue; + /* + * It's necessary to unlock mutex, because e6000sw_attach_miibus + * calls functions, which try to lock mutex.That leads + * to recursive lock on non recursive mutex. + */ + E6000SW_UNLOCK(sc); + err = e6000sw_attach_miibus(sc, port); if (err != 0) { device_printf(sc->dev, "failed to attach miibus\n"); goto out_fail; } + + E6000SW_LOCK(sc); } etherswitch_info.es_nports = sc->num_ports; @@ -556,7 +564,6 @@ e6000sw_attach(device_t dev) return (0); out_fail: - E6000SW_UNLOCK(sc); e6000sw_detach(dev); return (err); @@ -661,14 +668,18 @@ e6000sw_readphy(device_t dev, int phy, int reg) uint32_t val; sc = device_get_softc(dev); + E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); + if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) { device_printf(dev, "Wrong register address.\n"); return (EINVAL); } - E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); + E6000SW_LOCK(sc); + if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); + E6000SW_UNLOCK(sc); return (ETIMEDOUT); } @@ -677,11 +688,14 @@ e6000sw_readphy(device_t dev, int phy, int reg) ((phy << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); + E6000SW_UNLOCK(sc); return (ETIMEDOUT); } val = e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG); + E6000SW_UNLOCK(sc); + return (val & PHY_DATA_MASK); } @@ -691,14 +705,18 @@ e6000sw_writephy(device_t dev, int phy, int reg, int data) e6000sw_softc_t *sc; sc = device_get_softc(dev); + E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); + if (!e6000sw_is_phyport(sc, phy) || reg >= E6000SW_NUM_PHY_REGS) { device_printf(dev, "Wrong register address.\n"); return (EINVAL); } - E6000SW_LOCK_ASSERT(sc, SA_XLOCKED); + E6000SW_LOCK(sc); + if (E6000SW_WAITREADY2(sc, SMI_PHY_CMD_REG, SMI_CMD_BUSY)) { device_printf(dev, "Timeout while waiting for switch\n"); + E6000SW_UNLOCK(sc); return (ETIMEDOUT); } @@ -708,6 +726,8 @@ e6000sw_writephy(device_t dev, int phy, int reg, int data) SMI_CMD_OP_C22_WRITE | (reg & SMI_CMD_REG_ADDR_MASK) | ((phy << SMI_CMD_DEV_ADDR) & SMI_CMD_DEV_ADDR_MASK)); + E6000SW_UNLOCK(sc); + return (0); } @@ -725,11 +745,10 @@ e6000sw_detach(device_t dev) if (sc->sc_tq != NULL) taskqueue_free(sc->sc_tq); - bus_generic_detach(dev); + device_delete_children(dev); + sx_destroy(&sc->sx); for (phy = 0; phy < sc->num_ports; phy++) { - if (sc->miibus[phy] != NULL) - device_delete_child(dev, sc->miibus[phy]); if (sc->ifp[phy] != NULL) if_free(sc->ifp[phy]); if (sc->ifname[phy] != NULL) @@ -1051,42 +1070,6 @@ e6000sw_writereg_wrapper(device_t dev, int addr_reg, int val) return (0); } -/* - * These wrappers are necessary because PHY accesses from etherswitchcfg - * need to be synchronized with locks, while miibus PHY accesses do not. - */ -static int -e6000sw_readphy_wrapper(device_t dev, int phy, int reg) -{ - e6000sw_softc_t *sc; - int ret; - - sc = device_get_softc(dev); - E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); - - E6000SW_LOCK(sc); - ret = e6000sw_readphy(dev, phy, reg); - E6000SW_UNLOCK(sc); - - return (ret); -} - -static int -e6000sw_writephy_wrapper(device_t dev, int phy, int reg, int data) -{ - e6000sw_softc_t *sc; - int ret; - - sc = device_get_softc(dev); - E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED); - - E6000SW_LOCK(sc); - ret = e6000sw_writephy(dev, phy, reg, data); - E6000SW_UNLOCK(sc); - - return (ret); -} - /* * setvgroup/getvgroup called from etherswitchfcg need to be locked, * while internal calls do not. diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 030c64701de8..7ed2169445e4 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -108,6 +108,7 @@ SUBDIR= \ ${_dpms} \ dummynet \ ${_dwwdt} \ + ${_e6000sw} \ ${_efirt} \ ${_em} \ ${_ena} \ @@ -624,6 +625,7 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt +_e6000sw= e6000sw .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/modules/e6000sw/Makefile b/sys/modules/e6000sw/Makefile new file mode 100644 index 000000000000..51afb6d8f3a4 --- /dev/null +++ b/sys/modules/e6000sw/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/etherswitch/e6000sw + +KMOD= e6000sw +SRCS= e6000sw.c + +SRCS+= bus_if.h etherswitch_if.h mdio_if.h miibus_if.h ofw_bus_if.h + +.include From owner-dev-commits-src-main@freebsd.org Mon Sep 13 09:45:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AD886789AC; Mon, 13 Sep 2021 09:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7M656sl7z3H4f; Mon, 13 Sep 2021 09:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7CCF24E20; Mon, 13 Sep 2021 09:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18D9jHDe045809; Mon, 13 Sep 2021 09:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18D9jHm3045808; Mon, 13 Sep 2021 09:45:17 GMT (envelope-from git) Date: Mon, 13 Sep 2021 09:45:17 GMT Message-Id: <202109130945.18D9jHm3045808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 41b0190cc404 - main - if_mvneta: Build the driver as a kernel module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41b0190cc404e21cb8b430602eabfedc20107471 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 09:45:18 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=41b0190cc404e21cb8b430602eabfedc20107471 commit 41b0190cc404e21cb8b430602eabfedc20107471 Author: Hubert Mazur AuthorDate: 2021-09-13 09:44:31 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 09:44:31 +0000 if_mvneta: Build the driver as a kernel module Fix device detach and attach routine. Add required Makefile to build as a module. Remove entry from GENERIC, since now it can be loaded automatically. Tested on EspressoBin. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31581 --- sys/dev/neta/if_mvneta.c | 73 ++++++++++++++++++++++++++++-------------------- sys/modules/Makefile | 2 ++ 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index debb4a922cbc..242e139b8cac 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,6 +222,11 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-neta", true }, + { NULL, false } +}; + DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -229,7 +234,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); /* * List of MIB register and names @@ -609,6 +614,16 @@ mvneta_attach(device_t self) } #endif + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + mvneta_detach(self); + return (error); + } + /* * MAC address */ @@ -704,8 +719,6 @@ mvneta_attach(device_t self) } } - ether_ifattach(ifp, sc->enaddr); - /* * Enable DMA engines and Initialize Device Registers. */ @@ -835,20 +848,11 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - sysctl_mvneta_init(sc); + ether_ifattach(ifp, sc->enaddr); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - ether_ifdetach(sc->ifp); - mvneta_detach(self); - return (error); - } + sysctl_mvneta_init(sc); return (0); } @@ -857,20 +861,28 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; + struct ifnet *ifp; int q; sc = device_get_softc(dev); + ifp = sc->ifp; - mvneta_stop(sc); - /* Detach network interface */ - if (sc->ifp) - if_free(sc->ifp); + if (device_is_attached(dev)) { + mvneta_stop(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(sc->ifp); + } for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); + device_delete_children(dev); + + if (sc->ih_cookie[0] != NULL) + bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); + if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -881,6 +893,13 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); + + if (sc->ifp) + if_free(sc->ifp); + + if (mtx_initialized(&sc->mtx)) + mtx_destroy(&sc->mtx); + return (0); } @@ -1254,6 +1273,9 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_rx_lockq(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1295,6 +1317,9 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1324,16 +1349,6 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { - if (mtx_name(&tx->ring_mtx) != NULL) { - /* - * It is assumed that maps are being loaded after mutex - * is initialized. Therefore we can skip unloading maps - * when mutex is empty. - */ - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); - } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1372,8 +1387,6 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7ed2169445e4..b1063ad003d8 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,6 +264,7 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ + ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -626,6 +627,7 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw +_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" From owner-dev-commits-src-main@freebsd.org Mon Sep 13 10:55:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6D0967907B; Mon, 13 Sep 2021 10:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7NgP5jNRz3qLy; Mon, 13 Sep 2021 10:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A363925BBB; Mon, 13 Sep 2021 10:55:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DAtjFf038706; Mon, 13 Sep 2021 10:55:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DAtj1O038705; Mon, 13 Sep 2021 10:55:45 GMT (envelope-from git) Date: Mon, 13 Sep 2021 10:55:45 GMT Message-Id: <202109131055.18DAtj1O038705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 6e93bdfff3ce - main - Revert "if_mvneta: Build the driver as a kernel module" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e93bdfff3cec34f72d98da70b0c6b2b00b2d564 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 10:55:45 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=6e93bdfff3cec34f72d98da70b0c6b2b00b2d564 commit 6e93bdfff3cec34f72d98da70b0c6b2b00b2d564 Author: Wojciech Macek AuthorDate: 2021-09-13 10:55:15 +0000 Commit: Wojciech Macek CommitDate: 2021-09-13 10:55:15 +0000 Revert "if_mvneta: Build the driver as a kernel module" This reverts commit 41b0190cc404e21cb8b430602eabfedc20107471. --- sys/dev/neta/if_mvneta.c | 73 ++++++++++++++++++++---------------------------- sys/modules/Makefile | 2 -- 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 242e139b8cac..debb4a922cbc 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,11 +222,6 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; -static struct ofw_compat_data compat_data[] = { - { "marvell,armada-3700-neta", true }, - { NULL, false } -}; - DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -234,7 +229,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -SIMPLEBUS_PNP_INFO(compat_data); +MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); /* * List of MIB register and names @@ -614,16 +609,6 @@ mvneta_attach(device_t self) } #endif - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - mvneta_detach(self); - return (error); - } - /* * MAC address */ @@ -719,6 +704,8 @@ mvneta_attach(device_t self) } } + ether_ifattach(ifp, sc->enaddr); + /* * Enable DMA engines and Initialize Device Registers. */ @@ -848,11 +835,20 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - ether_ifattach(ifp, sc->enaddr); + sysctl_mvneta_init(sc); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - sysctl_mvneta_init(sc); + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + ether_ifdetach(sc->ifp); + mvneta_detach(self); + return (error); + } return (0); } @@ -861,28 +857,20 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; - struct ifnet *ifp; int q; sc = device_get_softc(dev); - ifp = sc->ifp; - if (device_is_attached(dev)) { - mvneta_stop(sc); - callout_drain(&sc->tick_ch); - ether_ifdetach(sc->ifp); - } + mvneta_stop(sc); + /* Detach network interface */ + if (sc->ifp) + if_free(sc->ifp); for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); - device_delete_children(dev); - - if (sc->ih_cookie[0] != NULL) - bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); - if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -893,13 +881,6 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); - - if (sc->ifp) - if_free(sc->ifp); - - if (mtx_initialized(&sc->mtx)) - mtx_destroy(&sc->mtx); - return (0); } @@ -1273,9 +1254,6 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: - mvneta_rx_lockq(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1317,9 +1295,6 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1349,6 +1324,16 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { + if (mtx_name(&tx->ring_mtx) != NULL) { + /* + * It is assumed that maps are being loaded after mutex + * is initialized. Therefore we can skip unloading maps + * when mutex is empty. + */ + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); + } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1387,6 +1372,8 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index b1063ad003d8..7ed2169445e4 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,7 +264,6 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ - ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -627,7 +626,6 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw -_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" From owner-dev-commits-src-main@freebsd.org Mon Sep 13 11:52:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55CBC67A44B; Mon, 13 Sep 2021 11:52:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7PxN1hgXz4ZHK; Mon, 13 Sep 2021 11:52:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19EDB2698D; Mon, 13 Sep 2021 11:52:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DBquwu018165; Mon, 13 Sep 2021 11:52:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DBqu1C018164; Mon, 13 Sep 2021 11:52:56 GMT (envelope-from git) Date: Mon, 13 Sep 2021 11:52:56 GMT Message-Id: <202109131152.18DBqu1C018164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 7c0226cad3f3 - main - bsd.lib.mk: add conditions for building _pie.a archives MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c0226cad3f36a05832f9c5216dfa3dadb91c92d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 11:52:56 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7c0226cad3f36a05832f9c5216dfa3dadb91c92d commit 7c0226cad3f36a05832f9c5216dfa3dadb91c92d Author: Ed Maste AuthorDate: 2021-09-12 16:45:50 +0000 Commit: Ed Maste CommitDate: 2021-09-13 11:52:02 +0000 bsd.lib.mk: add conditions for building _pie.a archives As with other .a targets, build _pie.a archives only if LIB is set. At present we build _pie.a only for INTERNALLIBs, and none of them include bsd.lib.mk without setting LIB. However, we might want to build _pie.a for non-INTERNALLIBs in the future. Reviewed by: arichardson MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31920 --- share/mk/bsd.lib.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 0c80dd63d5e8..4afe719b8152 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -390,7 +390,7 @@ lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} .endif # !defined(INTERNALLIB) -.if defined(INTERNALLIB) && ${MK_PIE} != "no" +.if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB) PIEOBJS+= ${OBJS:.o=.pieo} DEPENDOBJS+= ${PIEOBJS} CLEANFILES+= ${PIEOBJS} From owner-dev-commits-src-main@freebsd.org Mon Sep 13 12:22:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC39267A961; Mon, 13 Sep 2021 12:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Qbv6KGRz4jHW; Mon, 13 Sep 2021 12:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8BD826DD1; Mon, 13 Sep 2021 12:22:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DCMphU058368; Mon, 13 Sep 2021 12:22:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DCMpt1058367; Mon, 13 Sep 2021 12:22:51 GMT (envelope-from git) Date: Mon, 13 Sep 2021 12:22:51 GMT Message-Id: <202109131222.18DCMpt1058367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 2d78130185b5 - main - Add missing dep patterns for .pieo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d78130185b5518e0bdb4a2f3c5d5ede6773312d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 12:22:52 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2d78130185b5518e0bdb4a2f3c5d5ede6773312d commit 2d78130185b5518e0bdb4a2f3c5d5ede6773312d Author: Alex Richardson AuthorDate: 2021-09-13 12:22:07 +0000 Commit: Alex Richardson CommitDate: 2021-09-13 12:22:31 +0000 Add missing dep patterns for .pieo While adding sanitizer support, I noticed that all other extensions were handled but .pieo was missing. Reviewed By: emaste, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31040 --- share/mk/bsd.dep.mk | 5 ++++- share/mk/local.autodep.mk | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index b8dc59d52543..d1bbdd722c1b 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -170,10 +170,13 @@ ${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} @rm -f ${.TARGET} ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} .if defined(LIB) -CLEANFILES+= ${_D}.pico ${_D}.po ${_D}.nossppico +CLEANFILES+= ${_D}.pico ${_D}.pieo ${_D}.po ${_D}.nossppico ${_D}.pico: ${_DSRC} ${SOBJS:S/^${_D}.pico$//} @rm -f ${.TARGET} ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} +${_D}.pieo: ${_DSRC} ${OBJS:S/^${_D}.pieo$//} + @rm -f ${.TARGET} + ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} ${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} @rm -f ${.TARGET} ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h} diff --git a/share/mk/local.autodep.mk b/share/mk/local.autodep.mk index ee73b23aadcf..0e14d844fcff 100644 --- a/share/mk/local.autodep.mk +++ b/share/mk/local.autodep.mk @@ -9,7 +9,8 @@ UPDATE_DEPENDFILE= no .endif NOSSPPICO?= .nossppico -OBJ_EXTENSIONS+= ${NOSSPPICO} +PIEO?= .pieo +OBJ_EXTENSIONS+= ${NOSSPPICO} ${PIEO} CFLAGS+= ${CFLAGS_LAST} CXXFLAGS+= ${CXXFLAGS_LAST} From owner-dev-commits-src-main@freebsd.org Mon Sep 13 13:02:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04D9E67B56C; Mon, 13 Sep 2021 13:02:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7RTf6McHz4tkD; Mon, 13 Sep 2021 13:02:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B52832789D; Mon, 13 Sep 2021 13:02:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DD2UsP011779; Mon, 13 Sep 2021 13:02:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DD2Uxp011778; Mon, 13 Sep 2021 13:02:30 GMT (envelope-from git) Date: Mon, 13 Sep 2021 13:02:30 GMT Message-Id: <202109131302.18DD2Uxp011778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e76786909ce0 - main - Fix data race in scsi cd driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e76786909ce0195855196305a04d86b40f138894 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 13:02:31 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e76786909ce0195855196305a04d86b40f138894 commit e76786909ce0195855196305a04d86b40f138894 Author: Alexander Motin AuthorDate: 2021-09-13 12:59:51 +0000 Commit: Alexander Motin CommitDate: 2021-09-13 12:59:51 +0000 Fix data race in scsi cd driver. There is a data race between cdsysctlinit and cdcheckmedia. Both functions change softc->flags without synchronization. Submitted by: Arseny Smalyuk MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31726 --- sys/cam/scsi/scsi_cd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 4babe4003050..3e8187544bff 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -371,6 +371,7 @@ cdoninvalidate(struct cam_periph *periph) { struct cd_softc *softc; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; /* @@ -451,7 +452,7 @@ cdasync(void *callback_arg, u_int32_t code, printf("cdasync: Unable to attach new device " "due to status 0x%x\n", status); - break; + return; } case AC_UNIT_ATTENTION: { @@ -471,10 +472,10 @@ cdasync(void *callback_arg, u_int32_t code, if (asc == 0x28 && ascq == 0x00) disk_media_changed(softc->disk, M_NOWAIT); } - cam_periph_async(periph, code, path, arg); break; } case AC_SCSI_AEN: + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; if (softc->state == CD_STATE_NORMAL && !softc->tur) { if (cam_periph_acquire(periph) == 0) { @@ -488,6 +489,7 @@ cdasync(void *callback_arg, u_int32_t code, { struct ccb_hdr *ccbh; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; /* * Don't fail on the expected unit attention @@ -496,12 +498,13 @@ cdasync(void *callback_arg, u_int32_t code, softc->flags |= CD_FLAG_RETRY_UA; LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le) ccbh->ccb_state |= CD_CCB_RETRY_UA; - /* FALLTHROUGH */ + break; } default: - cam_periph_async(periph, code, path, arg); break; } + + cam_periph_async(periph, code, path, arg); } static void @@ -520,7 +523,9 @@ cdsysctlinit(void *context, int pending) snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); sysctl_ctx_init(&softc->sysctl_ctx); + cam_periph_lock(periph); softc->flags |= CD_FLAG_SCTX_INIT; + cam_periph_unlock(periph); softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO, tmpstr2, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, tmpstr, @@ -899,6 +904,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) struct bio *bp; struct ccb_scsiio *csio; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstart\n")); @@ -1143,6 +1149,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cddone\n")); + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; csio = &done_ccb->csio; @@ -2624,6 +2631,7 @@ cdprevent(struct cam_periph *periph, int action) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n")); + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; if (((action == PR_ALLOW) @@ -2661,6 +2669,7 @@ cdmediaprobedone(struct cam_periph *periph) { struct cd_softc *softc; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT; @@ -2682,6 +2691,7 @@ cdcheckmedia(struct cam_periph *periph, int do_wait) struct cd_softc *softc; int error; + cam_periph_assert(periph, MA_OWNED); softc = (struct cd_softc *)periph->softc; error = 0; @@ -3071,13 +3081,14 @@ cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) periph = xpt_path_periph(ccb->ccb_h.path); softc = (struct cd_softc *)periph->softc; - error = 0; + cam_periph_assert(periph, MA_OWNED); /* * We use a status of CAM_REQ_INVALID as shorthand -- if a 6 byte * CDB comes back with this particular error, try transforming it * into the 10 byte version. */ + error = 0; if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { error = cd6byteworkaround(ccb); } else if (scsi_extract_sense_ccb(ccb, From owner-dev-commits-src-main@freebsd.org Mon Sep 13 13:05:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A0EE67B363; Mon, 13 Sep 2021 13:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7RXk335Dz3Bnf; Mon, 13 Sep 2021 13:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49B582747C; Mon, 13 Sep 2021 13:05:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DD5A4k012085; Mon, 13 Sep 2021 13:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DD5AVx012084; Mon, 13 Sep 2021 13:05:10 GMT (envelope-from git) Date: Mon, 13 Sep 2021 13:05:10 GMT Message-Id: <202109131305.18DD5AVx012084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b9df18d6e891 - main - libprocstat: extend zfs_defs hack for .pieo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9df18d6e8917a9bfb62babb7cf9efeca23aa2fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 13:05:10 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b9df18d6e8917a9bfb62babb7cf9efeca23aa2fc commit b9df18d6e8917a9bfb62babb7cf9efeca23aa2fc Author: Ed Maste AuthorDate: 2021-09-12 23:04:31 +0000 Commit: Ed Maste CommitDate: 2021-09-13 13:03:55 +0000 libprocstat: extend zfs_defs hack for .pieo By default _pie.a archives are built only for INTERNALLIBs, so there is usually no need for zfs_defs.pieo to exist. However, some experimental work builds _pie.a archives for everything. Extend the existing set of zfs_defs hacks to build zfs_defs.pieo as well. Reviewed by: arichardson MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31924 --- lib/libprocstat/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile index 2e60a7b0dc4d..e8ca072066d5 100644 --- a/lib/libprocstat/Makefile +++ b/lib/libprocstat/Makefile @@ -64,6 +64,8 @@ zfs/zfs_defs.o: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.o zfs/zfs_defs.pico: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pico +zfs/zfs_defs.pieo: .PHONY + @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pieo zfs/zfs_defs.po: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.po .endif From owner-dev-commits-src-main@freebsd.org Mon Sep 13 14:42:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18E8A67C374; Mon, 13 Sep 2021 14:42:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Thk04mkz3sHg; Mon, 13 Sep 2021 14:42:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D81BBA6F; Mon, 13 Sep 2021 14:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DEgDZ6043710; Mon, 13 Sep 2021 14:42:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DEgDIn043709; Mon, 13 Sep 2021 14:42:13 GMT (envelope-from git) Date: Mon, 13 Sep 2021 14:42:13 GMT Message-Id: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddedf2a11eb20af1ee52cb3da70a57c21904af8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 14:42:14 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ddedf2a11eb20af1ee52cb3da70a57c21904af8f commit ddedf2a11eb20af1ee52cb3da70a57c21904af8f Author: Edward Tomasz Napierala AuthorDate: 2021-09-12 03:07:26 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-12 03:07:58 +0000 tzcode: Implement timezone change detection Implement optional timezone change detection for local time libc functions. This is disabled by default; set WITH_DETECT_TZ_CHANGES to build it. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #47 Differential Revision: https://reviews.freebsd.org/D30183 --- contrib/tzcode/stdtime/localtime.c | 89 +++++++++++++++++++++++++++++- lib/libc/stdtime/Makefile.inc | 4 ++ share/mk/src.opts.mk | 1 + tools/build/options/WITH_DETECT_TZ_CHANGES | 2 + 4 files changed, 95 insertions(+), 1 deletion(-) diff --git a/contrib/tzcode/stdtime/localtime.c b/contrib/tzcode/stdtime/localtime.c index e221c1fa3964..926b24470e19 100644 --- a/contrib/tzcode/stdtime/localtime.c +++ b/contrib/tzcode/stdtime/localtime.c @@ -354,6 +354,45 @@ settzname(void) } } +#ifdef DETECT_TZ_CHANGES +/* + * Determine if there's a change in the timezone since the last time we checked. + * Returns: -1 on error + * 0 if the timezone has not changed + * 1 if the timezone has changed + */ +static int +change_in_tz(const char *name) +{ + static char old_name[PATH_MAX]; + static struct stat old_sb; + struct stat sb; + int error; + + error = stat(name, &sb); + if (error != 0) + return -1; + + if (strcmp(name, old_name) != 0) { + strlcpy(old_name, name, sizeof(old_name)); + old_sb = sb; + return 1; + } + + if (sb.st_dev != old_sb.st_dev || + sb.st_ino != old_sb.st_ino || + sb.st_ctime != old_sb.st_ctime || + sb.st_mtime != old_sb.st_mtime) { + old_sb = sb; + return 1; + } + + return 0; +} +#else /* !DETECT_TZ_CHANGES */ +#define change_in_tz(X) 0 +#endif /* !DETECT_TZ_CHANGES */ + static int differ_by_repeat(const time_t t1, const time_t t0) { @@ -379,6 +418,7 @@ register const int doextend; int stored; int nread; int res; + int ret; union { struct tzhead tzhead; char buf[2 * sizeof(struct tzhead) + @@ -427,6 +467,22 @@ register const int doextend; (void) strcat(fullname, name); name = fullname; } + if (doextend == TRUE) { + /* + * Detect if the timezone file has changed. Check + * 'doextend' to ignore TZDEFRULES; the change_in_tz() + * function can only keep state for a single file. + */ + ret = change_in_tz(name); + if (ret <= 0) { + /* + * Returns -1 if there was an error, + * and 0 if the timezone had not changed. + */ + free(fullname); + return ret; + } + } if ((fid = _open(name, OPEN_MODE)) == -1) { free(fullname); return -1; @@ -1209,12 +1265,43 @@ gmtload(struct state *const sp) (void) tzparse(gmt, sp, TRUE); } +#ifdef DETECT_TZ_CHANGES +static int +recheck_tzdata() +{ + static time_t last_checked; + struct timespec now; + time_t current_time; + int error; + + /* + * We want to recheck the timezone file every 61 sec. + */ + error = clock_gettime(CLOCK_MONOTONIC, &now); + if (error <= 0) { + /* XXX: Can we somehow report this? */ + return 0; + } + + current_time = now.tv_sec; + if ((current_time - last_checked > 61) || + (last_checked > current_time)) { + last_checked = current_time; + return 1; + } + + return 0; +} +#else /* !DETECT_TZ_CHANGES */ +#define recheck_tzdata() 0 +#endif /* !DETECT_TZ_CHANGES */ + static void tzsetwall_basic(int rdlocked) { if (!rdlocked) _RWLOCK_RDLOCK(&lcl_rwlock); - if (lcl_is_set < 0) { + if (lcl_is_set < 0 && recheck_tzdata() == 0) { if (!rdlocked) _RWLOCK_UNLOCK(&lcl_rwlock); return; diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc index fb0d2b934148..3d483469bc97 100644 --- a/lib/libc/stdtime/Makefile.inc +++ b/lib/libc/stdtime/Makefile.inc @@ -12,6 +12,10 @@ CFLAGS+= -I${SRCTOP}/contrib/tzcode/stdtime -I${LIBC_SRCTOP}/stdtime CFLAGS.localtime.c= -fwrapv +.if ${MK_DETECT_TZ_CHANGES} != "no" +CFLAGS+= -DDETECT_TZ_CHANGES +.endif + MAN+= ctime.3 strftime.3 strptime.3 time2posix.3 MAN+= tzfile.5 diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 28e18260affd..ff894d3b3517 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -196,6 +196,7 @@ __DEFAULT_NO_OPTIONS = \ BHYVE_SNAPSHOT \ CLANG_EXTRAS \ CLANG_FORMAT \ + DETECT_TZ_CHANGES \ DTRACE_TESTS \ EXPERIMENTAL \ HESIOD \ diff --git a/tools/build/options/WITH_DETECT_TZ_CHANGES b/tools/build/options/WITH_DETECT_TZ_CHANGES new file mode 100644 index 000000000000..6a2d18473892 --- /dev/null +++ b/tools/build/options/WITH_DETECT_TZ_CHANGES @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Make the time handling code detect changes to the timezone files. From owner-dev-commits-src-main@freebsd.org Mon Sep 13 15:46:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C36A67D58E; Mon, 13 Sep 2021 15:46:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7W6R6g9Rz4fJK; Mon, 13 Sep 2021 15:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C52561D07; Mon, 13 Sep 2021 15:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DFk7le024803; Mon, 13 Sep 2021 15:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DFk7P2024802; Mon, 13 Sep 2021 15:46:07 GMT (envelope-from git) Date: Mon, 13 Sep 2021 15:46:07 GMT Message-Id: <202109131546.18DFk7P2024802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: b029ef7fe618 - main - Restrict spsr updated in the arm64 set_regs* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b029ef7fe618c6fa0482958422cc362905c15376 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 15:46:08 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b029ef7fe618c6fa0482958422cc362905c15376 commit b029ef7fe618c6fa0482958422cc362905c15376 Author: Andrew Turner AuthorDate: 2021-09-13 15:24:34 +0000 Commit: Andrew Turner CommitDate: 2021-09-13 15:32:50 +0000 Restrict spsr updated in the arm64 set_regs* When using ptrace(2) on arm64 to set registers in a 32-bit program we need to take care to only set some of the fields. Follow the existing arm64 path and only let the user set the flags fields. This is also the case in the arm kernel so fixes a change in behaviour between the two. While here update set_regs to only set spsr and elr once. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/machdep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index ee6f5157f5f3..89c4f21134f8 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -254,9 +254,7 @@ set_regs(struct thread *td, struct reg *regs) frame = td->td_frame; frame->tf_sp = regs->sp; frame->tf_lr = regs->lr; - frame->tf_elr = regs->elr; frame->tf_spsr &= ~PSR_FLAGS; - frame->tf_spsr |= regs->spsr & PSR_FLAGS; memcpy(frame->tf_x, regs->x, sizeof(frame->tf_x)); @@ -268,9 +266,13 @@ set_regs(struct thread *td, struct reg *regs) * it put it. */ frame->tf_elr = regs->x[15]; - frame->tf_spsr = regs->x[16] & PSR_FLAGS; - } + frame->tf_spsr |= regs->x[16] & PSR_FLAGS; + } else #endif + { + frame->tf_elr = regs->elr; + frame->tf_spsr |= regs->spsr & PSR_FLAGS; + } return (0); } @@ -490,7 +492,8 @@ set_regs32(struct thread *td, struct reg32 *regs) tf->tf_x[13] = regs->r_sp; tf->tf_x[14] = regs->r_lr; tf->tf_elr = regs->r_pc; - tf->tf_spsr = regs->r_cpsr; + tf->tf_spsr &= ~PSR_FLAGS; + tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS; return (0); } From owner-dev-commits-src-main@freebsd.org Mon Sep 13 16:07:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D6B967D7FB; Mon, 13 Sep 2021 16:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7WZb3rkqz4l3d; Mon, 13 Sep 2021 16:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63E721F4A; Mon, 13 Sep 2021 16:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DG736f052475; Mon, 13 Sep 2021 16:07:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DG73f4052474; Mon, 13 Sep 2021 16:07:03 GMT (envelope-from git) Date: Mon, 13 Sep 2021 16:07:03 GMT Message-Id: <202109131607.18DG73f4052474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 45feade38ec3 - main - Add -Wno-error=unused-but-set-variable when building with Clang 13+ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45feade38ec3e8e30086dedc6ee81cbf816293e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 16:07:03 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=45feade38ec3e8e30086dedc6ee81cbf816293e3 commit 45feade38ec3e8e30086dedc6ee81cbf816293e3 Author: Dimitry Andric AuthorDate: 2021-08-26 15:36:03 +0000 Commit: Dimitry Andric CommitDate: 2021-09-13 16:05:43 +0000 Add -Wno-error=unused-but-set-variable when building with Clang 13+ This warning triggers many times while building world. Downgrade it to a warning until all occurrences have been fixed. Once the Clang warnings have been fixed we should be able to turn it on for GCC as well. See also f4fed768bba45a406f73ed1491d7e52fd1a8711d which did the same for the kernel builds. Reviewed by: arichardson, imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D31927 --- share/mk/bsd.sys.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index a4bb54e19890..304d8dd7d243 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -80,6 +80,9 @@ CWARNFLAGS+= -Wno-pointer-sign .if ${WARNS} <= 6 CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int CWARNFLAGS.clang+= -Wno-unused-const-variable +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 130000 +CWARNFLAGS.clang+= -Wno-error=unused-but-set-variable +.endif .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\ From owner-dev-commits-src-main@freebsd.org Mon Sep 13 16:29:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7E1367D965; Mon, 13 Sep 2021 16:29:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7X4Q48CXz4r8Z; Mon, 13 Sep 2021 16:29:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:d43:6314:1d25:bd0d]) (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 0351636B33; Mon, 13 Sep 2021 16:29:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: b864b67a0d19 - main - socket: Do not include control messages in FIONREAD return value To: Mark Johnston , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109122039.18CKdpwW094531@gitrepo.freebsd.org> From: John Baldwin Message-ID: <270ac6c6-1fdf-879a-cbea-ef43200ef12a@FreeBSD.org> Date: Mon, 13 Sep 2021 09:29:24 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <202109122039.18CKdpwW094531@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 16:29:26 -0000 On 9/12/21 1:39 PM, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b864b67a0d197f59ecf6698940600956ceee2cae > > commit b864b67a0d197f59ecf6698940600956ceee2cae > Author: Mark Johnston > AuthorDate: 2021-09-12 20:05:49 +0000 > Commit: Mark Johnston > CommitDate: 2021-09-12 20:39:44 +0000 > > socket: Do not include control messages in FIONREAD return value > > Some system software expects to be able to read at least the number of > bytes returned by FIONREAD. When control messages are counted in this > return value, this assumption is violated. Follow Linux and OpenBSD > here (as well as our own kevent(EVFILT_READ)) and only return the number > of data bytes available. > > Reported by: avg > MFC after: 2 weeks In a somewhat similar vein, it would be nice to eventually have new ioctls to know how much data and control are available in the next message for datagram-oriented sockets. Right now if you are working with a datagram socket with variable-sized messages there's no good way to know how big the next message is (to resize a read buffer) as FIONREAD can count multiple messages. There's also no way at all to cope with control messages aside from retrying with some naive algorithm like doubling the size if MSG_CTRUNC is set, but that also requires always using MSG_PEEK so that you always end up reading a message at least twice. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Mon Sep 13 16:56:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 834D667E504; Mon, 13 Sep 2021 16:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xg72xcSz3FfC; Mon, 13 Sep 2021 16:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 454692871; Mon, 13 Sep 2021 16:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DGu304018316; Mon, 13 Sep 2021 16:56:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DGu3b2018315; Mon, 13 Sep 2021 16:56:03 GMT (envelope-from git) Date: Mon, 13 Sep 2021 16:56:03 GMT Message-Id: <202109131656.18DGu3b2018315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e99255c8a6ca - main - amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e99255c8a6cae324aeede7f5013d080a2d361e3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 16:56:03 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e99255c8a6cae324aeede7f5013d080a2d361e3f commit e99255c8a6cae324aeede7f5013d080a2d361e3f Author: Konstantin Belousov AuthorDate: 2021-09-11 18:19:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-13 16:51:52 +0000 amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31916 --- sys/x86/acpica/acpi_wakeup.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index b4bbe660bea4..ef52ccc3aef6 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -164,16 +164,22 @@ acpi_wakeup_cpus(struct acpi_softc *sc) int cpu; u_char mpbiosreason; - /* save the current value of the warm-start vector */ - mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); - outb(CMOS_REG, BIOS_RESET); - mpbiosreason = inb(CMOS_DATA); - - /* setup a vector to our boot code */ - *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; - *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; - outb(CMOS_REG, BIOS_RESET); - outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ +#ifdef __amd64__ + if (!efi_boot) { +#endif + /* save the current value of the warm-start vector */ + mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); + outb(CMOS_REG, BIOS_RESET); + mpbiosreason = inb(CMOS_DATA); + + /* setup a vector to our boot code */ + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ +#ifdef __amd64__ + } +#endif /* Wake up each AP. */ for (cpu = 1; cpu < mp_ncpus; cpu++) { @@ -197,11 +203,17 @@ acpi_wakeup_cpus(struct acpi_softc *sc) pmap_remap_lowptdi(false); #endif - /* restore the warmstart vector */ - *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; +#ifdef __amd64__ + if (!efi_boot) { +#endif + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; - outb(CMOS_REG, BIOS_RESET); - outb(CMOS_DATA, mpbiosreason); + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, mpbiosreason); +#ifdef __amd64__ + } +#endif } #endif From owner-dev-commits-src-main@freebsd.org Mon Sep 13 16:56:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3D1A67E44C; Mon, 13 Sep 2021 16:56:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xg84KXRz3Fm6; Mon, 13 Sep 2021 16:56:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B6BF2C17; Mon, 13 Sep 2021 16:56:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DGu4Lh018344; Mon, 13 Sep 2021 16:56:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DGu43L018343; Mon, 13 Sep 2021 16:56:04 GMT (envelope-from git) Date: Mon, 13 Sep 2021 16:56:04 GMT Message-Id: <202109131656.18DGu43L018343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ceca8ac1ce47 - main - x86 acpi_install_wakeup_handler(): style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ceca8ac1ce47e1f87ba09463aa84eb1c879c37d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 16:56:04 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ceca8ac1ce47e1f87ba09463aa84eb1c879c37d9 commit ceca8ac1ce47e1f87ba09463aa84eb1c879c37d9 Author: Konstantin Belousov AuthorDate: 2021-09-11 18:26:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-13 16:52:06 +0000 x86 acpi_install_wakeup_handler(): style Do not use tab between type and variable name in local declarations. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31916 --- sys/x86/acpica/acpi_wakeup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index ef52ccc3aef6..17946ede45d0 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -423,12 +423,12 @@ freepages: void acpi_install_wakeup_handler(struct acpi_softc *sc) { - static void *wakeaddr; - void *wakepages[ACPI_WAKEPAGES]; + static void *wakeaddr; + void *wakepages[ACPI_WAKEPAGES]; #ifdef __amd64__ - uint64_t *pt5, *pt4, *pt3, *pt2; - vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; - int i; + uint64_t *pt5, *pt4, *pt3, *pt2; + vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; + int i; #endif if (wakeaddr != NULL) From owner-dev-commits-src-main@freebsd.org Mon Sep 13 16:56:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD2F567E49F; Mon, 13 Sep 2021 16:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xg95GfRz3FfM; Mon, 13 Sep 2021 16:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 901322C18; Mon, 13 Sep 2021 16:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DGu5j8018371; Mon, 13 Sep 2021 16:56:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DGu5mH018370; Mon, 13 Sep 2021 16:56:05 GMT (envelope-from git) Date: Mon, 13 Sep 2021 16:56:05 GMT Message-Id: <202109131656.18DGu5mH018370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: db2ba218d9fe - main - amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db2ba218d9fe6a541a4f537a641cce95f952fd98 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 16:56:06 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=db2ba218d9fe6a541a4f537a641cce95f952fd98 commit db2ba218d9fe6a541a4f537a641cce95f952fd98 Author: Konstantin Belousov AuthorDate: 2021-09-11 18:36:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-13 16:52:13 +0000 amd64 acpi_wakeup: map 1:1 whole low 4G for the trampoline page table This is required since kernel text might be physically located anywhere below 4G. PR: 258432 Reported by: Taku YAMAMOTO Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31916 --- sys/x86/acpica/acpi_wakeup.c | 77 +++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c index 17946ede45d0..68e0892a31e6 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/x86/acpica/acpi_wakeup.c @@ -99,7 +99,7 @@ static void acpi_wakeup_cpus(struct acpi_softc *); #endif #ifdef __amd64__ -#define ACPI_WAKEPAGES 5 +#define ACPI_WAKEPAGES 8 #else #define ACPI_WAKEPAGES 1 #endif @@ -426,8 +426,8 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) static void *wakeaddr; void *wakepages[ACPI_WAKEPAGES]; #ifdef __amd64__ - uint64_t *pt5, *pt4, *pt3, *pt2; - vm_paddr_t pt5pa, pt4pa, pt3pa, pt2pa; + uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; + vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; #endif @@ -443,15 +443,21 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) #ifdef __amd64__ if (la57) { - pt5 = wakepages[4]; + pt5 = wakepages[7]; pt5pa = vtophys(pt5); } pt4 = wakepages[1]; pt3 = wakepages[2]; - pt2 = wakepages[3]; + pt2_0 = wakepages[3]; + pt2_1 = wakepages[4]; + pt2_2 = wakepages[5]; + pt2_3 = wakepages[6]; pt4pa = vtophys(pt4); pt3pa = vtophys(pt3); - pt2pa = vtophys(pt2); + pt2_0pa = vtophys(pt2_0); + pt2_1pa = vtophys(pt2_1); + pt2_2pa = vtophys(pt2_2); + pt2_3pa = vtophys(pt2_3); #endif bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); @@ -473,31 +479,44 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) #ifndef __amd64__ WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); #else /* __amd64__ */ - /* Create the initial 1GB replicated page tables */ - for (i = 0; i < NPTEPG; i++) { - if (la57) { - pt5[i] = (uint64_t)pt4pa; - pt5[i] |= PG_V | PG_RW | PG_U; - } - - /* - * Each slot of the level 4 pages points - * to the same level 3 page - */ - pt4[i] = (uint64_t)pt3pa; - pt4[i] |= PG_V | PG_RW | PG_U; - - /* - * Each slot of the level 3 pages points - * to the same level 2 page - */ - pt3[i] = (uint64_t)pt2pa; - pt3[i] |= PG_V | PG_RW | PG_U; + /* Create 1:1 mapping for the low 4G */ + if (la57) { + bcopy(kernel_pmap->pm_pmltop, pt5, PAGE_SIZE); + pt5[0] = (uint64_t)pt4pa; + pt5[0] |= PG_V | PG_RW | PG_U; + } else { + bcopy(kernel_pmap->pm_pmltop, pt4, PAGE_SIZE); + } - /* The level 2 page slots are mapped with 2MB pages for 1GB. */ - pt2[i] = i * NBPDR; - pt2[i] |= PG_V | PG_RW | PG_PS | PG_U; + pt4[0] = (uint64_t)pt3pa; + pt4[0] |= PG_V | PG_RW | PG_U; + + pt3[0] = (uint64_t)pt2_0pa; + pt3[0] |= PG_V | PG_RW | PG_U; + pt3[1] = (uint64_t)pt2_1pa; + pt3[1] |= PG_V | PG_RW | PG_U; + pt3[2] = (uint64_t)pt2_2pa; + pt3[2] |= PG_V | PG_RW | PG_U; + pt3[3] = (uint64_t)pt2_3pa; + pt3[3] |= PG_V | PG_RW | PG_U; + + for (i = 0; i < NPDEPG; i++) { + pt2_0[i] = (pd_entry_t)i * NBPDR; + pt2_0[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + for (i = 0; i < NPDEPG; i++) { + pt2_1[i] = (pd_entry_t)NBPDP + i * NBPDR; + pt2_1[i] |= PG_V | PG_RW | PG_PS | PG_U; } + for (i = 0; i < NPDEPG; i++) { + pt2_2[i] = (pd_entry_t)2 * NBPDP + i * NBPDR; + pt2_2[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + for (i = 0; i < NPDEPG; i++) { + pt2_3[i] = (pd_entry_t)3 * NBPDP + i * NBPDR; + pt2_3[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + #endif /* !__amd64__ */ if (bootverbose) From owner-dev-commits-src-main@freebsd.org Mon Sep 13 17:04:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C7BA67E7A4; Mon, 13 Sep 2021 17:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7XrZ43tsz3HSl; Mon, 13 Sep 2021 17:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D6B62CA3; Mon, 13 Sep 2021 17:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DH4E5X032331; Mon, 13 Sep 2021 17:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4EdU032330; Mon, 13 Sep 2021 17:04:14 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:14 GMT Message-Id: <202109131704.18DH4EdU032330@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9b1bb0aee697 - main - cxgbei: Disable ISO for -SO cards without external memory. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b1bb0aee697352b39b3efa1843f581ca29068ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 17:04:14 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9b1bb0aee697352b39b3efa1843f581ca29068ba commit 9b1bb0aee697352b39b3efa1843f581ca29068ba Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 cxgbei: Disable ISO for -SO cards without external memory. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 687fc545cebd..4b1eb0718e86 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$"); #include #include "common/common.h" +#include "common/t4_regs.h" #include "common/t4_tcb.h" #include "tom/t4_tom.h" #include "cxgbei.h" @@ -707,6 +708,19 @@ find_offload_adapter(struct adapter *sc, void *arg) INP_WUNLOCK(inp); } +static bool +is_memfree(struct adapter *sc) +{ + uint32_t em; + + em = t4_read_reg(sc, A_MA_TARGET_MEM_ENABLE); + if ((em & F_EXT_MEM_ENABLE) != 0) + return (false); + if (is_t5(sc) && (em & F_EXT_MEM1_ENABLE) != 0) + return (false); + return (true); +} + /* XXXNP: move this to t4_tom. */ static void send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) @@ -863,7 +877,8 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) if (ic->ic_data_crc32c) icc->ulp_submode |= ULP_CRC_DATA; - if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5) { + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && + !is_memfree(icc->sc)) { max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / max_tx_pdu_len; ic->ic_hw_isomax = max_iso_pdus * From owner-dev-commits-src-main@freebsd.org Mon Sep 13 17:04:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D438467E555; Mon, 13 Sep 2021 17:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xrb5J1Dz3HYp; Mon, 13 Sep 2021 17:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92EAA2E94; Mon, 13 Sep 2021 17:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DH4FOv032386; Mon, 13 Sep 2021 17:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4FQn032385; Mon, 13 Sep 2021 17:04:15 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:15 GMT Message-Id: <202109131704.18DH4FQn032385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b7caa8157602 - main - cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 17:04:15 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 commit b7caa8157602f4eb9acd2729b48ba3a0c0cdc045 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 cxgbei: Return early for EBUSY error in icl_cxgbei_conn_handoff. This permits unindenting almost half of the function. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 80 ++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4b1eb0718e86..6bec1f812cc0 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -857,52 +857,46 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) - error = EBUSY; - else { - /* - * socket could not have been "unoffloaded" if here. - */ - MPASS(tp->t_flags & TF_TOE); - MPASS(tp->tod != NULL); - MPASS(tp->t_toe != NULL); - toep = tp->t_toe; - MPASS(toep->vi->adapter == icc->sc); - icc->toep = toep; - icc->cwt = cxgbei_select_worker_thread(icc); - - icc->ulp_submode = 0; - if (ic->ic_header_crc32c) - icc->ulp_submode |= ULP_CRC_HEADER; - if (ic->ic_data_crc32c) - icc->ulp_submode |= ULP_CRC_DATA; - - if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && - !is_memfree(icc->sc)) { - max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / - max_tx_pdu_len; - ic->ic_hw_isomax = max_iso_pdus * - ic->ic_max_send_data_segment_length; - } else - max_iso_pdus = 1; - - so->so_options |= SO_NO_DDP; - toep->params.ulp_mode = ULP_MODE_ISCSI; - toep->ulpcb = icc; - - send_iscsi_flowc_wr(icc->sc, toep, - roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); - set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); - error = 0; + if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + INP_WUNLOCK(inp); + return (EBUSY); } - INP_WUNLOCK(inp); - if (error == 0) { - error = icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, - max_rx_pdu_len); - } + /* + * socket could not have been "unoffloaded" if here. + */ + MPASS(tp->t_flags & TF_TOE); + MPASS(tp->tod != NULL); + MPASS(tp->t_toe != NULL); + toep = tp->t_toe; + MPASS(toep->vi->adapter == icc->sc); + icc->toep = toep; + icc->cwt = cxgbei_select_worker_thread(icc); + + icc->ulp_submode = 0; + if (ic->ic_header_crc32c) + icc->ulp_submode |= ULP_CRC_HEADER; + if (ic->ic_data_crc32c) + icc->ulp_submode |= ULP_CRC_DATA; + + if (icc->sc->tt.iso && chip_id(icc->sc) >= CHELSIO_T5 && + !is_memfree(icc->sc)) { + max_iso_pdus = CXGBEI_MAX_ISO_PAYLOAD / max_tx_pdu_len; + ic->ic_hw_isomax = max_iso_pdus * + ic->ic_max_send_data_segment_length; + } else + max_iso_pdus = 1; + + so->so_options |= SO_NO_DDP; + toep->params.ulp_mode = ULP_MODE_ISCSI; + toep->ulpcb = icc; + + send_iscsi_flowc_wr(icc->sc, toep, + roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); + set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); + INP_WUNLOCK(inp); - return (error); + return (icl_cxgbei_setsockopt(ic, so, max_tx_pdu_len, max_rx_pdu_len)); } void From owner-dev-commits-src-main@freebsd.org Mon Sep 13 17:04:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4458467E810; Mon, 13 Sep 2021 17:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xrc72gmz3HYy; Mon, 13 Sep 2021 17:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B02D72C3E; Mon, 13 Sep 2021 17:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DH4G2g032410; Mon, 13 Sep 2021 17:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4GBA032409; Mon, 13 Sep 2021 17:04:16 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:16 GMT Message-Id: <202109131704.18DH4GBA032409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f63ddf465fe0 - main - cxgbei: Only convert "plain" TCP connections to ISCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f63ddf465fe09d3547deaf80fbdb91bc7b816dfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 17:04:17 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f63ddf465fe09d3547deaf80fbdb91bc7b816dfb commit f63ddf465fe09d3547deaf80fbdb91bc7b816dfb Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 cxgbei: Only convert "plain" TCP connections to ISCSI. Reject attempts to convert a connection using a different ULP mode: (e.g. DDP or TLS) to ISCSI. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 6bec1f812cc0..cf1032f2a3a2 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -870,6 +870,12 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) MPASS(tp->t_toe != NULL); toep = tp->t_toe; MPASS(toep->vi->adapter == icc->sc); + + if (ulp_mode(toep) != ULP_MODE_NONE) { + INP_WUNLOCK(inp); + return (EINVAL); + } + icc->toep = toep; icc->cwt = cxgbei_select_worker_thread(icc); @@ -887,7 +893,6 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) } else max_iso_pdus = 1; - so->so_options |= SO_NO_DDP; toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; From owner-dev-commits-src-main@freebsd.org Mon Sep 13 17:04:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6934767E731; Mon, 13 Sep 2021 17:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xrf0gp7z3HW3; Mon, 13 Sep 2021 17:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3E8E2F1C; Mon, 13 Sep 2021 17:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DH4Huj032434; Mon, 13 Sep 2021 17:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4HBL032433; Mon, 13 Sep 2021 17:04:17 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:17 GMT Message-Id: <202109131704.18DH4HBL032433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 91c62d626d0e - main - iscsid: Disable TCP DDP for connection sockets. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91c62d626d0e9995da9dc424120a4f1b0b987eea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 17:04:18 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=91c62d626d0e9995da9dc424120a4f1b0b987eea commit 91c62d626d0e9995da9dc424120a4f1b0b987eea Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 iscsid: Disable TCP DDP for connection sockets. cxgbei is not able to offload PDU processing for a socket using TCP DDP offload. Sponsored by: Chelsio Communications --- usr.sbin/iscsid/iscsid.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 797a7561f79c..db8b5d4f5e4c 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -164,7 +164,7 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) #ifdef ICL_KERNEL_PROXY struct iscsi_daemon_connect idc; #endif - int error, sockbuf; + int error, optval; conn = calloc(1, sizeof(*conn)); if (conn == NULL) @@ -275,14 +275,18 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) fail(conn, strerror(errno)); log_err(1, "failed to create socket for %s", from_addr); } - sockbuf = SOCKBUF_SIZE; + optval = SOCKBUF_SIZE; if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_RCVBUF, - &sockbuf, sizeof(sockbuf)) == -1) + &optval, sizeof(optval)) == -1) log_warn("setsockopt(SO_RCVBUF) failed"); - sockbuf = SOCKBUF_SIZE; + optval = SOCKBUF_SIZE; if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_SNDBUF, - &sockbuf, sizeof(sockbuf)) == -1) + &optval, sizeof(optval)) == -1) log_warn("setsockopt(SO_SNDBUF) failed"); + optval = 1; + if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_NO_DDP, + &optval, sizeof(optval)) == -1) + log_warn("setsockopt(SO_NO_DDP) failed"); if (conn->conn_conf.isc_dscp != -1) { int tos = conn->conn_conf.isc_dscp << 2; if (to_ai->ai_family == AF_INET) { From owner-dev-commits-src-main@freebsd.org Mon Sep 13 17:04:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5108367E813; Mon, 13 Sep 2021 17:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Xrg0vPtz3Hhc; Mon, 13 Sep 2021 17:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEFF82E95; Mon, 13 Sep 2021 17:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DH4Irq032458; Mon, 13 Sep 2021 17:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DH4IlS032457; Mon, 13 Sep 2021 17:04:18 GMT (envelope-from git) Date: Mon, 13 Sep 2021 17:04:18 GMT Message-Id: <202109131704.18DH4IlS032457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3b5f95d7bd20 - main - ctld: Disable TCP DDP for connection sockets. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b5f95d7bd20e366d720a47a79c451ae037a3ae1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 17:04:19 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b5f95d7bd20e366d720a47a79c451ae037a3ae1 commit 3b5f95d7bd20e366d720a47a79c451ae037a3ae1 Author: John Baldwin AuthorDate: 2021-09-13 16:57:54 +0000 Commit: John Baldwin CommitDate: 2021-09-13 16:57:54 +0000 ctld: Disable TCP DDP for connection sockets. cxgbei is not able to offload PDU processing for a socket using TCP DDP offload. Sponsored by: Chelsio Communications --- usr.sbin/ctld/ctld.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 7af1d88da44a..c37181ff00d0 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -2178,6 +2178,10 @@ conf_apply(struct conf *oldconf, struct conf *newconf) &sockbuf, sizeof(sockbuf)) == -1) log_warn("setsockopt(SO_SNDBUF) failed " "for %s", newp->p_listen); + if (setsockopt(newp->p_socket, SOL_SOCKET, SO_NO_DDP, + &one, sizeof(one)) == -1) + log_warn("setsockopt(SO_NO_DDP) failed " + "for %s", newp->p_listen); error = setsockopt(newp->p_socket, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); if (error != 0) { From owner-dev-commits-src-main@freebsd.org Mon Sep 13 18:02:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEEF467EDDF; Mon, 13 Sep 2021 18:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7Z7P548Fz3r4D; Mon, 13 Sep 2021 18:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DF393BFA; Mon, 13 Sep 2021 18:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DI294k011452; Mon, 13 Sep 2021 18:02:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DI29QQ011451; Mon, 13 Sep 2021 18:02:09 GMT (envelope-from git) Date: Mon, 13 Sep 2021 18:02:09 GMT Message-Id: <202109131802.18DI29QQ011451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 93d6fa53c995 - main - Disable -Woverflow errors for i386 for GCC 9. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93d6fa53c9951563be3081a347cc4dc1917ad452 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 18:02:09 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=93d6fa53c9951563be3081a347cc4dc1917ad452 commit 93d6fa53c9951563be3081a347cc4dc1917ad452 Author: John Baldwin AuthorDate: 2021-09-13 18:00:38 +0000 Commit: John Baldwin CommitDate: 2021-09-13 18:00:38 +0000 Disable -Woverflow errors for i386 for GCC 9. GCC 9 warns about floating point constants overflowing for i386. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D26201 --- share/mk/bsd.sys.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 304d8dd7d243..14b643fe0a20 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -196,6 +196,13 @@ CWARNFLAGS+= -Wno-error=aggressive-loop-optimizations \ -Wno-error=stringop-truncation .endif +# GCC 9.2.0 +.if ${COMPILER_VERSION} >= 90200 +.if ${MACHINE_ARCH} == "i386" +CWARNFLAGS+= -Wno-error=overflow +.endif +.endif + # GCC's own arm_neon.h triggers various warnings .if ${MACHINE_CPUARCH} == "aarch64" CWARNFLAGS+= -Wno-system-headers From owner-dev-commits-src-main@freebsd.org Mon Sep 13 19:25:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 435666A8525; Mon, 13 Sep 2021 19:25:37 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7bzh6qSpz4pVB; Mon, 13 Sep 2021 19:25:36 +0000 (UTC) (envelope-from michael.tuexen@macmic.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:1442:bd8b:13ff:7b32]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 19AC5721E2825; Mon, 13 Sep 2021 21:25:24 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: b864b67a0d19 - main - socket: Do not include control messages in FIONREAD return value From: Michael Tuexen In-Reply-To: <270ac6c6-1fdf-879a-cbea-ef43200ef12a@FreeBSD.org> Date: Mon, 13 Sep 2021 21:25:23 +0200 Cc: Mark Johnston , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202109122039.18CKdpwW094531@gitrepo.freebsd.org> <270ac6c6-1fdf-879a-cbea-ef43200ef12a@FreeBSD.org> To: John Baldwin X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4H7bzh6qSpz4pVB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 19:25:37 -0000 > On 13. Sep 2021, at 18:29, John Baldwin wrote: >=20 > On 9/12/21 1:39 PM, Mark Johnston wrote: >> The branch main has been updated by markj: >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Db864b67a0d197f59ecf6698940600956= ceee2cae >> commit b864b67a0d197f59ecf6698940600956ceee2cae >> Author: Mark Johnston >> AuthorDate: 2021-09-12 20:05:49 +0000 >> Commit: Mark Johnston >> CommitDate: 2021-09-12 20:39:44 +0000 >> socket: Do not include control messages in FIONREAD return value >> Some system software expects to be able to read at least the = number of >> bytes returned by FIONREAD. When control messages are counted in = this >> return value, this assumption is violated. Follow Linux and = OpenBSD >> here (as well as our own kevent(EVFILT_READ)) and only return the = number >> of data bytes available. >> Reported by: avg >> MFC after: 2 weeks >=20 > In a somewhat similar vein, it would be nice to eventually have new = ioctls > to know how much data and control are available in the next message = for > datagram-oriented sockets. Right now if you are working with a = datagram > socket with variable-sized messages there's no good way to know how = big the > next message is (to resize a read buffer) as FIONREAD can count = multiple > messages. There's also no way at all to cope with control messages = aside > from retrying with some naive algorithm like doubling the size if = MSG_CTRUNC > is set, but that also requires always using MSG_PEEK so that you = always > end up reading a message at least twice. That still requires two system calls. In SCTP, there is a CMSG you can receive with a messages, which contains the metadata of the next message you will receive. So it might be an idea to define a CMSG containing the length of the = next message (if available). Best regards Michael >=20 > --=20 > John Baldwin From owner-dev-commits-src-main@freebsd.org Mon Sep 13 19:25:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 691E96A84DA; Mon, 13 Sep 2021 19:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7bzt1ZxJz4pKp; Mon, 13 Sep 2021 19:25:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37D365088; Mon, 13 Sep 2021 19:25:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DJPjw1019146; Mon, 13 Sep 2021 19:25:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DJPjOA019145; Mon, 13 Sep 2021 19:25:45 GMT (envelope-from git) Date: Mon, 13 Sep 2021 19:25:45 GMT Message-Id: <202109131925.18DJPjOA019145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: e673ac3ffbfb - main - libnv: Fix array unpack endianness logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e673ac3ffbfb2e300d02a47f984df63bd20a6578 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 19:25:46 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=e673ac3ffbfb2e300d02a47f984df63bd20a6578 commit e673ac3ffbfb2e300d02a47f984df63bd20a6578 Author: Stefan Grundmann AuthorDate: 2021-08-18 16:26:29 +0000 Commit: Mariusz Zaborski CommitDate: 2021-09-13 19:21:14 +0000 libnv: Fix array unpack endianness logic When a nvlist(9) is converted into a binary buffer by nvlist_pack(9), the host endianness is encoded in the nvlist_header of the binary buffer. The nvlist_unpack(9) function converts a given binary buffer to an nvlist. In the conversion process the endianness encoded in the nvlist_header is evaluated and -- should the encoded endianness differ from the endianess of the decoding host -- endianness conversion is applied to nvlist_header and nvpair_header elements as well as to some nvpair values. In 2015 @oshogbo extended libnv with array support (in 347a39b). The unpacking code misses the possible need to convert the endianness of the nvph_nitems element of nvpair_headers. The patch (re)enables libnv to unpack nvlists regardless of the endianness of the packing host. Pull Request: https://github.com/freebsd/freebsd-src/pull/528 --- sys/contrib/libnv/bsd_nvpair.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/contrib/libnv/bsd_nvpair.c b/sys/contrib/libnv/bsd_nvpair.c index 6405dcd1c516..00eee223fe92 100644 --- a/sys/contrib/libnv/bsd_nvpair.c +++ b/sys/contrib/libnv/bsd_nvpair.c @@ -661,11 +661,13 @@ nvpair_unpack_header(bool isbe, nvpair_t *nvp, const unsigned char *ptr, if (!isbe) { nvphdr.nvph_namesize = le16toh(nvphdr.nvph_namesize); nvphdr.nvph_datasize = le64toh(nvphdr.nvph_datasize); + nvphdr.nvph_nitems = le64toh(nvphdr.nvph_nitems); } #else if (isbe) { nvphdr.nvph_namesize = be16toh(nvphdr.nvph_namesize); nvphdr.nvph_datasize = be64toh(nvphdr.nvph_datasize); + nvphdr.nvph_nitems = be64toh(nvphdr.nvph_nitems); } #endif From owner-dev-commits-src-main@freebsd.org Mon Sep 13 20:06:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 936316A8EDD; Mon, 13 Sep 2021 20:06:33 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7ctx3Q8cz524c; Mon, 13 Sep 2021 20:06:33 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 529413EB; Mon, 13 Sep 2021 20:06:33 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f175.google.com with SMTP id a93so23054394ybi.1; Mon, 13 Sep 2021 13:06:33 -0700 (PDT) X-Gm-Message-State: AOAM530NKrXzb7lYbLbD1phv8VbTlOvbGVOas0IDIqYzLtS2COERac/K D/dp1BX59msrP5cbuKwZifK0/6gsiIRleTH5C8E= X-Google-Smtp-Source: ABdhPJyOr1qxL04JzPiQj3kL9M9xZ/ak7hKpPRTLj+oJUgN4zRtfSg+vr9CqoZWdvnotk4N9/yz5P2oGJNh9l9eFjE4= X-Received: by 2002:a25:3086:: with SMTP id w128mr17634472ybw.139.1631563592771; Mon, 13 Sep 2021 13:06:32 -0700 (PDT) MIME-Version: 1.0 References: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> In-Reply-To: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> From: Mitchell Horne Date: Mon, 13 Sep 2021 17:06:21 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 6fa041d7f125 - main - Measure latency of PMC interruptions To: Wojciech Macek Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 20:06:33 -0000 On Mon, Sep 13, 2021 at 1:11 AM Wojciech Macek wrote: > > The branch main has been updated by wma: > > URL: https://cgit.FreeBSD.org/src/commit/?id=6fa041d7f125db65f400af7f520a41ff78d19cd7 > > commit 6fa041d7f125db65f400af7f520a41ff78d19cd7 > Author: Wojciech Macek > AuthorDate: 2021-09-13 04:08:32 +0000 > Commit: Wojciech Macek > CommitDate: 2021-09-13 04:08:32 +0000 > > Measure latency of PMC interruptions > > Add HWPMC events to measure latency. > Provide sysctl to choose the number of outstanding events which > trigger HWPMC event. > > Obtained from: Semihalf > Sponsored by: Stormshield > Differential revision: https://reviews.freebsd.org/D31283 > --- > sys/kern/kern_intr.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 52 insertions(+), 6 deletions(-) > > diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c > index 1660414a50ef..19401877dfbd 100644 > --- a/sys/kern/kern_intr.c > +++ b/sys/kern/kern_intr.c > @@ -30,6 +30,7 @@ > __FBSDID("$FreeBSD$"); > > #include "opt_ddb.h" > +#include "opt_hwpmc_hooks.h" > #include "opt_kstack_usage_prof.h" > > #include > @@ -75,6 +76,7 @@ struct intr_thread { > struct thread *it_thread; /* Kernel thread. */ > int it_flags; /* (j) IT_* flags. */ > int it_need; /* Needs service. */ > + int it_waiting; /* Waiting in the runq. */ > }; > > /* Interrupt thread flags kept in it_flags */ > @@ -100,13 +102,19 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, CTLFLAG_RWTUN, > static int intr_epoch_batch = 1000; > SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, &intr_epoch_batch, > 0, "Maximum interrupt handler executions without re-entering epoch(9)"); > +#ifdef HWPMC_HOOKS > +static int intr_hwpmc_waiting_report_threshold = 1; > +SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, CTLFLAG_RWTUN, > + &intr_hwpmc_waiting_report_threshold, 1, > + "Threshold for reporting number of events in a workq"); > +#endif > static TAILQ_HEAD(, intr_event) event_list = > TAILQ_HEAD_INITIALIZER(event_list); > static struct mtx event_lock; > MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF); > > static void intr_event_update(struct intr_event *ie); > -static int intr_event_schedule_thread(struct intr_event *ie); > +static int intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame); > static struct intr_thread *ithread_create(const char *name); > static void ithread_destroy(struct intr_thread *ithread); > static void ithread_execute_handlers(struct proc *p, > @@ -115,6 +123,16 @@ static void ithread_loop(void *); > static void ithread_update(struct intr_thread *ithd); > static void start_softintr(void *); > > +#ifdef HWPMC_HOOKS > +#include > +PMC_SOFT_DEFINE( , , intr, all); > +PMC_SOFT_DEFINE( , , intr, ithread); > +PMC_SOFT_DEFINE( , , intr, filter); > +PMC_SOFT_DEFINE( , , intr, stray); > +PMC_SOFT_DEFINE( , , intr, schedule); > +PMC_SOFT_DEFINE( , , intr, waiting); > +#endif > + Hi Wojciech, Do you plan to document these new events in the pmc.soft(3) man page? Cheers, Mitchell > /* Map an interrupt type to an ithread priority. */ > u_char > intr_priority(enum intr_type flags) > @@ -773,7 +791,7 @@ intr_handler_barrier(struct intr_handler *handler) > } > if ((handler->ih_flags & IH_CHANGED) == 0) { > handler->ih_flags |= IH_CHANGED; > - intr_event_schedule_thread(ie); > + intr_event_schedule_thread(ie, NULL); > } > while ((handler->ih_flags & IH_CHANGED) != 0) > msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); > @@ -872,7 +890,7 @@ intr_event_remove_handler(void *cookie) > KASSERT((handler->ih_flags & IH_DEAD) == 0, > ("duplicate handle remove")); > handler->ih_flags |= IH_DEAD; > - intr_event_schedule_thread(ie); > + intr_event_schedule_thread(ie, NULL); > while (handler->ih_flags & IH_DEAD) > msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0); > intr_event_update(ie); > @@ -944,7 +962,7 @@ intr_event_resume_handler(void *cookie) > } > > static int > -intr_event_schedule_thread(struct intr_event *ie) > +intr_event_schedule_thread(struct intr_event *ie, struct trapframe *frame) > { > struct intr_entropy entropy; > struct intr_thread *it; > @@ -986,11 +1004,28 @@ intr_event_schedule_thread(struct intr_event *ie) > atomic_store_rel_int(&it->it_need, 1); > thread_lock(td); > if (TD_AWAITING_INTR(td)) { > +#ifdef HWPMC_HOOKS > + atomic_set_int(&it->it_waiting, 0); > + if (frame != NULL) > + PMC_SOFT_CALL_TF( , , intr, schedule, frame); > + else > + PMC_SOFT_CALL( , , intr, schedule); > +#endif > CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, td->td_proc->p_pid, > td->td_name); > TD_CLR_IWAIT(td); > sched_add(td, SRQ_INTR); > } else { > +#ifdef HWPMC_HOOKS > + atomic_add_int(&it->it_waiting, 1); > + > + if (atomic_load_int(&it->it_waiting) >= intr_hwpmc_waiting_report_threshold) { > + if (frame != NULL) > + PMC_SOFT_CALL_TF( , , intr, waiting, frame); > + else > + PMC_SOFT_CALL( , , intr, waiting); > + } > +#endif > CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", > __func__, td->td_proc->p_pid, td->td_name, it->it_need, TD_GET_STATE(td)); > thread_unlock(td); > @@ -1083,7 +1118,7 @@ swi_sched(void *cookie, int flags) > #endif > } else { > VM_CNT_INC(v_soft); > - error = intr_event_schedule_thread(ie); > + error = intr_event_schedule_thread(ie, NULL); > KASSERT(error == 0, ("stray software interrupt")); > } > } > @@ -1374,12 +1409,23 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame) > ret = ih->ih_filter(frame); > else > ret = ih->ih_filter(ih->ih_argument); > +#ifdef HWPMC_HOOKS > + PMC_SOFT_CALL_TF( , , intr, all, frame); > +#endif > KASSERT(ret == FILTER_STRAY || > ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && > (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), > ("%s: incorrect return value %#x from %s", __func__, ret, > ih->ih_name)); > filter = filter || ret == FILTER_HANDLED; > +#ifdef HWPMC_HOOKS > + if (ret & FILTER_SCHEDULE_THREAD) > + PMC_SOFT_CALL_TF( , , intr, ithread, frame); > + else if (ret & FILTER_HANDLED) > + PMC_SOFT_CALL_TF( , , intr, filter, frame); > + else if (ret == FILTER_STRAY) > + PMC_SOFT_CALL_TF( , , intr, stray, frame); > +#endif > > /* > * Wrapper handler special handling: > @@ -1416,7 +1462,7 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame) > if (thread) { > int error __unused; > > - error = intr_event_schedule_thread(ie); > + error = intr_event_schedule_thread(ie, frame); > KASSERT(error == 0, ("bad stray interrupt")); > } > critical_exit(); From owner-dev-commits-src-main@freebsd.org Mon Sep 13 20:43:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7E3A6A9703; Mon, 13 Sep 2021 20:43:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7djM3pGlz3FZ1; Mon, 13 Sep 2021 20:43:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id D8F68ABD; Mon, 13 Sep 2021 20:43:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Michael Tuexen Cc: Mark Johnston , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202109122039.18CKdpwW094531@gitrepo.freebsd.org> <270ac6c6-1fdf-879a-cbea-ef43200ef12a@FreeBSD.org> From: John Baldwin Subject: Re: git: b864b67a0d19 - main - socket: Do not include control messages in FIONREAD return value Message-ID: <4ae85e22-a95f-5046-fe7d-40f2cc881c82@FreeBSD.org> Date: Mon, 13 Sep 2021 13:43:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 20:43:19 -0000 On 9/13/21 12:25 PM, Michael Tuexen wrote: >> On 13. Sep 2021, at 18:29, John Baldwin wrote: >> >> On 9/12/21 1:39 PM, Mark Johnston wrote: >>> The branch main has been updated by markj: >>> URL: https://cgit.FreeBSD.org/src/commit/?id=b864b67a0d197f59ecf6698940600956ceee2cae >>> commit b864b67a0d197f59ecf6698940600956ceee2cae >>> Author: Mark Johnston >>> AuthorDate: 2021-09-12 20:05:49 +0000 >>> Commit: Mark Johnston >>> CommitDate: 2021-09-12 20:39:44 +0000 >>> socket: Do not include control messages in FIONREAD return value >>> Some system software expects to be able to read at least the number of >>> bytes returned by FIONREAD. When control messages are counted in this >>> return value, this assumption is violated. Follow Linux and OpenBSD >>> here (as well as our own kevent(EVFILT_READ)) and only return the number >>> of data bytes available. >>> Reported by: avg >>> MFC after: 2 weeks >> >> In a somewhat similar vein, it would be nice to eventually have new ioctls >> to know how much data and control are available in the next message for >> datagram-oriented sockets. Right now if you are working with a datagram >> socket with variable-sized messages there's no good way to know how big the >> next message is (to resize a read buffer) as FIONREAD can count multiple >> messages. There's also no way at all to cope with control messages aside >> from retrying with some naive algorithm like doubling the size if MSG_CTRUNC >> is set, but that also requires always using MSG_PEEK so that you always >> end up reading a message at least twice. > That still requires two system calls. In SCTP, there is a CMSG you can > receive with a messages, which contains the metadata of the next message > you will receive. > So it might be an idea to define a CMSG containing the length of the next > message (if available). We could at least just have a single ioctl that returns a struct with two members (data length and control length) perhaps to get it back down to just 1 syscall similar to FIONREAD. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Mon Sep 13 20:54:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11B816A925E; Mon, 13 Sep 2021 20:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7dxq6rlJz3HTt; Mon, 13 Sep 2021 20:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB7085DF3; Mon, 13 Sep 2021 20:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DKs7W0037746; Mon, 13 Sep 2021 20:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DKs7NG037745; Mon, 13 Sep 2021 20:54:07 GMT (envelope-from git) Date: Mon, 13 Sep 2021 20:54:07 GMT Message-Id: <202109132054.18DKs7NG037745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: f28c1d0c5c6c - main - llvm-objcopy: Install llvm-strip, and optionally strip, links MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f28c1d0c5c6c6532df0dfa38eaf804343988d163 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 20:54:08 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f28c1d0c5c6c6532df0dfa38eaf804343988d163 commit f28c1d0c5c6c6532df0dfa38eaf804343988d163 Author: Jessica Clarke AuthorDate: 2021-09-13 20:52:40 +0000 Commit: Jessica Clarke CommitDate: 2021-09-13 20:52:40 +0000 llvm-objcopy: Install llvm-strip, and optionally strip, links Just as elftoolchain's objcopy doubles as strip, so does LLVM's. This ensures that a strip binary is still present for WITH_LLVM_BINUTILS builds. Note that we do not currently have a committed copy of the manpage generated from the rST source so no manpage is installed for (llvm-)strip. Reported by: Shawn Webb Tested by: Shawn Webb MFC after: 1 week --- usr.bin/clang/llvm-objcopy/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/clang/llvm-objcopy/Makefile b/usr.bin/clang/llvm-objcopy/Makefile index 2e6fc8aba356..afd03b848b19 100644 --- a/usr.bin/clang/llvm-objcopy/Makefile +++ b/usr.bin/clang/llvm-objcopy/Makefile @@ -44,8 +44,11 @@ CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} LIBADD+= z +LINKS= ${BINDIR}/llvm-objcopy ${BINDIR}/llvm-strip + .if ${MK_LLVM_BINUTILS} != "no" -LINKS= ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy +LINKS+= ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy \ + ${BINDIR}/llvm-strip ${BINDIR}/strip MLINKS= llvm-objcopy.1 objcopy.1 .endif From owner-dev-commits-src-main@freebsd.org Mon Sep 13 21:01:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2BFE6A9914; Mon, 13 Sep 2021 21:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7f5z34tvz3K14; Mon, 13 Sep 2021 21:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40B3F6304; Mon, 13 Sep 2021 21:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DL1BkI048136; Mon, 13 Sep 2021 21:01:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DL1B03048135; Mon, 13 Sep 2021 21:01:11 GMT (envelope-from git) Date: Mon, 13 Sep 2021 21:01:11 GMT Message-Id: <202109132101.18DL1B03048135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: abf774528d7e - main - ixl(4): Fix 2.5 and 5G speeds reporting and update shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abf774528d7e497460510b0026db85e30f054142 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 21:01:11 -0000 The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=abf774528d7e497460510b0026db85e30f054142 commit abf774528d7e497460510b0026db85e30f054142 Author: Krzysztof Galazka AuthorDate: 2021-09-13 20:39:59 +0000 Commit: Eric Joyner CommitDate: 2021-09-13 21:00:50 +0000 ixl(4): Fix 2.5 and 5G speeds reporting and update shared code Fix 2.5 and 5G speeds reporting and update shared code with recent changes: - Update expected FW API versions for X710 and X722 adapters - Define pointers related to Preservation Rules Module - Add definitions for Shadow RAM pointers to new modules: 5th and 6th FPA, and Preservation Rules Module. - Add I40E_RX_PTYPE_PARSER_ABORTED definition, so the driver will know opcode for parser aborted packets. - Add the new filter types needed for custom cloud filters. - Add support for Minimum Rollback Revision - Fix RX_ONLY mode for unicast promiscuous on VLAN - Add EEE LPI status check for X722 adapters - Fix PHY type identifiers for 2.5G and 5G adapters - Fix update link data for X722 - Increase the timeout value for PF reset to give PF more time to finish reset if it is loaded with filters. - Added support for Min Rollback Revision for 4 more X722 modules - Fix reporting of Active Optical Cable media type - Add flags and fields for double VLAN processing - Fix potentially uninitialized variables in NVM code Reviewed by: kbowling@, mike.jakubik@gmail.com Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D31565 --- sys/dev/ixl/i40e_adminq.c | 6 +- sys/dev/ixl/i40e_adminq_cmd.h | 71 +++++++++++++-- sys/dev/ixl/i40e_common.c | 206 ++++++++++++++++++++++++++---------------- sys/dev/ixl/i40e_dcb.c | 10 +- sys/dev/ixl/i40e_lan_hmc.c | 2 +- sys/dev/ixl/i40e_nvm.c | 13 ++- sys/dev/ixl/i40e_prototype.h | 10 +- sys/dev/ixl/i40e_register.h | 3 + sys/dev/ixl/i40e_type.h | 17 ++-- sys/dev/ixl/if_ixl.c | 4 +- 10 files changed, 234 insertions(+), 108 deletions(-) diff --git a/sys/dev/ixl/i40e_adminq.c b/sys/dev/ixl/i40e_adminq.c index d25798d23bd1..efca7f1e61ff 100644 --- a/sys/dev/ixl/i40e_adminq.c +++ b/sys/dev/ixl/i40e_adminq.c @@ -646,8 +646,10 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { struct i40e_adminq_info *aq = &hw->aq; enum i40e_status_code ret_code; - u16 cfg_ptr, oem_hi, oem_lo; - u16 eetrack_lo, eetrack_hi; + u16 oem_hi = 0, oem_lo = 0; + u16 eetrack_hi = 0; + u16 eetrack_lo = 0; + u16 cfg_ptr = 0; int retry = 0; /* verify input for valid configuration */ diff --git a/sys/dev/ixl/i40e_adminq_cmd.h b/sys/dev/ixl/i40e_adminq_cmd.h index 6161805a7cf0..564a076761d0 100644 --- a/sys/dev/ixl/i40e_adminq_cmd.h +++ b/sys/dev/ixl/i40e_adminq_cmd.h @@ -43,8 +43,8 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR_X722 0x000A -#define I40E_FW_API_VERSION_MINOR_X710 0x000A +#define I40E_FW_API_VERSION_MINOR_X722 0x000C +#define I40E_FW_API_VERSION_MINOR_X710 0x000E #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \ I40E_FW_API_VERSION_MINOR_X710 : \ @@ -267,7 +267,8 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_nvm_update = 0x0703, i40e_aqc_opc_nvm_config_read = 0x0704, i40e_aqc_opc_nvm_config_write = 0x0705, - i40e_aqc_opc_nvm_progress = 0x0706, + i40e_aqc_opc_nvm_update_in_process = 0x0706, + i40e_aqc_opc_rollback_revision_update = 0x0707, i40e_aqc_opc_oem_post_update = 0x0720, i40e_aqc_opc_thermal_sensor = 0x0721, @@ -467,6 +468,7 @@ struct i40e_aqc_list_capabilities_element_resp { #define I40E_AQ_CAP_ID_SDP 0x0062 #define I40E_AQ_CAP_ID_MDIO 0x0063 #define I40E_AQ_CAP_ID_WSR_PROT 0x0064 +#define I40E_AQ_CAP_ID_DIS_UNUSED_PORTS 0x0067 #define I40E_AQ_CAP_ID_NVM_MGMT 0x0080 #define I40E_AQ_CAP_ID_FLEX10 0x00F1 #define I40E_AQ_CAP_ID_CEM 0x00F2 @@ -793,6 +795,7 @@ struct i40e_aqc_set_switch_config { #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001 #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002 #define I40E_AQ_SET_SWITCH_CFG_HW_ATR_EVICT 0x0004 +#define I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN 0x0008 __le16 valid_flags; /* The ethertype in switch_tag is dropped on ingress and used * internally by the switch. Set this to zero for the default @@ -929,7 +932,7 @@ struct i40e_aqc_vsi_properties_data { u8 sec_reserved; /* VLAN section */ __le16 pvid; /* VLANS include priority bits */ - __le16 fcoe_pvid; + __le16 outer_vlan; u8 port_vlan_flags; #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00 #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \ @@ -945,7 +948,24 @@ struct i40e_aqc_vsi_properties_data { #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08 #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10 #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18 - u8 pvlan_reserved[3]; + u8 outer_vlan_flags; +#define I40E_AQ_VSI_OVLAN_MODE_SHIFT 0x00 +#define I40E_AQ_VSI_OVLAN_MODE_MASK (0x03 << \ + I40E_AQ_VSI_OVLAN_MODE_SHIFT) +#define I40E_AQ_VSI_OVLAN_MODE_UNTAGGED 0x01 +#define I40E_AQ_VSI_OVLAN_MODE_TAGGED 0x02 +#define I40E_AQ_VSI_OVLAN_MODE_ALL 0x03 +#define I40E_AQ_VSI_OVLAN_INSERT_PVID 0x04 +#define I40E_AQ_VSI_OVLAN_EMOD_SHIFT 0x03 +#define I40E_AQ_VSI_OVLAN_EMOD_MASK (0x03 <<\ + I40E_AQ_VSI_OVLAN_EMOD_SHIFT) +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_ALL 0x00 +#define I40E_AQ_VSI_OVLAN_EMOD_SHOW_UP 0x01 +#define I40E_AQ_VSI_OVLAN_EMOD_HIDE_ALL 0x02 +#define I40E_AQ_VSI_OVLAN_EMOD_NOTHING 0x03 +#define I40E_AQ_VSI_OVLAN_CTRL_ENA 0x04 + + u8 pvlan_reserved[2]; /* ingress egress up sections */ __le32 ingress_table; /* bitmap, 3 bits per up */ #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0 @@ -1247,7 +1267,7 @@ struct i40e_aqc_set_vsi_promiscuous_modes { #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04 #define I40E_AQC_SET_VSI_DEFAULT 0x08 #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10 -#define I40E_AQC_SET_VSI_PROMISC_TX 0x8000 +#define I40E_AQC_SET_VSI_PROMISC_RX_ONLY 0x8000 __le16 seid; #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF __le16 vlan_tag; @@ -1433,6 +1453,8 @@ struct i40e_aqc_cloud_filters_element_data { #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C +#define I40E_AQC_ADD_CLOUD_FILTER_OIP1 0x0010 +#define I40E_AQC_ADD_CLOUD_FILTER_OIP2 0x0012 /* 0x000D reserved */ /* 0x000E reserved */ /* 0x000F reserved */ @@ -1940,8 +1962,10 @@ enum i40e_aq_phy_type { I40E_PHY_TYPE_25GBASE_LR = 0x22, I40E_PHY_TYPE_25GBASE_AOC = 0x23, I40E_PHY_TYPE_25GBASE_ACC = 0x24, - I40E_PHY_TYPE_2_5GBASE_T = 0x30, - I40E_PHY_TYPE_5GBASE_T = 0x31, + I40E_PHY_TYPE_2_5GBASE_T = 0x26, + I40E_PHY_TYPE_5GBASE_T = 0x27, + I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS = 0x30, + I40E_PHY_TYPE_5GBASE_T_LINK_STATUS = 0x31, I40E_PHY_TYPE_MAX, I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP = 0xFD, I40E_PHY_TYPE_EMPTY = 0xFE, @@ -2411,6 +2435,16 @@ struct i40e_aqc_nvm_config_data_feature { I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature); +/* NVM Update in Process (direct 0x0706) */ +struct i40e_aqc_nvm_update_in_process { + u8 command; +#define I40E_AQ_UPDATE_FLOW_END 0x0 +#define I40E_AQ_UPDATE_FLOW_START 0x1 + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update_in_process); + struct i40e_aqc_nvm_config_data_immediate_field { __le32 field_id; __le32 field_value; @@ -2420,6 +2454,27 @@ struct i40e_aqc_nvm_config_data_immediate_field { I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field); +/* Minimal Rollback Revision Update (direct 0x0707) */ +struct i40e_aqc_rollback_revision_update { + u8 optin_mode; /* bool */ +#define I40E_AQ_RREV_OPTIN_MODE 0x01 + u8 module_selected; +#define I40E_AQ_RREV_MODULE_PCIE_ANALOG 0 +#define I40E_AQ_RREV_MODULE_PHY_ANALOG 1 +#define I40E_AQ_RREV_MODULE_OPTION_ROM 2 +#define I40E_AQ_RREV_MODULE_EMP_IMAGE 3 +#define I40E_AQ_RREV_MODULE_PE_IMAGE 4 +#define I40E_AQ_RREV_MODULE_PHY_PLL_O_CONFIGURATION 5 +#define I40E_AQ_RREV_MODULE_PHY_0_CONFIGURATION 6 +#define I40E_AQ_RREV_MODULE_PHY_PLL_1_CONFIGURATION 7 +#define I40E_AQ_RREV_MODULE_PHY_1_CONFIGURATION 8 + u8 reserved1[2]; + u32 min_rrev; + u8 reserved2[8]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_rollback_revision_update); + /* OEM Post Update (indirect 0x0720) * no command data struct used */ diff --git a/sys/dev/ixl/i40e_common.c b/sys/dev/ixl/i40e_common.c index 4325901c0920..332893938c19 100644 --- a/sys/dev/ixl/i40e_common.c +++ b/sys/dev/ixl/i40e_common.c @@ -1251,12 +1251,15 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_40GBASE_LR4: case I40E_PHY_TYPE_25GBASE_LR: case I40E_PHY_TYPE_25GBASE_SR: + case I40E_PHY_TYPE_10GBASE_AOC: + case I40E_PHY_TYPE_25GBASE_AOC: + case I40E_PHY_TYPE_40GBASE_AOC: media = I40E_MEDIA_TYPE_FIBER; break; case I40E_PHY_TYPE_100BASE_TX: case I40E_PHY_TYPE_1000BASE_T: - case I40E_PHY_TYPE_2_5GBASE_T: - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: case I40E_PHY_TYPE_10GBASE_T: media = I40E_MEDIA_TYPE_BASET; break; @@ -1265,10 +1268,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) case I40E_PHY_TYPE_10GBASE_CR1: case I40E_PHY_TYPE_40GBASE_CR4: case I40E_PHY_TYPE_10GBASE_SFPP_CU: - case I40E_PHY_TYPE_40GBASE_AOC: - case I40E_PHY_TYPE_10GBASE_AOC: case I40E_PHY_TYPE_25GBASE_CR: - case I40E_PHY_TYPE_25GBASE_AOC: case I40E_PHY_TYPE_25GBASE_ACC: media = I40E_MEDIA_TYPE_DA; break; @@ -1316,7 +1316,7 @@ static enum i40e_status_code i40e_poll_globr(struct i40e_hw *hw, return I40E_ERR_RESET_FAILED; } -#define I40E_PF_RESET_WAIT_COUNT 200 +#define I40E_PF_RESET_WAIT_COUNT 1000 /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -1563,7 +1563,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int idx) **/ u32 i40e_led_get(struct i40e_hw *hw) { - u32 current_mode = 0; u32 mode = 0; int i; @@ -1576,20 +1575,6 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT; @@ -1610,7 +1595,6 @@ u32 i40e_led_get(struct i40e_hw *hw) **/ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) { - u32 current_mode = 0; int i; if (mode & ~I40E_LED_MODE_VALID) { @@ -1627,20 +1611,6 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) if (!gpio_val) continue; - /* ignore gpio LED src mode entries related to the activity - * LEDs - */ - current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) - >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); - switch (current_mode) { - case I40E_COMBINED_ACTIVITY: - case I40E_FILTER_ACTIVITY: - case I40E_MAC_ACTIVITY: - case I40E_LINK_ACTIVITY: - continue; - default: - break; - } if (I40E_IS_X710TL_DEVICE(hw->device_id)) { u32 pin_func = 0; @@ -2053,6 +2023,9 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw, hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; + /* 'Get Link Status' response data structure from X722 FW has + * different format and does not contain this information + */ if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && hw->mac.type != I40E_MAC_X722) { __le32 tmp; @@ -2251,6 +2224,22 @@ enum i40e_status_code i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags, return status; } +/** + * i40e_hw_ver_ge + * @hw: pointer to the hw struct + * @maj: api major value + * @min: api minor value + * + * Assert whether current HW api version is greater/equal than provided. + **/ +static bool i40e_hw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) +{ + if (hw->aq.api_maj_ver > maj || + (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)) + return TRUE; + return FALSE; +} + /** * i40e_aq_add_vsi * @hw: pointer to the hw struct @@ -2376,18 +2365,16 @@ enum i40e_status_code i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, if (set) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; - if (rx_only_promisc && - (((hw->aq.api_maj_ver == 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1))) - flags |= I40E_AQC_SET_VSI_PROMISC_TX; + if (rx_only_promisc && i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); - if (((hw->aq.api_maj_ver >= 1) && (hw->aq.api_min_ver >= 5)) || - (hw->aq.api_maj_ver > 1)) - cmd->valid_flags |= CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_TX); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); @@ -2519,11 +2506,17 @@ enum i40e_status_code i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw, i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_set_vsi_promiscuous_modes); - if (enable) + if (enable) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; + if (i40e_hw_ver_ge(hw, 1, 5)) + flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; + } cmd->promiscuous_flags = CPU_TO_LE16(flags); cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_UNICAST); + if (i40e_hw_ver_ge(hw, 1, 5)) + cmd->valid_flags |= + CPU_TO_LE16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = CPU_TO_LE16(seid); cmd->vlan_tag = CPU_TO_LE16(vid | I40E_AQC_SET_VSI_VLAN_VALID); @@ -2633,7 +2626,7 @@ enum i40e_status_code i40e_aq_set_vsi_vlan_promisc(struct i40e_hw *hw, } /** - * i40e_get_vsi_params - get VSI configuration info + * i40e_aq_get_vsi_params - get VSI configuration info * @hw: pointer to the hw struct * @vsi_ctx: pointer to a vsi context struct * @cmd_details: pointer to command details structure or NULL @@ -2893,7 +2886,7 @@ enum i40e_status_code i40e_get_link_status(struct i40e_hw *hw, bool *link_up) } /** - * i40e_updatelink_status - update status of the HW network link + * i40e_update_link_info - update status of the HW network link * @hw: pointer to the hw struct **/ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) @@ -2906,10 +2899,13 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) return status; /* extra checking needed to ensure link info to user is timely */ - if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && - ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || - !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, + if (((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && + ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || + !(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) || + hw->mac.type == I40E_MAC_X722) { + status = i40e_aq_get_phy_capabilities(hw, FALSE, + hw->mac.type == + I40E_MAC_X722, &abilities, NULL); if (status) return status; @@ -3666,6 +3662,64 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, return status; } +/** + * i40e_aq_nvm_update_in_process + * @hw: pointer to the hw struct + * @update_flow_state: True indicates that update flow starts, FALSE that ends + * @cmd_details: pointer to command details structure or NULL + * + * Indicate NVM update in process. + **/ +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_nvm_update_in_process *cmd = + (struct i40e_aqc_nvm_update_in_process *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, + i40e_aqc_opc_nvm_update_in_process); + + cmd->command = I40E_AQ_UPDATE_FLOW_END; + + if (update_flow_state) + cmd->command |= I40E_AQ_UPDATE_FLOW_START; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + +/** + * i40e_aq_min_rollback_rev_update - triggers an ow after update + * @hw: pointer to the hw struct + * @mode: opt-in mode, 1b for single module update, 0b for bulk update + * @module: module to be updated. Ignored if mode is 0b + * @min_rrev: value of the new minimal version. Ignored if mode is 0b + * @cmd_details: pointer to command details structure or NULL + **/ +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details) +{ + struct i40e_aq_desc desc; + struct i40e_aqc_rollback_revision_update *cmd = + (struct i40e_aqc_rollback_revision_update *)&desc.params.raw; + enum i40e_status_code status; + + i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_rollback_revision_update); + cmd->optin_mode = mode; + cmd->module_selected = module; + cmd->min_rrev = min_rrev; + + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); + + return status; +} + /** * i40e_aq_oem_post_update - triggers an OEM specific flow after update * @hw: pointer to the hw struct @@ -3998,7 +4052,13 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, p->wr_csr_prot |= (u64)logical_id << 32; i40e_debug(hw, I40E_DEBUG_INIT, "HW Capability: wr_csr_prot = 0x%llX\n\n", - (p->wr_csr_prot & 0xffff)); + (unsigned long long)(p->wr_csr_prot & 0xffff)); + break; + case I40E_AQ_CAP_ID_DIS_UNUSED_PORTS: + p->dis_unused_ports = (bool)number; + i40e_debug(hw, I40E_DEBUG_INIT, + "HW Capability: dis_unused_ports = %d\n\n", + p->dis_unused_ports); break; case I40E_AQ_CAP_ID_NVM_MGMT: if (number & I40E_NVM_MGMT_SEC_REV_DISABLED) @@ -4193,28 +4253,6 @@ i40e_aq_update_nvm_exit: return status; } -/** - * i40e_aq_nvm_progress - * @hw: pointer to the hw struct - * @progress: pointer to progress returned from AQ - * @cmd_details: pointer to command details structure or NULL - * - * Gets progress of flash rearrangement process - **/ -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, - struct i40e_asq_cmd_details *cmd_details) -{ - enum i40e_status_code status; - struct i40e_aq_desc desc; - - DEBUGFUNC("i40e_aq_nvm_progress"); - - i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_progress); - status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); - *progress = desc.params.raw[0]; - return status; -} - /** * i40e_aq_get_lldp_mib * @hw: pointer to the hw struct @@ -4593,7 +4631,7 @@ enum i40e_status_code i40e_aq_del_udp_tunnel(struct i40e_hw *hw, u8 index, } /** - * i40e_aq_get_switch_resource_alloc (0x0204) + * i40e_aq_get_switch_resource_alloc - command (0x0204) to get allocations * @hw: pointer to the hw struct * @num_entries: pointer to u8 to store the number of resource entries returned * @buf: pointer to a user supplied buffer. This buffer must be large enough @@ -6705,7 +6743,7 @@ u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num) } /** - * i40e_blink_phy_led + * i40e_blink_phy_link_led * @hw: pointer to the HW structure * @time: time how long led will blinks in secs * @interval: gap between LED on and off in msecs @@ -6942,15 +6980,23 @@ enum i40e_status_code i40e_get_phy_lpi_status(struct i40e_hw *hw, struct i40e_hw_port_stats *stat) { enum i40e_status_code ret = I40E_SUCCESS; + bool eee_mrvl_phy; + bool eee_bcm_phy; u32 val; stat->rx_lpi_status = 0; stat->tx_lpi_status = 0; - if ((hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || - hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && - (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || - hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB)) { + eee_bcm_phy = + (hw->device_id == I40E_DEV_ID_10G_BASE_T_BC || + hw->device_id == I40E_DEV_ID_5G_BASE_T_BC) && + (hw->phy.link_info.link_speed == I40E_LINK_SPEED_2_5GB || + hw->phy.link_info.link_speed == I40E_LINK_SPEED_5GB); + eee_mrvl_phy = + hw->device_id == I40E_DEV_ID_1G_BASE_T_X722; + + if (eee_bcm_phy || eee_mrvl_phy) { + // read Clause 45 PCS Status 1 register ret = i40e_aq_get_phy_register(hw, I40E_AQ_PHY_REG_ACCESS_EXTERNAL, I40E_BCM_PHY_PCS_STATUS1_PAGE, @@ -7542,7 +7588,7 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, } /** - * i40e_aq_opc_set_ns_proxy_table_entry + * i40e_aq_set_ns_proxy_table_entry * @hw: pointer to the HW structure * @ns_proxy_table_entry: pointer to NS table entry command struct * @cmd_details: pointer to command details diff --git a/sys/dev/ixl/i40e_dcb.c b/sys/dev/ixl/i40e_dcb.c index b2f0b5c0acad..a02cbc80d361 100644 --- a/sys/dev/ixl/i40e_dcb.c +++ b/sys/dev/ixl/i40e_dcb.c @@ -265,7 +265,7 @@ static void i40e_parse_ieee_app_tlv(struct i40e_lldp_org_tlv *tlv, } /** - * i40e_parse_ieee_etsrec_tlv + * i40e_parse_ieee_tlv * @tlv: IEEE 802.1Qaz TLV * @dcbcfg: Local store to update ETS REC data * @@ -345,9 +345,15 @@ static void i40e_parse_cee_pgcfg_tlv(struct i40e_cee_feat_tlv *tlv, * |pg0|pg1|pg2|pg3|pg4|pg5|pg6|pg7| * --------------------------------- */ - for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { etscfg->tcbwtable[i] = buf[offset++]; + if (etscfg->prioritytable[i] == I40E_CEE_PGID_STRICT) + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_STRICT; + else + dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS; + } + /* Number of TCs supported (1 octet) */ etscfg->maxtcs = buf[offset]; } diff --git a/sys/dev/ixl/i40e_lan_hmc.c b/sys/dev/ixl/i40e_lan_hmc.c index c280393ef1c8..eb2c44c92067 100644 --- a/sys/dev/ixl/i40e_lan_hmc.c +++ b/sys/dev/ixl/i40e_lan_hmc.c @@ -546,7 +546,7 @@ configure_lan_hmc_out: } /** - * i40e_delete_hmc_object - remove hmc objects + * i40e_delete_lan_hmc_object - remove hmc objects * @hw: pointer to the HW structure * @info: pointer to i40e_hmc_delete_obj_info struct * diff --git a/sys/dev/ixl/i40e_nvm.c b/sys/dev/ixl/i40e_nvm.c index 20ba63a05b4e..58e5c1a0cdd9 100644 --- a/sys/dev/ixl/i40e_nvm.c +++ b/sys/dev/ixl/i40e_nvm.c @@ -35,7 +35,7 @@ #include "i40e_prototype.h" /** - * i40e_init_nvm_ops - Initialize NVM function pointers + * i40e_init_nvm - Initialize NVM function pointers * @hw: pointer to the HW structure * * Setup the function pointers and the NVM info structure. Should be called @@ -108,7 +108,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, if (ret_code) i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire type %d failed time_left=%llu ret=%d aq_err=%d\n", - access, time_left, ret_code, hw->aq.asq_last_status); + access, (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); if (ret_code && time_left) { /* Poll until the current NVM owner timeouts */ @@ -130,7 +131,8 @@ enum i40e_status_code i40e_acquire_nvm(struct i40e_hw *hw, hw->nvm.hw_semaphore_timeout = 0; i40e_debug(hw, I40E_DEBUG_NVM, "NVM acquire timed out, wait %llu ms before trying again. status=%d aq_err=%d\n", - time_left, ret_code, hw->aq.asq_last_status); + (unsigned long long)time_left, ret_code, + hw->aq.asq_last_status); } } @@ -782,10 +784,11 @@ enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw) DEBUGFUNC("i40e_update_nvm_checksum"); ret_code = i40e_calc_nvm_checksum(hw, &checksum); - le_sum = CPU_TO_LE16(checksum); - if (ret_code == I40E_SUCCESS) + if (ret_code == I40E_SUCCESS) { + le_sum = CPU_TO_LE16(checksum); ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD, 1, &le_sum, TRUE); + } return ret_code; } diff --git a/sys/dev/ixl/i40e_prototype.h b/sys/dev/ixl/i40e_prototype.h index 23ce2edb22a3..2febf9d6662d 100644 --- a/sys/dev/ixl/i40e_prototype.h +++ b/sys/dev/ixl/i40e_prototype.h @@ -268,6 +268,10 @@ enum i40e_status_code i40e_aq_write_nvm_config(struct i40e_hw *hw, u8 cmd_flags, void *data, u16 buf_size, u16 element_count, struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code +i40e_aq_min_rollback_rev_update(struct i40e_hw *hw, u8 mode, u8 module, + u32 min_rrev, + struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_oem_post_update(struct i40e_hw *hw, void *buff, u16 buff_size, struct i40e_asq_cmd_details *cmd_details); @@ -279,7 +283,11 @@ enum i40e_status_code i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer, u32 offset, u16 length, void *data, bool last_command, u8 preservation_flags, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_nvm_progress(struct i40e_hw *hw, u8 *progress, +enum i40e_status_code i40e_aq_rearrange_nvm(struct i40e_hw *hw, + u8 rearrange_nvm, + struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_nvm_update_in_process(struct i40e_hw *hw, + bool update_flow_state, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type, u8 mib_type, void *buff, u16 buff_size, diff --git a/sys/dev/ixl/i40e_register.h b/sys/dev/ixl/i40e_register.h index 6c57d0a25f7e..ffc6a7e506a6 100644 --- a/sys/dev/ixl/i40e_register.h +++ b/sys/dev/ixl/i40e_register.h @@ -232,6 +232,9 @@ #define I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLU_ERROR_CNT_SHIFT) #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT 24 #define I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_MASK I40E_MASK(0xFF, I40E_VFCM_PE_ERRINFO1_RLS_ERROR_CNT_SHIFT) +#define I40E_PRT_SWR_PM_THR 0x0026CD00 /* Reset: CORER */ +#define I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT 0 +#define I40E_PRT_SWR_PM_THR_THRESHOLD_MASK I40E_MASK(0xFF, I40E_PRT_SWR_PM_THR_THRESHOLD_SHIFT) #define I40E_GLDCB_GENC 0x00083044 /* Reset: CORER */ #define I40E_GLDCB_GENC_PCIRTT_SHIFT 0 #define I40E_GLDCB_GENC_PCIRTT_MASK I40E_MASK(0xFFFF, I40E_GLDCB_GENC_PCIRTT_SHIFT) diff --git a/sys/dev/ixl/i40e_type.h b/sys/dev/ixl/i40e_type.h index 699576ff5b43..f34002d7dc35 100644 --- a/sys/dev/ixl/i40e_type.h +++ b/sys/dev/ixl/i40e_type.h @@ -347,12 +347,8 @@ struct i40e_phy_info { I40E_PHY_TYPE_OFFSET) #define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ I40E_PHY_TYPE_OFFSET) -/* Offset for 2.5G/5G PHY Types value to bit number conversion */ -#define I40E_PHY_TYPE_OFFSET2 (-10) -#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) -#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) +#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) +#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T) #define I40E_HW_CAP_MAX_GPIO 30 #define I40E_HW_CAP_MDIO_PORT_MODE_MDIO 0 #define I40E_HW_CAP_MDIO_PORT_MODE_I2C 1 @@ -443,6 +439,7 @@ struct i40e_hw_capabilities { u32 enabled_tcmap; u32 maxtc; u64 wr_csr_prot; + bool dis_unused_ports; bool apm_wol_support; enum i40e_acpi_programming_method acpi_prog_method; bool proxy_support; @@ -975,7 +972,8 @@ enum i40e_rx_l2_ptype { I40E_RX_PTYPE_GRENAT4_MAC_PAY3 = 58, I40E_RX_PTYPE_GRENAT4_MACVLAN_IPV6_ICMP_PAY4 = 87, I40E_RX_PTYPE_GRENAT6_MAC_PAY3 = 124, - I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153 + I40E_RX_PTYPE_GRENAT6_MACVLAN_IPV6_ICMP_PAY4 = 153, + I40E_RX_PTYPE_PARSER_ABORTED = 255 }; struct i40e_rx_ptype_decoded { @@ -1551,6 +1549,9 @@ struct i40e_hw_port_stats { #define I40E_SR_CONFIGURATION_METADATA_PTR 0x4D #define I40E_SR_IMMEDIATE_VALUES_PTR 0x4E #define I40E_SR_5TH_FREE_PROVISION_AREA_PTR 0x50 +#define I40E_SR_PRESERVATION_RULES_PTR 0x70 +#define I40E_FPK_SR_5TH_FREE_PROVISION_AREA_PTR 0x71 +#define I40E_SR_6TH_FREE_PROVISION_AREA_PTR 0x71 /* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */ #define I40E_SR_VPD_MODULE_MAX_SIZE 1024 @@ -1720,6 +1721,8 @@ struct i40e_lldp_variables { #define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT) #define I40E_VERIFY_TAG_SHIFT 31 #define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT) +#define I40E_VLAN_SRC_SHIFT 55 +#define I40E_VLAN_SRC_MASK (0x1ULL << I40E_VLAN_SRC_SHIFT) #define I40E_FLEX_50_SHIFT 13 #define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index f620771e93b1..e7e6e31a7fca 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1514,11 +1514,11 @@ ixl_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr) ifmr->ifm_active |= IFM_1000_T; break; /* 2.5 G */ - case I40E_PHY_TYPE_2_5GBASE_T: + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_2500_T; break; /* 5 G */ - case I40E_PHY_TYPE_5GBASE_T: + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: ifmr->ifm_active |= IFM_5000_T; break; /* 10 G */ From owner-dev-commits-src-main@freebsd.org Mon Sep 13 21:23:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C792B6AA28A; Mon, 13 Sep 2021 21:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7fbz5C4Dz3hV9; Mon, 13 Sep 2021 21:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93AA06903; Mon, 13 Sep 2021 21:23:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DLNhJI078583; Mon, 13 Sep 2021 21:23:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DLNhjE078582; Mon, 13 Sep 2021 21:23:43 GMT (envelope-from git) Date: Mon, 13 Sep 2021 21:23:43 GMT Message-Id: <202109132123.18DLNhjE078582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2b6eec531a1b - main - x86: duplicate acpi_wakeup.c per i386 and amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b6eec531a1b52621223316f7c2940ed1e293886 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 21:23:43 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2b6eec531a1b52621223316f7c2940ed1e293886 commit 2b6eec531a1b52621223316f7c2940ed1e293886 Author: Konstantin Belousov AuthorDate: 2021-09-12 19:24:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-13 21:23:14 +0000 x86: duplicate acpi_wakeup.c per i386 and amd64 The file as is is the maze of #ifdef passages, all slightly different. Divorcing i386 and amd64 version actually makes changing the code easier, also no changes for i386 are planned. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31931 --- sys/{x86 => amd64}/acpica/acpi_wakeup.c | 87 +------ sys/conf/files.amd64 | 1 + sys/conf/files.i386 | 1 + sys/conf/files.x86 | 1 - sys/i386/acpica/acpi_wakeup.c | 391 ++++++++++++++++++++++++++++++++ 5 files changed, 394 insertions(+), 87 deletions(-) diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c similarity index 86% rename from sys/x86/acpica/acpi_wakeup.c rename to sys/amd64/acpica/acpi_wakeup.c index 68e0892a31e6..fba9532e9a64 100644 --- a/sys/x86/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -32,12 +32,6 @@ #include __FBSDID("$FreeBSD$"); -#if defined(__amd64__) -#define DEV_APIC -#else -#include "opt_apic.h" -#endif - #include #include #include @@ -60,10 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_APIC #include #include -#endif #ifdef SMP #include #include @@ -98,11 +90,7 @@ static int acpi_wakeup_ap(struct acpi_softc *, int); static void acpi_wakeup_cpus(struct acpi_softc *); #endif -#ifdef __amd64__ #define ACPI_WAKEPAGES 8 -#else -#define ACPI_WAKEPAGES 1 -#endif #define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ @@ -144,13 +132,8 @@ acpi_wakeup_ap(struct acpi_softc *sc, int cpu) } #define WARMBOOT_TARGET 0 -#ifdef __amd64__ #define WARMBOOT_OFF (KERNBASE + 0x0467) #define WARMBOOT_SEG (KERNBASE + 0x0469) -#else /* __i386__ */ -#define WARMBOOT_OFF (PMAP_MAP_LOW + 0x0467) -#define WARMBOOT_SEG (PMAP_MAP_LOW + 0x0469) -#endif #define CMOS_REG (0x70) #define CMOS_DATA (0x71) @@ -164,9 +147,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) int cpu; u_char mpbiosreason; -#ifdef __amd64__ if (!efi_boot) { -#endif /* save the current value of the warm-start vector */ mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); outb(CMOS_REG, BIOS_RESET); @@ -177,9 +158,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc) *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ -#ifdef __amd64__ } -#endif /* Wake up each AP. */ for (cpu = 1; cpu < mp_ncpus; cpu++) { @@ -193,27 +172,13 @@ acpi_wakeup_cpus(struct acpi_softc *sc) } } -#ifdef __i386__ - /* - * Remove the identity mapping of low memory for all CPUs and sync - * the TLB for the BSP. The APs are now spinning in - * cpususpend_handler() and we will release them soon. Then each - * will invalidate its TLB. - */ - pmap_remap_lowptdi(false); -#endif - -#ifdef __amd64__ if (!efi_boot) { -#endif /* restore the warmstart vector */ *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); -#ifdef __amd64__ } -#endif } #endif @@ -222,10 +187,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) { ACPI_STATUS status; struct pcb *pcb; -#ifdef __amd64__ struct pcpu *pc; int i; -#endif if (sc->acpi_wakeaddr == 0ul) return (-1); /* couldn't alloc wake memory */ @@ -244,18 +207,13 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) pcb = &susppcbs[0]->sp_pcb; if (savectx(pcb)) { -#ifdef __amd64__ fpususpend(susppcbs[0]->sp_fpususpend); -#else - npxsuspend(susppcbs[0]->sp_fpususpend); -#endif #ifdef SMP if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { device_printf(sc->acpi_dev, "Failed to suspend APs\n"); return (0); /* couldn't sleep */ } #endif -#ifdef __amd64__ hw_ibrs_ibpb_active = 0; hw_ssb_active = 0; cpu_stdext_feature3 = 0; @@ -263,36 +221,16 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) pc = pcpu_find(i); pc->pc_ibpb_set = 0; } -#endif WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); -#ifdef __amd64__ WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER) & ~(EFER_LMA)); -#else - if ((amd_feature & AMDID_NX) != 0) - WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); - WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4); -#endif WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); -#ifdef __i386__ - /* - * Map some low memory with virt == phys for ACPI wakecode - * to use to jump to high memory after enabling paging. This - * is the same as for similar jump in locore, except the - * jump is a single instruction, and we know its address - * more precisely so only need a single PTD, and we have to - * be careful to use the kernel map (PTD[0] is for curthread - * which may be a user thread in deprecated APIs). - */ - pmap_remap_lowptdi(true); -#endif - /* Call ACPICA to enter the desired sleep state */ if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios(); @@ -317,11 +255,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state) * this point. */ cnresume(); -#ifdef __amd64__ fpuresume(susppcbs[0]->sp_fpususpend); -#else - npxresume(susppcbs[0]->sp_fpususpend); -#endif } return (1); /* wakeup successfully */ @@ -343,9 +277,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); -#ifdef DEV_APIC lapic_xapic_mode(); -#endif #ifdef SMP if (!CPU_EMPTY(&suspcpus)) acpi_wakeup_cpus(sc); @@ -357,10 +289,8 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, resume_cpus(suspcpus); #endif mca_resume(); -#ifdef __amd64__ if (vmm_resume_p != NULL) vmm_resume_p(); -#endif intr_resume(/*suspend_cancelled*/false); AcpiSetFirmwareWakingVector(0, 0); @@ -390,11 +320,7 @@ acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) */ for (i = 0; i < ACPI_WAKEPAGES; i++) { wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT -#ifdef __i386__ - | M_EXEC -#endif - , 0x500, 0xa0000, PAGE_SIZE, 0ul); + M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); if (wakepages[i] == NULL) { printf("%s: can't alloc wake memory\n", __func__); goto freepages; @@ -425,11 +351,9 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) { static void *wakeaddr; void *wakepages[ACPI_WAKEPAGES]; -#ifdef __amd64__ uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; -#endif if (wakeaddr != NULL) return; @@ -441,7 +365,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; sc->acpi_wakephys = vtophys(wakeaddr); -#ifdef __amd64__ if (la57) { pt5 = wakepages[7]; pt5pa = vtophys(pt5); @@ -458,7 +381,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) pt2_1pa = vtophys(pt2_1); pt2_2pa = vtophys(pt2_2); pt2_3pa = vtophys(pt2_3); -#endif bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); @@ -467,18 +389,13 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) sc->acpi_wakephys + bootgdt); WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t, sc->acpi_wakephys + wakeup_32); -#ifdef __amd64__ WAKECODE_FIXUP((wakeup_sw64 + 1), uint32_t, sc->acpi_wakephys + wakeup_64); WAKECODE_FIXUP(wakeup_pagetables, uint32_t, la57 ? (pt5pa | 0x1) : pt4pa); -#endif /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); -#ifndef __amd64__ - WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); -#else /* __amd64__ */ /* Create 1:1 mapping for the low 4G */ if (la57) { bcopy(kernel_pmap->pm_pmltop, pt5, PAGE_SIZE); @@ -517,8 +434,6 @@ acpi_install_wakeup_handler(struct acpi_softc *sc) pt2_3[i] |= PG_V | PG_RW | PG_PS | PG_U; } -#endif /* !__amd64__ */ - if (bootverbose) device_printf(sc->acpi_dev, "wakeup code va %#jx pa %#jx\n", (uintmax_t)sc->acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys); diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 564e40564677..b50034f38d96 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -49,6 +49,7 @@ ia32_assym.h standard \ clean "ia32_assym.h" # amd64/acpica/acpi_machdep.c optional acpi +amd64/acpica/acpi_wakeup.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/amd64/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index f8320e710e98..af53a1ad7a8a 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -83,6 +83,7 @@ dev/vmd/vmd.c optional vmd dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd i386/acpica/acpi_machdep.c optional acpi +i386/acpica/acpi_wakeup.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.inc" \ compile-with "${NORMAL_S}" \ diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 925a3c5fe889..19c7dabd6001 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -285,7 +285,6 @@ libkern/x86/crc32_sse42.c standard # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi -x86/acpica/acpi_wakeup.c optional acpi x86/acpica/srat.c optional acpi x86/bios/vpd.c optional vpd x86/cpufreq/est.c optional cpufreq diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c new file mode 100644 index 000000000000..682e9613962f --- /dev/null +++ b/sys/i386/acpica/acpi_wakeup.c @@ -0,0 +1,391 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2001 Takanori Watanabe + * Copyright (c) 2001-2012 Mitsuru IWASAKI + * Copyright (c) 2003 Peter Wemm + * Copyright (c) 2008-2012 Jung-uk Kim + * 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 "opt_apic.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef DEV_APIC +#include +#include +#endif +#ifdef SMP +#include +#include +#endif + +#include + +#include + +#include "acpi_wakecode.h" +#include "acpi_wakedata.h" + +/* Make sure the code is less than a page and leave room for the stack. */ +CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024); + +extern int acpi_resume_beep; +extern int acpi_reset_video; +extern int acpi_susp_bounce; + +#ifdef SMP +extern struct susppcb **susppcbs; +static cpuset_t suspcpus; +#else +static struct susppcb **susppcbs; +#endif + +static void *acpi_alloc_wakeup_handler(void **); +static void acpi_stop_beep(void *); + +#ifdef SMP +static int acpi_wakeup_ap(struct acpi_softc *, int); +static void acpi_wakeup_cpus(struct acpi_softc *); +#endif + +#define ACPI_WAKEPAGES 1 + +#define WAKECODE_FIXUP(offset, type, val) do { \ + type *addr; \ + addr = (type *)(sc->acpi_wakeaddr + (offset)); \ + *addr = val; \ +} while (0) + +static void +acpi_stop_beep(void *arg) +{ + + if (acpi_resume_beep != 0) + timer_spkr_release(); +} + +#ifdef SMP +static int +acpi_wakeup_ap(struct acpi_softc *sc, int cpu) +{ + struct pcb *pcb; + int vector = (sc->acpi_wakephys >> 12) & 0xff; + int apic_id = cpu_apic_ids[cpu]; + int ms; + + pcb = &susppcbs[cpu]->sp_pcb; + WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); + WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); + WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); + + ipi_startup(apic_id, vector); + + /* Wait up to 5 seconds for it to resume. */ + for (ms = 0; ms < 5000; ms++) { + if (!CPU_ISSET(cpu, &suspended_cpus)) + return (1); /* return SUCCESS */ + DELAY(1000); + } + return (0); /* return FAILURE */ +} + +#define WARMBOOT_TARGET 0 +#define WARMBOOT_OFF (PMAP_MAP_LOW + 0x0467) +#define WARMBOOT_SEG (PMAP_MAP_LOW + 0x0469) + +#define CMOS_REG (0x70) +#define CMOS_DATA (0x71) +#define BIOS_RESET (0x0f) +#define BIOS_WARM (0x0a) + +static void +acpi_wakeup_cpus(struct acpi_softc *sc) +{ + uint32_t mpbioswarmvec; + int cpu; + u_char mpbiosreason; + + /* save the current value of the warm-start vector */ + mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF); + outb(CMOS_REG, BIOS_RESET); + mpbiosreason = inb(CMOS_DATA); + + /* setup a vector to our boot code */ + *((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET; + *((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4; + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ + + /* Wake up each AP. */ + for (cpu = 1; cpu < mp_ncpus; cpu++) { + if (!CPU_ISSET(cpu, &suspcpus)) + continue; + if (acpi_wakeup_ap(sc, cpu) == 0) { + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; + panic("acpi_wakeup: failed to resume AP #%d (PHY #%d)", + cpu, cpu_apic_ids[cpu]); + } + } + + /* + * Remove the identity mapping of low memory for all CPUs and sync + * the TLB for the BSP. The APs are now spinning in + * cpususpend_handler() and we will release them soon. Then each + * will invalidate its TLB. + */ + pmap_remap_lowptdi(false); + + /* restore the warmstart vector */ + *(uint32_t *)WARMBOOT_OFF = mpbioswarmvec; + + outb(CMOS_REG, BIOS_RESET); + outb(CMOS_DATA, mpbiosreason); +} +#endif + +int +acpi_sleep_machdep(struct acpi_softc *sc, int state) +{ + ACPI_STATUS status; + struct pcb *pcb; + + if (sc->acpi_wakeaddr == 0ul) + return (-1); /* couldn't alloc wake memory */ + +#ifdef SMP + suspcpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &suspcpus); +#endif + + if (acpi_resume_beep != 0) + timer_spkr_acquire(); + + AcpiSetFirmwareWakingVector(sc->acpi_wakephys, 0); + + intr_suspend(); + + pcb = &susppcbs[0]->sp_pcb; + if (savectx(pcb)) { + npxsuspend(susppcbs[0]->sp_fpususpend); +#ifdef SMP + if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) { + device_printf(sc->acpi_dev, "Failed to suspend APs\n"); + return (0); /* couldn't sleep */ + } +#endif + + WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); + WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); + + if ((amd_feature & AMDID_NX) != 0) + WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER)); + WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4); + WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb); + WAKECODE_FIXUP(wakeup_gdt, uint16_t, pcb->pcb_gdt.rd_limit); + WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, pcb->pcb_gdt.rd_base); + + /* + * Map some low memory with virt == phys for ACPI wakecode + * to use to jump to high memory after enabling paging. This + * is the same as for similar jump in locore, except the + * jump is a single instruction, and we know its address + * more precisely so only need a single PTD, and we have to + * be careful to use the kernel map (PTD[0] is for curthread + * which may be a user thread in deprecated APIs). + */ + pmap_remap_lowptdi(true); + + /* Call ACPICA to enter the desired sleep state */ + if (state == ACPI_STATE_S4 && sc->acpi_s4bios) + status = AcpiEnterSleepStateS4bios(); + else + status = AcpiEnterSleepState(state); + if (ACPI_FAILURE(status)) { + device_printf(sc->acpi_dev, + "AcpiEnterSleepState failed - %s\n", + AcpiFormatException(status)); + return (0); /* couldn't sleep */ + } + + if (acpi_susp_bounce) + resumectx(pcb); + + for (;;) + ia32_pause(); + } else { + /* + * Re-initialize console hardware as soon as possibe. + * No console output (e.g. printf) is allowed before + * this point. + */ + cnresume(); + npxresume(susppcbs[0]->sp_fpususpend); + } + + return (1); /* wakeup successfully */ +} + +int +acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, + int intr_enabled) +{ + + if (sleep_result == -1) + return (sleep_result); + + if (!intr_enabled) { + /* Wakeup MD procedures in interrupt disabled context */ + if (sleep_result == 1) { + ucode_reload(); + pmap_init_pat(); + initializecpu(); + PCPU_SET(switchtime, 0); + PCPU_SET(switchticks, ticks); +#ifdef DEV_APIC + lapic_xapic_mode(); +#endif +#ifdef SMP + if (!CPU_EMPTY(&suspcpus)) + acpi_wakeup_cpus(sc); +#endif + } + +#ifdef SMP + if (!CPU_EMPTY(&suspcpus)) + resume_cpus(suspcpus); +#endif + mca_resume(); + intr_resume(/*suspend_cancelled*/false); + + AcpiSetFirmwareWakingVector(0, 0); + } else { + /* Wakeup MD procedures in interrupt enabled context */ + if (sleep_result == 1 && mem_range_softc.mr_op != NULL && + mem_range_softc.mr_op->reinit != NULL) + mem_range_softc.mr_op->reinit(&mem_range_softc); + } + + return (sleep_result); +} + +static void * +acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) +{ + int i; + + memset(wakepages, 0, ACPI_WAKEPAGES * sizeof(*wakepages)); + + /* + * Specify the region for our wakeup code. We want it in the low 1 MB + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), + * and ROM area (0xa0000 and above). The temporary page tables must be + * page-aligned. + */ + for (i = 0; i < ACPI_WAKEPAGES; i++) { + wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, + M_NOWAIT | M_EXEC, 0x500, 0xa0000, PAGE_SIZE, 0ul); + if (wakepages[i] == NULL) { + printf("%s: can't alloc wake memory\n", __func__); + goto freepages; + } + } + if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, + EVENTHANDLER_PRI_LAST) == NULL) { + printf("%s: can't register event handler\n", __func__); + goto freepages; + } + susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); + for (i = 0; i < mp_ncpus; i++) { + susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); + susppcbs[i]->sp_fpususpend = alloc_fpusave(M_WAITOK); + } + + return (wakepages); + +freepages: + for (i = 0; i < ACPI_WAKEPAGES; i++) + if (wakepages[i] != NULL) + contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); + return (NULL); +} + +void +acpi_install_wakeup_handler(struct acpi_softc *sc) +{ + static void *wakeaddr; + void *wakepages[ACPI_WAKEPAGES]; + + if (wakeaddr != NULL) + return; + + if (acpi_alloc_wakeup_handler(wakepages) == NULL) + return; + + wakeaddr = wakepages[0]; + sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; + sc->acpi_wakephys = vtophys(wakeaddr); + + bcopy(wakecode, (void *)sc->acpi_wakeaddr, sizeof(wakecode)); + + /* Patch GDT base address, ljmp targets. */ + WAKECODE_FIXUP((bootgdtdesc + 2), uint32_t, + sc->acpi_wakephys + bootgdt); + WAKECODE_FIXUP((wakeup_sw32 + 2), uint32_t, + sc->acpi_wakephys + wakeup_32); + + /* Save pointers to some global data. */ + WAKECODE_FIXUP(wakeup_ret, void *, resumectx); + WAKECODE_FIXUP(wakeup_cr3, register_t, pmap_get_kcr3()); + + if (bootverbose) + device_printf(sc->acpi_dev, "wakeup code va %#jx pa %#jx\n", + (uintmax_t)sc->acpi_wakeaddr, (uintmax_t)sc->acpi_wakephys); +} From owner-dev-commits-src-main@freebsd.org Mon Sep 13 21:23:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FD196A9FC2; Mon, 13 Sep 2021 21:23:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7fc06rCKz3hRL; Mon, 13 Sep 2021 21:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B41DD6904; Mon, 13 Sep 2021 21:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18DLNi4i078608; Mon, 13 Sep 2021 21:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18DLNiYd078607; Mon, 13 Sep 2021 21:23:44 GMT (envelope-from git) Date: Mon, 13 Sep 2021 21:23:44 GMT Message-Id: <202109132123.18DLNiYd078607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1c56781cc915 - main - amd64 wakeup: rework trampoline page allocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c56781cc915d1d2957e5b53717513193476d777 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2021 21:23:45 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1c56781cc915d1d2957e5b53717513193476d777 commit 1c56781cc915d1d2957e5b53717513193476d777 Author: Konstantin Belousov AuthorDate: 2021-09-12 19:41:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-13 21:23:15 +0000 amd64 wakeup: rework trampoline page allocation There is no need to restrict trampoline page table to low 1M, it should work with any pages below 4G. Only wakeup code itself should be below 1M. Do not waste level 5 page when LA48 mode is used. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31931 --- sys/amd64/acpica/acpi_wakeup.c | 79 +++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index fba9532e9a64..0f04ccb6f2fc 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -82,7 +83,6 @@ static cpuset_t suspcpus; static struct susppcb **susppcbs; #endif -static void *acpi_alloc_wakeup_handler(void **); static void acpi_stop_beep(void *); #ifdef SMP @@ -90,7 +90,7 @@ static int acpi_wakeup_ap(struct acpi_softc *, int); static void acpi_wakeup_cpus(struct acpi_softc *); #endif -#define ACPI_WAKEPAGES 8 +#define ACPI_WAKEPT_PAGES 7 #define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ @@ -304,27 +304,35 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result, return (sleep_result); } -static void * -acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) +static void +acpi_alloc_wakeup_handler(void **wakeaddr, + void *wakept_pages[ACPI_WAKEPT_PAGES]) { - int i; + vm_page_t wakept_m[ACPI_WAKEPT_PAGES]; + int i; - memset(wakepages, 0, ACPI_WAKEPAGES * sizeof(*wakepages)); + *wakeaddr = NULL; + memset(wakept_pages, 0, ACPI_WAKEPT_PAGES * sizeof(*wakept_pages)); + memset(wakept_m, 0, ACPI_WAKEPT_PAGES * sizeof(*wakept_m)); /* - * Specify the region for our wakeup code. We want it in the low 1 MB - * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA - * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT), - * and ROM area (0xa0000 and above). The temporary page tables must be - * page-aligned. + * Specify the region for our wakeup code. We want it in the + * low 1 MB region, excluding real mode IVT (0-0x3ff), BDA + * (0x400-0x4ff), EBDA (less than 128KB, below 0xa0000, must + * be excluded by SMAP and DSDT), and ROM area (0xa0000 and + * above). */ - for (i = 0; i < ACPI_WAKEPAGES; i++) { - wakepages[i] = contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); - if (wakepages[i] == NULL) { - printf("%s: can't alloc wake memory\n", __func__); - goto freepages; - } + *wakeaddr = contigmalloc(PAGE_SIZE, M_DEVBUF, + M_NOWAIT, 0x500, 0xa0000, PAGE_SIZE, 0ul); + if (*wakeaddr == NULL) { + printf("%s: can't alloc wake memory\n", __func__); + goto freepages; + } + + for (i = 0; i < ACPI_WAKEPT_PAGES - (la57 ? 0 : 1); i++) { + wakept_m[i] = pmap_page_alloc_below_4g(true); + wakept_pages[i] = (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( + wakept_m[i])); } if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST) == NULL) { @@ -336,45 +344,46 @@ acpi_alloc_wakeup_handler(void *wakepages[ACPI_WAKEPAGES]) susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); susppcbs[i]->sp_fpususpend = alloc_fpusave(M_WAITOK); } - - return (wakepages); + return; freepages: - for (i = 0; i < ACPI_WAKEPAGES; i++) - if (wakepages[i] != NULL) - contigfree(wakepages[i], PAGE_SIZE, M_DEVBUF); - return (NULL); + if (*wakeaddr != NULL) + contigfree(*wakeaddr, PAGE_SIZE, M_DEVBUF); + for (i = 0; i < ACPI_WAKEPT_PAGES; i++) { + if (wakept_m[i] != NULL) + vm_page_free(wakept_m[i]); + } + *wakeaddr = NULL; } void acpi_install_wakeup_handler(struct acpi_softc *sc) { static void *wakeaddr; - void *wakepages[ACPI_WAKEPAGES]; + void *wakept_pages[ACPI_WAKEPT_PAGES]; uint64_t *pt5, *pt4, *pt3, *pt2_0, *pt2_1, *pt2_2, *pt2_3; vm_paddr_t pt5pa, pt4pa, pt3pa, pt2_0pa, pt2_1pa, pt2_2pa, pt2_3pa; int i; if (wakeaddr != NULL) return; - - if (acpi_alloc_wakeup_handler(wakepages) == NULL) + acpi_alloc_wakeup_handler(&wakeaddr, wakept_pages); + if (wakeaddr == NULL) return; - wakeaddr = wakepages[0]; sc->acpi_wakeaddr = (vm_offset_t)wakeaddr; sc->acpi_wakephys = vtophys(wakeaddr); if (la57) { - pt5 = wakepages[7]; + pt5 = wakept_pages[6]; pt5pa = vtophys(pt5); } - pt4 = wakepages[1]; - pt3 = wakepages[2]; - pt2_0 = wakepages[3]; - pt2_1 = wakepages[4]; - pt2_2 = wakepages[5]; - pt2_3 = wakepages[6]; + pt4 = wakept_pages[0]; + pt3 = wakept_pages[1]; + pt2_0 = wakept_pages[2]; + pt2_1 = wakept_pages[3]; + pt2_2 = wakept_pages[4]; + pt2_3 = wakept_pages[5]; pt4pa = vtophys(pt4); pt3pa = vtophys(pt3); pt2_0pa = vtophys(pt2_0); From owner-dev-commits-src-main@freebsd.org Tue Sep 14 03:39:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21691660072 for ; Tue, 14 Sep 2021 03:39:34 +0000 (UTC) (envelope-from wma@semihalf.com) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7pxd6ydhz3Gg9 for ; Tue, 14 Sep 2021 03:39:33 +0000 (UTC) (envelope-from wma@semihalf.com) Received: by mail-yb1-xb2f.google.com with SMTP id v10so25070004ybq.7 for ; Mon, 13 Sep 2021 20:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=otQrQW8V9U2Pw2OfQW78sPF84cpbU3v3gQYpi46BB3k=; b=fERXj0YHGIRak+mAyFlNH8Mvl9CrWiry8LT5fAg1jIkMIcyITUppMCfhsbKdjJfhxF jf9e69Fm2lH3Hq1v4isrNZwOJOFoAKBGH8HNFlsr1g4z/biLVlkGHr2vnyQuCHwNmv+h nl9nu1iHW7dgvs8V0no6DWX9Uj4NpGT2gtGKe9hA1B1jdcFMljPM6zNMcYOUlW52KJfY Tnpq3Zd6DEaJ1deDZ2L2DWKLw1pYHIjB+CQcZoP7QP54+i9FPCfSRtYLcPTSaAjOIKCi Csg7in2ZAeMZ+KcmoKSi6LISbrxkWJEkiyYkigiX8/dQo+wq2/s+/1ZSGLTe1I1Nq7LJ MeuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=otQrQW8V9U2Pw2OfQW78sPF84cpbU3v3gQYpi46BB3k=; b=TlLNoNXE3QIjLOk4uVvAnFJDHwKX1fu3vpaNwefqxRy5l3qccY76PyhCsr41OlBsZX LsQVZ3jZp5X0ofdR12V+CGHrbPkpg18xmadsdP1NSOgeDUXgirV+GUcN0f/NUSfeQA7r bYi16dvbU4sWJnIM/HJpeKmItQX5EeEPQr1OlVEQkfV2sxlvAXP1YU7HIu7yDahuGSrf 5l4mt+g0a653akdGQkfFxGeAoexKasJy3qq61Z6tQd8AT6ZGG3ihSEbUZByzYc49qJMo CZaV3h1ptf8Rq3BWlsoNILh7I6Du/VKDl20DDhiYs3H1CPDjkWw9Ze2K9cJk80bqxQIJ B63A== X-Gm-Message-State: AOAM533ivLsBcgvreYJv/FN3td+neWB8C6bWloVrZa1+1GlqUbqKFtsQ iJimX5VPF5ZkywXpYzUtVq7xg+LrZTYTYabGloX1dd1APho= X-Google-Smtp-Source: ABdhPJwuSpB1/NdAIQJAOAkMxx5Ex1p2FH/uollfXhG2VJn7qtrD8MGk+p2O7usasOBi9hzZscy3mSxTIsh9vkrCifc= X-Received: by 2002:a25:7ec3:: with SMTP id z186mr18852918ybc.147.1631590766806; Mon, 13 Sep 2021 20:39:26 -0700 (PDT) MIME-Version: 1.0 References: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> In-Reply-To: From: Wojciech Macek Date: Tue, 14 Sep 2021 05:39:15 +0200 Message-ID: Subject: Re: git: 6fa041d7f125 - main - Measure latency of PMC interruptions To: Mitchell Horne Cc: Wojciech Macek , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4H7pxd6ydhz3Gg9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 03:39:34 -0000 Hi, Thanks for comments, I'll handle all of them as well as docs. Wojtek pon., 13 wrz 2021 o 22:06 Mitchell Horne napisa=C5=82(= a): > On Mon, Sep 13, 2021 at 1:11 AM Wojciech Macek wrote: > > > > The branch main has been updated by wma: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D6fa041d7f125db65f400af7f520a41f= f78d19cd7 > > > > commit 6fa041d7f125db65f400af7f520a41ff78d19cd7 > > Author: Wojciech Macek > > AuthorDate: 2021-09-13 04:08:32 +0000 > > Commit: Wojciech Macek > > CommitDate: 2021-09-13 04:08:32 +0000 > > > > Measure latency of PMC interruptions > > > > Add HWPMC events to measure latency. > > Provide sysctl to choose the number of outstanding events which > > trigger HWPMC event. > > > > Obtained from: Semihalf > > Sponsored by: Stormshield > > Differential revision: https://reviews.freebsd.org/D31283 > > --- > > sys/kern/kern_intr.c | 58 > ++++++++++++++++++++++++++++++++++++++++++++++------ > > 1 file changed, 52 insertions(+), 6 deletions(-) > > > > diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c > > index 1660414a50ef..19401877dfbd 100644 > > --- a/sys/kern/kern_intr.c > > +++ b/sys/kern/kern_intr.c > > @@ -30,6 +30,7 @@ > > __FBSDID("$FreeBSD$"); > > > > #include "opt_ddb.h" > > +#include "opt_hwpmc_hooks.h" > > #include "opt_kstack_usage_prof.h" > > > > #include > > @@ -75,6 +76,7 @@ struct intr_thread { > > struct thread *it_thread; /* Kernel thread. */ > > int it_flags; /* (j) IT_* flags. */ > > int it_need; /* Needs service. */ > > + int it_waiting; /* Waiting in the runq. */ > > }; > > > > /* Interrupt thread flags kept in it_flags */ > > @@ -100,13 +102,19 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, > CTLFLAG_RWTUN, > > static int intr_epoch_batch =3D 1000; > > SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, > &intr_epoch_batch, > > 0, "Maximum interrupt handler executions without re-entering > epoch(9)"); > > +#ifdef HWPMC_HOOKS > > +static int intr_hwpmc_waiting_report_threshold =3D 1; > > +SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, > CTLFLAG_RWTUN, > > + &intr_hwpmc_waiting_report_threshold, 1, > > + "Threshold for reporting number of events in a workq"); > > +#endif > > static TAILQ_HEAD(, intr_event) event_list =3D > > TAILQ_HEAD_INITIALIZER(event_list); > > static struct mtx event_lock; > > MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF); > > > > static void intr_event_update(struct intr_event *ie); > > -static int intr_event_schedule_thread(struct intr_event *ie); > > +static int intr_event_schedule_thread(struct intr_event *ie, struc= t > trapframe *frame); > > static struct intr_thread *ithread_create(const char *name); > > static void ithread_destroy(struct intr_thread *ithread); > > static void ithread_execute_handlers(struct proc *p, > > @@ -115,6 +123,16 @@ static void ithread_loop(void *); > > static void ithread_update(struct intr_thread *ithd); > > static void start_softintr(void *); > > > > +#ifdef HWPMC_HOOKS > > +#include > > +PMC_SOFT_DEFINE( , , intr, all); > > +PMC_SOFT_DEFINE( , , intr, ithread); > > +PMC_SOFT_DEFINE( , , intr, filter); > > +PMC_SOFT_DEFINE( , , intr, stray); > > +PMC_SOFT_DEFINE( , , intr, schedule); > > +PMC_SOFT_DEFINE( , , intr, waiting); > > +#endif > > + > > Hi Wojciech, > > Do you plan to document these new events in the pmc.soft(3) man page? > > Cheers, > Mitchell > > > > /* Map an interrupt type to an ithread priority. */ > > u_char > > intr_priority(enum intr_type flags) > > @@ -773,7 +791,7 @@ intr_handler_barrier(struct intr_handler *handler) > > } > > if ((handler->ih_flags & IH_CHANGED) =3D=3D 0) { > > handler->ih_flags |=3D IH_CHANGED; > > - intr_event_schedule_thread(ie); > > + intr_event_schedule_thread(ie, NULL); > > } > > while ((handler->ih_flags & IH_CHANGED) !=3D 0) > > msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); > > @@ -872,7 +890,7 @@ intr_event_remove_handler(void *cookie) > > KASSERT((handler->ih_flags & IH_DEAD) =3D=3D 0, > > ("duplicate handle remove")); > > handler->ih_flags |=3D IH_DEAD; > > - intr_event_schedule_thread(ie); > > + intr_event_schedule_thread(ie, NULL); > > while (handler->ih_flags & IH_DEAD) > > msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0); > > intr_event_update(ie); > > @@ -944,7 +962,7 @@ intr_event_resume_handler(void *cookie) > > } > > > > static int > > -intr_event_schedule_thread(struct intr_event *ie) > > +intr_event_schedule_thread(struct intr_event *ie, struct trapframe > *frame) > > { > > struct intr_entropy entropy; > > struct intr_thread *it; > > @@ -986,11 +1004,28 @@ intr_event_schedule_thread(struct intr_event *ie= ) > > atomic_store_rel_int(&it->it_need, 1); > > thread_lock(td); > > if (TD_AWAITING_INTR(td)) { > > +#ifdef HWPMC_HOOKS > > + atomic_set_int(&it->it_waiting, 0); > > + if (frame !=3D NULL) > > + PMC_SOFT_CALL_TF( , , intr, schedule, frame); > > + else > > + PMC_SOFT_CALL( , , intr, schedule); > > +#endif > > CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, > td->td_proc->p_pid, > > td->td_name); > > TD_CLR_IWAIT(td); > > sched_add(td, SRQ_INTR); > > } else { > > +#ifdef HWPMC_HOOKS > > + atomic_add_int(&it->it_waiting, 1); > > + > > + if (atomic_load_int(&it->it_waiting) >=3D > intr_hwpmc_waiting_report_threshold) { > > + if (frame !=3D NULL) > > + PMC_SOFT_CALL_TF( , , intr, waiting, > frame); > > + else > > + PMC_SOFT_CALL( , , intr, waiting); > > + } > > +#endif > > CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", > > __func__, td->td_proc->p_pid, td->td_name, > it->it_need, TD_GET_STATE(td)); > > thread_unlock(td); > > @@ -1083,7 +1118,7 @@ swi_sched(void *cookie, int flags) > > #endif > > } else { > > VM_CNT_INC(v_soft); > > - error =3D intr_event_schedule_thread(ie); > > + error =3D intr_event_schedule_thread(ie, NULL); > > KASSERT(error =3D=3D 0, ("stray software interrupt")); > > } > > } > > @@ -1374,12 +1409,23 @@ intr_event_handle(struct intr_event *ie, struct > trapframe *frame) > > ret =3D ih->ih_filter(frame); > > else > > ret =3D ih->ih_filter(ih->ih_argument); > > +#ifdef HWPMC_HOOKS > > + PMC_SOFT_CALL_TF( , , intr, all, frame); > > +#endif > > KASSERT(ret =3D=3D FILTER_STRAY || > > ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) > !=3D 0 && > > (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) > =3D=3D 0), > > ("%s: incorrect return value %#x from %s", __func__= , > ret, > > ih->ih_name)); > > filter =3D filter || ret =3D=3D FILTER_HANDLED; > > +#ifdef HWPMC_HOOKS > > + if (ret & FILTER_SCHEDULE_THREAD) > > + PMC_SOFT_CALL_TF( , , intr, ithread, frame); > > + else if (ret & FILTER_HANDLED) > > + PMC_SOFT_CALL_TF( , , intr, filter, frame); > > + else if (ret =3D=3D FILTER_STRAY) > > + PMC_SOFT_CALL_TF( , , intr, stray, frame); > > +#endif > > > > /* > > * Wrapper handler special handling: > > @@ -1416,7 +1462,7 @@ intr_event_handle(struct intr_event *ie, struct > trapframe *frame) > > if (thread) { > > int error __unused; > > > > - error =3D intr_event_schedule_thread(ie); > > + error =3D intr_event_schedule_thread(ie, frame); > > KASSERT(error =3D=3D 0, ("bad stray interrupt")); > > } > > critical_exit(); > From owner-dev-commits-src-main@freebsd.org Tue Sep 14 06:30:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6029C66256A; Tue, 14 Sep 2021 06:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7tl774Sdz4lVd; Tue, 14 Sep 2021 06:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3567315FEE; Tue, 14 Sep 2021 06:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18E6Uhno005279; Tue, 14 Sep 2021 06:30:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18E6Uh7o005278; Tue, 14 Sep 2021 06:30:43 GMT (envelope-from git) Date: Tue, 14 Sep 2021 06:30:43 GMT Message-Id: <202109140630.18E6Uh7o005278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: bcf5c7a8b1dc - main - if_mvneta: Build the driver as a kernel module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcf5c7a8b1dcdcd5f27c1aa694f66208dc07a0dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 06:30:44 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=bcf5c7a8b1dcdcd5f27c1aa694f66208dc07a0dd commit bcf5c7a8b1dcdcd5f27c1aa694f66208dc07a0dd Author: Hubert Mazur AuthorDate: 2021-09-13 09:44:31 +0000 Commit: Wojciech Macek CommitDate: 2021-09-14 06:29:53 +0000 if_mvneta: Build the driver as a kernel module Fix device detach and attach routine. Add required Makefile to build as a module. Remove entry from GENERIC, since now it can be loaded automatically. Tested on EspressoBin. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31581 --- sys/dev/neta/if_mvneta.c | 73 ++++++++++++++++++++++++++++------------------- sys/modules/Makefile | 2 ++ sys/modules/neta/Makefile | 10 +++++++ 3 files changed, 55 insertions(+), 30 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index debb4a922cbc..242e139b8cac 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,6 +222,11 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-neta", true }, + { NULL, false } +}; + DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -229,7 +234,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); /* * List of MIB register and names @@ -609,6 +614,16 @@ mvneta_attach(device_t self) } #endif + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + mvneta_detach(self); + return (error); + } + /* * MAC address */ @@ -704,8 +719,6 @@ mvneta_attach(device_t self) } } - ether_ifattach(ifp, sc->enaddr); - /* * Enable DMA engines and Initialize Device Registers. */ @@ -835,20 +848,11 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - sysctl_mvneta_init(sc); + ether_ifattach(ifp, sc->enaddr); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - ether_ifdetach(sc->ifp); - mvneta_detach(self); - return (error); - } + sysctl_mvneta_init(sc); return (0); } @@ -857,20 +861,28 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; + struct ifnet *ifp; int q; sc = device_get_softc(dev); + ifp = sc->ifp; - mvneta_stop(sc); - /* Detach network interface */ - if (sc->ifp) - if_free(sc->ifp); + if (device_is_attached(dev)) { + mvneta_stop(sc); + callout_drain(&sc->tick_ch); + ether_ifdetach(sc->ifp); + } for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); + device_delete_children(dev); + + if (sc->ih_cookie[0] != NULL) + bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); + if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -881,6 +893,13 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); + + if (sc->ifp) + if_free(sc->ifp); + + if (mtx_initialized(&sc->mtx)) + mtx_destroy(&sc->mtx); + return (0); } @@ -1254,6 +1273,9 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_rx_lockq(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1295,6 +1317,9 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1324,16 +1349,6 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { - if (mtx_name(&tx->ring_mtx) != NULL) { - /* - * It is assumed that maps are being loaded after mutex - * is initialized. Therefore we can skip unloading maps - * when mutex is empty. - */ - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); - } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1372,8 +1387,6 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7ed2169445e4..b1063ad003d8 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,6 +264,7 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ + ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -626,6 +627,7 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw +_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/modules/neta/Makefile b/sys/modules/neta/Makefile new file mode 100644 index 000000000000..8845e181efaa --- /dev/null +++ b/sys/modules/neta/Makefile @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/neta + +CFLAGS+= -DFDT + +KMOD= if_mvneta +SRCS= if_mvneta.c if_mvneta_fdt.c if_mvnetavar.h +SRCS+= bus_if.h device_if.h mdio_if.h miibus_if.h ofw_bus_if.h opt_platform.h +.include From owner-dev-commits-src-main@freebsd.org Tue Sep 14 07:51:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FD19663E2C; Tue, 14 Sep 2021 07:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7wXW1k6mz3Pnh; Tue, 14 Sep 2021 07:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B20F16B54; Tue, 14 Sep 2021 07:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18E7pd2R015663; Tue, 14 Sep 2021 07:51:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18E7pdHr015662; Tue, 14 Sep 2021 07:51:39 GMT (envelope-from git) Date: Tue, 14 Sep 2021 07:51:39 GMT Message-Id: <202109140751.18E7pdHr015662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 94c678cf19ca - main - stress2: A two second timeout is too short MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94c678cf19ca78330cbec1338167127964d3272a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 07:51:39 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=94c678cf19ca78330cbec1338167127964d3272a commit 94c678cf19ca78330cbec1338167127964d3272a Author: Peter Holm AuthorDate: 2021-09-14 07:50:26 +0000 Commit: Peter Holm CommitDate: 2021-09-14 07:50:26 +0000 stress2: A two second timeout is too short --- tools/test/stress2/testcases/mkfifo/mkfifo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/testcases/mkfifo/mkfifo.c b/tools/test/stress2/testcases/mkfifo/mkfifo.c index 6bd20d6679f9..caeb5e45310b 100644 --- a/tools/test/stress2/testcases/mkfifo/mkfifo.c +++ b/tools/test/stress2/testcases/mkfifo/mkfifo.c @@ -58,7 +58,7 @@ reader(void) { setproctitle("reader"); signal(SIGALRM, handler2); - alarm(2); + alarm(60); if ((fd = open(path, O_RDWR, 0600)) < 0) { unlink(path); err(1, "open(%s)", path); @@ -81,7 +81,7 @@ writer(void) { int fd; signal(SIGALRM, handler2); - alarm(2); + alarm(60); setproctitle("writer"); if ((fd = open(path, O_RDWR, 0600)) < 0) { From owner-dev-commits-src-main@freebsd.org Tue Sep 14 09:50:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D192566583D; Tue, 14 Sep 2021 09:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H7z9F5JPdz4k0t; Tue, 14 Sep 2021 09:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95C74187EA; Tue, 14 Sep 2021 09:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18E9o9gH065407; Tue, 14 Sep 2021 09:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18E9o9gc065404; Tue, 14 Sep 2021 09:50:09 GMT (envelope-from git) Date: Tue, 14 Sep 2021 09:50:09 GMT Message-Id: <202109140950.18E9o9gc065404@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: ba4d9d9d5b24 - main - Revert "if_mvneta: Build the driver as a kernel module" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba4d9d9d5b2478bb97676a7fa031ef271f1075c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 09:50:09 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=ba4d9d9d5b2478bb97676a7fa031ef271f1075c9 commit ba4d9d9d5b2478bb97676a7fa031ef271f1075c9 Author: Wojciech Macek AuthorDate: 2021-09-14 09:49:59 +0000 Commit: Wojciech Macek CommitDate: 2021-09-14 09:49:59 +0000 Revert "if_mvneta: Build the driver as a kernel module" This reverts commit bcf5c7a8b1dcdcd5f27c1aa694f66208dc07a0dd. --- sys/dev/neta/if_mvneta.c | 73 +++++++++++++++++++---------------------------- sys/modules/Makefile | 2 -- sys/modules/neta/Makefile | 10 ------- 3 files changed, 30 insertions(+), 55 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index 242e139b8cac..debb4a922cbc 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -222,11 +222,6 @@ static device_method_t mvneta_methods[] = { DEVMETHOD_END }; -static struct ofw_compat_data compat_data[] = { - { "marvell,armada-3700-neta", true }, - { NULL, false } -}; - DEFINE_CLASS_0(mvneta, mvneta_driver, mvneta_methods, sizeof(struct mvneta_softc)); DRIVER_MODULE(miibus, mvneta, miibus_driver, miibus_devclass, 0, 0); @@ -234,7 +229,7 @@ DRIVER_MODULE(mdio, mvneta, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(mvneta, mdio, 1, 1, 1); MODULE_DEPEND(mvneta, ether, 1, 1, 1); MODULE_DEPEND(mvneta, miibus, 1, 1, 1); -SIMPLEBUS_PNP_INFO(compat_data); +MODULE_DEPEND(mvneta, mvxpbm, 1, 1, 1); /* * List of MIB register and names @@ -614,16 +609,6 @@ mvneta_attach(device_t self) } #endif - error = bus_setup_intr(self, sc->res[1], - INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, - &sc->ih_cookie[0]); - if (error) { - device_printf(self, "could not setup %s\n", - mvneta_intrs[0].description); - mvneta_detach(self); - return (error); - } - /* * MAC address */ @@ -719,6 +704,8 @@ mvneta_attach(device_t self) } } + ether_ifattach(ifp, sc->enaddr); + /* * Enable DMA engines and Initialize Device Registers. */ @@ -848,11 +835,20 @@ mvneta_attach(device_t self) mvneta_update_media(sc, ifm_target); } - ether_ifattach(ifp, sc->enaddr); + sysctl_mvneta_init(sc); callout_reset(&sc->tick_ch, 0, mvneta_tick, sc); - sysctl_mvneta_init(sc); + error = bus_setup_intr(self, sc->res[1], + INTR_TYPE_NET | INTR_MPSAFE, NULL, mvneta_intrs[0].handler, sc, + &sc->ih_cookie[0]); + if (error) { + device_printf(self, "could not setup %s\n", + mvneta_intrs[0].description); + ether_ifdetach(sc->ifp); + mvneta_detach(self); + return (error); + } return (0); } @@ -861,28 +857,20 @@ STATIC int mvneta_detach(device_t dev) { struct mvneta_softc *sc; - struct ifnet *ifp; int q; sc = device_get_softc(dev); - ifp = sc->ifp; - if (device_is_attached(dev)) { - mvneta_stop(sc); - callout_drain(&sc->tick_ch); - ether_ifdetach(sc->ifp); - } + mvneta_stop(sc); + /* Detach network interface */ + if (sc->ifp) + if_free(sc->ifp); for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) mvneta_ring_dealloc_rx_queue(sc, q); for (q = 0; q < MVNETA_TX_QNUM_MAX; q++) mvneta_ring_dealloc_tx_queue(sc, q); - device_delete_children(dev); - - if (sc->ih_cookie[0] != NULL) - bus_teardown_intr(dev, sc->res[1], sc->ih_cookie[0]); - if (sc->tx_dtag != NULL) bus_dma_tag_destroy(sc->tx_dtag); if (sc->rx_dtag != NULL) @@ -893,13 +881,6 @@ mvneta_detach(device_t dev) bus_dma_tag_destroy(sc->rxbuf_dtag); bus_release_resources(dev, res_spec, sc->res); - - if (sc->ifp) - if_free(sc->ifp); - - if (mtx_initialized(&sc->mtx)) - mtx_destroy(&sc->mtx); - return (0); } @@ -1273,9 +1254,6 @@ mvneta_ring_alloc_rx_queue(struct mvneta_softc *sc, int q) return (0); fail: - mvneta_rx_lockq(sc, q); - mvneta_ring_flush_rx_queue(sc, q); - mvneta_rx_unlockq(sc, q); mvneta_ring_dealloc_rx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1317,9 +1295,6 @@ mvneta_ring_alloc_tx_queue(struct mvneta_softc *sc, int q) return (0); fail: - mvneta_tx_lockq(sc, q); - mvneta_ring_flush_tx_queue(sc, q); - mvneta_tx_unlockq(sc, q); mvneta_ring_dealloc_tx_queue(sc, q); device_printf(sc->dev, "DMA Ring buffer allocation failure.\n"); return (error); @@ -1349,6 +1324,16 @@ mvneta_ring_dealloc_tx_queue(struct mvneta_softc *sc, int q) #endif if (sc->txmbuf_dtag != NULL) { + if (mtx_name(&tx->ring_mtx) != NULL) { + /* + * It is assumed that maps are being loaded after mutex + * is initialized. Therefore we can skip unloading maps + * when mutex is empty. + */ + mvneta_tx_lockq(sc, q); + mvneta_ring_flush_tx_queue(sc, q); + mvneta_tx_unlockq(sc, q); + } for (i = 0; i < MVNETA_TX_RING_CNT; i++) { txbuf = &tx->txbuf[i]; if (txbuf->dmap != NULL) { @@ -1387,6 +1372,8 @@ mvneta_ring_dealloc_rx_queue(struct mvneta_softc *sc, int q) rx = MVNETA_RX_RING(sc, q); + mvneta_ring_flush_rx_queue(sc, q); + if (rx->desc_pa != 0) bus_dmamap_unload(sc->rx_dtag, rx->desc_map); diff --git a/sys/modules/Makefile b/sys/modules/Makefile index b1063ad003d8..7ed2169445e4 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -264,7 +264,6 @@ SUBDIR= \ mxge \ my \ ${_nctgpio} \ - ${_neta} \ ${_netgraph} \ ${_nfe} \ nfscl \ @@ -627,7 +626,6 @@ _rockchip= rockchip .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" _sdhci_fdt= sdhci_fdt _e6000sw= e6000sw -_neta= neta .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/modules/neta/Makefile b/sys/modules/neta/Makefile deleted file mode 100644 index 8845e181efaa..000000000000 --- a/sys/modules/neta/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/neta - -CFLAGS+= -DFDT - -KMOD= if_mvneta -SRCS= if_mvneta.c if_mvneta_fdt.c if_mvnetavar.h -SRCS+= bus_if.h device_if.h mdio_if.h miibus_if.h ofw_bus_if.h opt_platform.h -.include From owner-dev-commits-src-main@freebsd.org Tue Sep 14 10:42:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8F0C66640D; Tue, 14 Sep 2021 10:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H80Kk50Zkz3GW1; Tue, 14 Sep 2021 10:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D316194DB; Tue, 14 Sep 2021 10:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EAgYmh041615; Tue, 14 Sep 2021 10:42:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EAgYCI041614; Tue, 14 Sep 2021 10:42:34 GMT (envelope-from git) Date: Tue, 14 Sep 2021 10:42:34 GMT Message-Id: <202109141042.18EAgYCI041614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: c6f3076d4405 - main - Move the GICv2m msi handling to the parent MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6f3076d44055f7b02467ce074210f73d0ce0ef6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 10:42:34 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c6f3076d44055f7b02467ce074210f73d0ce0ef6 commit c6f3076d44055f7b02467ce074210f73d0ce0ef6 Author: Andrew Turner AuthorDate: 2021-09-01 09:39:01 +0000 Commit: Andrew Turner CommitDate: 2021-09-14 07:24:52 +0000 Move the GICv2m msi handling to the parent This is in preperation for adding support for the GICv2m driver as a child of the GICv3 driver. PR: 258136 Reported by: trasz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31767 --- sys/arm/arm/gic.c | 296 ++++++++++++++++++++++++++++++----------------- sys/arm/arm/gic.h | 8 +- sys/arm/arm/gic_common.h | 4 + 3 files changed, 195 insertions(+), 113 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 1851e69644ed..bd34e92b9e28 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -501,6 +501,56 @@ arm_gic_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) ("arm_gic_read_ivar: Invalid bus type %u", sc->gic_bus)); *result = sc->gic_bus; return (0); + case GIC_IVAR_MBI_START: + *result = sc->sc_spi_start; + return (0); + case GIC_IVAR_MBI_COUNT: + *result = sc->sc_spi_count; + return (0); + } + + return (ENOENT); +} + +static int +arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + struct arm_gic_softc *sc; + + sc = device_get_softc(dev); + + switch(which) { + case GIC_IVAR_HW_REV: + case GIC_IVAR_BUS: + return (EINVAL); + case GIC_IVAR_MBI_START: + /* + * GIC_IVAR_MBI_START must be set once and first. This allows + * us to reserve the registers when GIC_IVAR_MBI_COUNT is set. + */ + MPASS(sc->sc_spi_start == 0); + MPASS(sc->sc_spi_count == 0); + MPASS(value >= GIC_FIRST_SPI); + MPASS(value < sc->nirqs); + + sc->sc_spi_start = value; + return (0); + case GIC_IVAR_MBI_COUNT: + MPASS(sc->sc_spi_start != 0); + MPASS(sc->sc_spi_count == 0); + MPASS(value >= sc->sc_spi_start); + MPASS(value >= GIC_FIRST_SPI); + + sc->sc_spi_count = value; + sc->sc_spi_end = sc->sc_spi_start + sc->sc_spi_count; + + MPASS(sc->sc_spi_end <= sc->nirqs); + + /* Reserve these interrupts for MSI/MSI-X use */ + arm_gic_reserve_msi_range(dev, sc->sc_spi_start, + sc->sc_spi_count); + + return (0); } return (ENOENT); @@ -995,99 +1045,20 @@ arm_gic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc **isrcp) } #endif -static device_method_t arm_gic_methods[] = { - /* Bus interface */ - DEVMETHOD(bus_print_child, arm_gic_print_child), - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_alloc_resource, arm_gic_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), - DEVMETHOD(bus_read_ivar, arm_gic_read_ivar), - - /* Interrupt controller interface */ - DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), - DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), - DEVMETHOD(pic_map_intr, arm_gic_map_intr), - DEVMETHOD(pic_setup_intr, arm_gic_setup_intr), - DEVMETHOD(pic_teardown_intr, arm_gic_teardown_intr), - DEVMETHOD(pic_post_filter, arm_gic_post_filter), - DEVMETHOD(pic_post_ithread, arm_gic_post_ithread), - DEVMETHOD(pic_pre_ithread, arm_gic_pre_ithread), -#ifdef SMP - DEVMETHOD(pic_bind_intr, arm_gic_bind_intr), - DEVMETHOD(pic_init_secondary, arm_gic_init_secondary), - DEVMETHOD(pic_ipi_send, arm_gic_ipi_send), - DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), -#endif - { 0, 0 } -}; - -DEFINE_CLASS_0(gic, arm_gic_driver, arm_gic_methods, - sizeof(struct arm_gic_softc)); - -/* - * GICv2m support -- the GICv2 MSI/MSI-X controller. - */ - -#define GICV2M_MSI_TYPER 0x008 -#define MSI_TYPER_SPI_BASE(x) (((x) >> 16) & 0x3ff) -#define MSI_TYPER_SPI_COUNT(x) (((x) >> 0) & 0x3ff) -#define GICv2M_MSI_SETSPI_NS 0x040 -#define GICV2M_MSI_IIDR 0xFCC - -int -arm_gicv2m_attach(device_t dev) -{ - struct arm_gicv2m_softc *sc; - uint32_t typer; - int rid; - - sc = device_get_softc(dev); - - rid = 0; - sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->sc_mem == NULL) { - device_printf(dev, "Unable to allocate resources\n"); - return (ENXIO); - } - - typer = bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); - sc->sc_spi_start = MSI_TYPER_SPI_BASE(typer); - sc->sc_spi_count = MSI_TYPER_SPI_COUNT(typer); - sc->sc_spi_end = sc->sc_spi_start + sc->sc_spi_count; - - /* Reserve these interrupts for MSI/MSI-X use */ - arm_gic_reserve_msi_range(device_get_parent(dev), sc->sc_spi_start, - sc->sc_spi_count); - - mtx_init(&sc->sc_mutex, "GICv2m lock", NULL, MTX_DEF); - - intr_msi_register(dev, sc->sc_xref); - - if (bootverbose) - device_printf(dev, "using spi %u to %u\n", sc->sc_spi_start, - sc->sc_spi_start + sc->sc_spi_count - 1); - - return (0); -} - static int -arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, +arm_gic_alloc_msi(device_t dev, device_t child, int count, int maxcount, device_t *pic, struct intr_irqsrc **srcs) { - struct arm_gic_softc *psc; - struct arm_gicv2m_softc *sc; + struct arm_gic_softc *sc; int i, irq, end_irq; bool found; KASSERT(powerof2(count), ("%s: bad count", __func__)); KASSERT(powerof2(maxcount), ("%s: bad maxcount", __func__)); - psc = device_get_softc(device_get_parent(dev)); sc = device_get_softc(dev); - mtx_lock(&sc->sc_mutex); + mtx_lock(&sc->mutex); found = false; for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { @@ -1106,11 +1077,11 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, break; } - KASSERT((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI)!= 0, + KASSERT((sc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI)!= 0, ("%s: Non-MSI interrupt found", __func__)); /* This is already used */ - if ((psc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI_USED) == + if ((sc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED) { found = false; break; @@ -1122,34 +1093,34 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, /* Not enough interrupts were found */ if (!found || irq == sc->sc_spi_end) { - mtx_unlock(&sc->sc_mutex); + mtx_unlock(&sc->mutex); return (ENXIO); } for (i = 0; i < count; i++) { /* Mark the interrupt as used */ - psc->gic_irqs[irq + i].gi_flags |= GI_FLAG_MSI_USED; + sc->gic_irqs[irq + i].gi_flags |= GI_FLAG_MSI_USED; } - mtx_unlock(&sc->sc_mutex); + mtx_unlock(&sc->mutex); for (i = 0; i < count; i++) - srcs[i] = (struct intr_irqsrc *)&psc->gic_irqs[irq + i]; - *pic = device_get_parent(dev); + srcs[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; + *pic = dev; return (0); } static int -arm_gicv2m_release_msi(device_t dev, device_t child, int count, +arm_gic_release_msi(device_t dev, device_t child, int count, struct intr_irqsrc **isrc) { - struct arm_gicv2m_softc *sc; + struct arm_gic_softc *sc; struct gic_irqsrc *gi; int i; sc = device_get_softc(dev); - mtx_lock(&sc->sc_mutex); + mtx_lock(&sc->mutex); for (i = 0; i < count; i++) { gi = (struct gic_irqsrc *)isrc[i]; @@ -1159,50 +1130,48 @@ arm_gicv2m_release_msi(device_t dev, device_t child, int count, gi->gi_flags &= ~GI_FLAG_MSI_USED; } - mtx_unlock(&sc->sc_mutex); + mtx_unlock(&sc->mutex); return (0); } static int -arm_gicv2m_alloc_msix(device_t dev, device_t child, device_t *pic, +arm_gic_alloc_msix(device_t dev, device_t child, device_t *pic, struct intr_irqsrc **isrcp) { - struct arm_gicv2m_softc *sc; - struct arm_gic_softc *psc; + struct arm_gic_softc *sc; int irq; - psc = device_get_softc(device_get_parent(dev)); sc = device_get_softc(dev); - mtx_lock(&sc->sc_mutex); + mtx_lock(&sc->mutex); /* Find an unused interrupt */ for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { - KASSERT((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, + KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, ("%s: Non-MSI interrupt found", __func__)); - if ((psc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == 0) + if ((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == 0) break; } /* No free interrupt was found */ if (irq == sc->sc_spi_end) { - mtx_unlock(&sc->sc_mutex); + mtx_unlock(&sc->mutex); return (ENXIO); } /* Mark the interrupt as used */ - psc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI_USED; - mtx_unlock(&sc->sc_mutex); + sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI_USED; + mtx_unlock(&sc->mutex); - *isrcp = (struct intr_irqsrc *)&psc->gic_irqs[irq]; - *pic = device_get_parent(dev); + *isrcp = (struct intr_irqsrc *)&sc->gic_irqs[irq]; + *pic = dev; return (0); } static int -arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +arm_gic_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) { - struct arm_gicv2m_softc *sc; + struct arm_gic_softc *sc; struct gic_irqsrc *gi; sc = device_get_softc(dev); @@ -1211,13 +1180,122 @@ arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED, ("%s: Trying to release an unused MSI-X interrupt", __func__)); - mtx_lock(&sc->sc_mutex); + mtx_lock(&sc->mutex); gi->gi_flags &= ~GI_FLAG_MSI_USED; - mtx_unlock(&sc->sc_mutex); + mtx_unlock(&sc->mutex); return (0); } +static device_method_t arm_gic_methods[] = { + /* Bus interface */ + DEVMETHOD(bus_print_child, arm_gic_print_child), + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_alloc_resource, arm_gic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), + DEVMETHOD(bus_read_ivar, arm_gic_read_ivar), + DEVMETHOD(bus_write_ivar, arm_gic_write_ivar), + + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, arm_gic_disable_intr), + DEVMETHOD(pic_enable_intr, arm_gic_enable_intr), + DEVMETHOD(pic_map_intr, arm_gic_map_intr), + DEVMETHOD(pic_setup_intr, arm_gic_setup_intr), + DEVMETHOD(pic_teardown_intr, arm_gic_teardown_intr), + DEVMETHOD(pic_post_filter, arm_gic_post_filter), + DEVMETHOD(pic_post_ithread, arm_gic_post_ithread), + DEVMETHOD(pic_pre_ithread, arm_gic_pre_ithread), +#ifdef SMP + DEVMETHOD(pic_bind_intr, arm_gic_bind_intr), + DEVMETHOD(pic_init_secondary, arm_gic_init_secondary), + DEVMETHOD(pic_ipi_send, arm_gic_ipi_send), + DEVMETHOD(pic_ipi_setup, arm_gic_ipi_setup), +#endif + + /* MSI/MSI-X */ + DEVMETHOD(msi_alloc_msi, arm_gic_alloc_msi), + DEVMETHOD(msi_release_msi, arm_gic_release_msi), + DEVMETHOD(msi_alloc_msix, arm_gic_alloc_msix), + DEVMETHOD(msi_release_msix, arm_gic_release_msix), + + { 0, 0 } +}; + +DEFINE_CLASS_0(gic, arm_gic_driver, arm_gic_methods, + sizeof(struct arm_gic_softc)); + +/* + * GICv2m support -- the GICv2 MSI/MSI-X controller. + */ + +#define GICV2M_MSI_TYPER 0x008 +#define MSI_TYPER_SPI_BASE(x) (((x) >> 16) & 0x3ff) +#define MSI_TYPER_SPI_COUNT(x) (((x) >> 0) & 0x3ff) +#define GICv2M_MSI_SETSPI_NS 0x040 +#define GICV2M_MSI_IIDR 0xFCC + +int +arm_gicv2m_attach(device_t dev) +{ + struct arm_gicv2m_softc *sc; + uint32_t typer; + u_int spi_start, spi_count; + int rid; + + sc = device_get_softc(dev); + + rid = 0; + sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_mem == NULL) { + device_printf(dev, "Unable to allocate resources\n"); + return (ENXIO); + } + + typer = bus_read_4(sc->sc_mem, GICV2M_MSI_TYPER); + spi_start = MSI_TYPER_SPI_BASE(typer); + spi_count = MSI_TYPER_SPI_COUNT(typer); + gic_set_mbi_start(dev, spi_start); + gic_set_mbi_count(dev, spi_count); + + intr_msi_register(dev, sc->sc_xref); + + if (bootverbose) + device_printf(dev, "using spi %u to %u\n", spi_start, + spi_start + spi_count - 1); + + return (0); +} + +static int +arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, + device_t *pic, struct intr_irqsrc **srcs) +{ + return (MSI_ALLOC_MSI(device_get_parent(dev), child, count, maxcount, + pic, srcs)); +} + +static int +arm_gicv2m_release_msi(device_t dev, device_t child, int count, + struct intr_irqsrc **isrc) +{ + return (MSI_RELEASE_MSI(device_get_parent(dev), child, count, isrc)); +} + +static int +arm_gicv2m_alloc_msix(device_t dev, device_t child, device_t *pic, + struct intr_irqsrc **isrcp) +{ + return (MSI_ALLOC_MSIX(device_get_parent(dev), child, pic, isrcp)); +} + +static int +arm_gicv2m_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +{ + return (MSI_RELEASE_MSIX(device_get_parent(dev), child, isrc)); +} + static int arm_gicv2m_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, uint64_t *addr, uint32_t *data) diff --git a/sys/arm/arm/gic.h b/sys/arm/arm/gic.h index 74cfbbee9d5a..55f7f0cc5e44 100644 --- a/sys/arm/arm/gic.h +++ b/sys/arm/arm/gic.h @@ -63,17 +63,17 @@ struct arm_gic_softc { int nranges; struct arm_gic_range * ranges; + + u_int sc_spi_start; + u_int sc_spi_end; + u_int sc_spi_count; }; DECLARE_CLASS(arm_gic_driver); struct arm_gicv2m_softc { struct resource *sc_mem; - struct mtx sc_mutex; uintptr_t sc_xref; - u_int sc_spi_start; - u_int sc_spi_end; - u_int sc_spi_count; }; DECLARE_CLASS(arm_gicv2m_driver); diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h index 9e8fb19300ca..52827d03e600 100644 --- a/sys/arm/arm/gic_common.h +++ b/sys/arm/arm/gic_common.h @@ -33,6 +33,8 @@ #define GIC_IVAR_HW_REV 500 #define GIC_IVAR_BUS 501 +#define GIC_IVAR_MBI_START 510 +#define GIC_IVAR_MBI_COUNT 511 /* GIC_IVAR_BUS values */ #define GIC_BUS_UNKNOWN 0 @@ -42,6 +44,8 @@ __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int); __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); +__BUS_ACCESSOR(gic, mbi_start, GIC, MBI_START, u_int); +__BUS_ACCESSOR(gic, mbi_count, GIC, MBI_COUNT, u_int); /* Software Generated Interrupts */ #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ From owner-dev-commits-src-main@freebsd.org Tue Sep 14 10:42:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83E05665FB8; Tue, 14 Sep 2021 10:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H80Km01pvz3GPK; Tue, 14 Sep 2021 10:42:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2237195CA; Tue, 14 Sep 2021 10:42:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EAgZUL041639; Tue, 14 Sep 2021 10:42:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EAgZX9041638; Tue, 14 Sep 2021 10:42:35 GMT (envelope-from git) Date: Tue, 14 Sep 2021 10:42:35 GMT Message-Id: <202109141042.18EAgZX9041638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: e4d89a633e3b - main - Add support for gicv2m as a child of gicv3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4d89a633e3b31ec1319e3238abceee2048996c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 10:42:36 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e4d89a633e3b31ec1319e3238abceee2048996c4 commit e4d89a633e3b31ec1319e3238abceee2048996c4 Author: Andrew Turner AuthorDate: 2021-09-01 09:41:14 +0000 Commit: Andrew Turner CommitDate: 2021-09-14 07:24:52 +0000 Add support for gicv2m as a child of gicv3 On some systems, e.g. Parallels set to host a Linux VM under an M1 Mac, there is a GICv2m as a child of the GICv3. We previously assumed the GICv2m was always a child of a GICv2. Fix this by adding the needed support to the GICv3 driver. PR: 258136 Reported by: trasz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31768 --- sys/arm64/arm64/gic_v3.c | 90 ++++++++++++++++++++++++++++++++++++++++---- sys/arm64/arm64/gic_v3_fdt.c | 2 +- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 3e7cd30140eb..a53d0b272723 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); static bus_get_domain_t gic_v3_get_domain; static bus_read_ivar_t gic_v3_read_ivar; +static bus_write_ivar_t gic_v3_write_ivar; static pic_disable_intr_t gic_v3_disable_intr; static pic_enable_intr_t gic_v3_enable_intr; @@ -113,6 +114,7 @@ static device_method_t gic_v3_methods[] = { /* Bus interface */ DEVMETHOD(bus_get_domain, gic_v3_get_domain), DEVMETHOD(bus_read_ivar, gic_v3_read_ivar), + DEVMETHOD(bus_write_ivar, gic_v3_write_ivar), /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, gic_v3_disable_intr), @@ -242,6 +244,33 @@ gic_r_write_8(device_t dev, bus_size_t offset, uint64_t val) bus_write_8(rdist, offset, val); } +static void +gic_v3_reserve_msi_range(device_t dev, u_int start, u_int count) +{ + struct gic_v3_softc *sc; + int i; + + sc = device_get_softc(dev); + + KASSERT((start + count) < sc->gic_nirqs, + ("%s: Trying to allocate too many MSI IRQs: %d + %d > %d", __func__, + start, count, sc->gic_nirqs)); + for (i = 0; i < count; i++) { + KASSERT(sc->gic_irqs[start + i].gi_isrc.isrc_handlers == 0, + ("%s: MSI interrupt %d already has a handler", __func__, + count + i)); + KASSERT(sc->gic_irqs[start + i].gi_pol == INTR_POLARITY_CONFORM, + ("%s: MSI interrupt %d already has a polarity", __func__, + count + i)); + KASSERT(sc->gic_irqs[start + i].gi_trig == INTR_TRIGGER_CONFORM, + ("%s: MSI interrupt %d already has a trigger", __func__, + count + i)); + sc->gic_irqs[start + i].gi_pol = INTR_POLARITY_HIGH; + sc->gic_irqs[start + i].gi_trig = INTR_TRIGGER_EDGE; + sc->gic_irqs[start + i].gi_flags |= GI_FLAG_MSI; + } +} + /* * Device interface. */ @@ -332,15 +361,10 @@ gic_v3_attach(device_t dev) } } + mtx_init(&sc->gic_mbi_mtx, "GICv3 mbi lock", NULL, MTX_DEF); if (sc->gic_mbi_start > 0) { - /* Reserve these interrupts for MSI/MSI-X use */ - for (irq = sc->gic_mbi_start; irq <= sc->gic_mbi_end; irq++) { - sc->gic_irqs[irq].gi_pol = INTR_POLARITY_HIGH; - sc->gic_irqs[irq].gi_trig = INTR_TRIGGER_EDGE; - sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI; - } - - mtx_init(&sc->gic_mbi_mtx, "GICv3 mbi lock", NULL, MTX_DEF); + gic_v3_reserve_msi_range(dev, sc->gic_mbi_start, + sc->gic_mbi_end - sc->gic_mbi_start); if (bootverbose) { device_printf(dev, "using spi %u to %u\n", sc->gic_mbi_start, @@ -442,6 +466,56 @@ gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) KASSERT(sc->gic_bus <= GIC_BUS_MAX, ("gic_v3_read_ivar: Invalid bus type %u", sc->gic_bus)); *result = sc->gic_bus; + return (0); + case GIC_IVAR_MBI_START: + *result = sc->gic_mbi_start; + return (0); + case GIC_IVAR_MBI_COUNT: + *result = sc->gic_mbi_end - sc->gic_mbi_start; + return (0); + } + + return (ENOENT); +} + +static int +gic_v3_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + struct gic_v3_softc *sc; + + sc = device_get_softc(dev); + + switch(which) { + case GICV3_IVAR_NIRQS: + case GICV3_IVAR_REDIST: + case GIC_IVAR_HW_REV: + case GIC_IVAR_BUS: + return (EINVAL); + case GIC_IVAR_MBI_START: + /* + * GIC_IVAR_MBI_START must be set once and first. This allows + * us to reserve the registers when GIC_IVAR_MBI_COUNT is set. + */ + MPASS(sc->gic_mbi_start == 0); + MPASS(sc->gic_mbi_end == 0); + MPASS(value >= GIC_FIRST_SPI); + MPASS(value < sc->gic_nirqs); + + sc->gic_mbi_start = value; + return (0); + case GIC_IVAR_MBI_COUNT: + MPASS(sc->gic_mbi_start != 0); + MPASS(sc->gic_mbi_end == 0); + MPASS(value >= sc->gic_mbi_start); + MPASS(value >= GIC_FIRST_SPI); + + sc->gic_mbi_end = value - sc->gic_mbi_start; + + MPASS(sc->gic_mbi_end <= sc->gic_nirqs); + + /* Reserve these interrupts for MSI/MSI-X use */ + gic_v3_reserve_msi_range(dev, sc->gic_mbi_start, value); + return (0); } diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c index d2c0611c9167..65d7ca7e374d 100644 --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -143,7 +143,7 @@ gic_v3_fdt_attach(device_t dev) if (ret % 2 == 0) { /* Limit to a single range for now. */ sc->gic_mbi_start = mbi_ranges[0]; - sc->gic_mbi_end = mbi_ranges[0] + mbi_ranges[1] - 1; + sc->gic_mbi_end = mbi_ranges[0] + mbi_ranges[1]; } else { if (bootverbose) device_printf(dev, "Malformed mbi-ranges property\n"); From owner-dev-commits-src-main@freebsd.org Tue Sep 14 12:53:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 460506692D2; Tue, 14 Sep 2021 12:53:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H83Dq1Vh9z4jBH; Tue, 14 Sep 2021 12:53:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13F761ADE5; Tue, 14 Sep 2021 12:53:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ECrVfD016501; Tue, 14 Sep 2021 12:53:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ECrVoR016500; Tue, 14 Sep 2021 12:53:31 GMT (envelope-from git) Date: Tue, 14 Sep 2021 12:53:31 GMT Message-Id: <202109141253.18ECrVoR016500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: fd860ace3bde - main - Remove the DN flag from the initial arm64 fpcr value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd860ace3bded96bee0e5c090a5a4d8b085b700c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 12:53:31 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=fd860ace3bded96bee0e5c090a5a4d8b085b700c commit fd860ace3bded96bee0e5c090a5a4d8b085b700c Author: Andrew Turner AuthorDate: 2021-08-25 10:05:55 +0000 Commit: Andrew Turner CommitDate: 2021-09-14 12:52:48 +0000 Remove the DN flag from the initial arm64 fpcr value This fixes software that expects NaN values to propagate. Sponsored by: The FreeBSD Foundation --- sys/arm64/include/vfp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index 629b1b7fadf4..bee0121d9d2a 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -35,7 +35,7 @@ #define VFPCR_AHP (0x04000000) /* alt. half-precision: */ #define VFPCR_DN (0x02000000) /* default NaN enable */ #define VFPCR_FZ (0x01000000) /* flush to zero enabled */ -#define VFPCR_INIT VFPCR_DN /* Default fpcr after exec */ +#define VFPCR_INIT 0 /* Default fpcr after exec */ #define VFPCR_RMODE_OFF 22 /* rounding mode offset */ #define VFPCR_RMODE_MASK (0x00c00000) /* rounding mode mask */ From owner-dev-commits-src-main@freebsd.org Tue Sep 14 13:10:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0523669616; Tue, 14 Sep 2021 13:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H83cd4jZGz4mwp; Tue, 14 Sep 2021 13:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81ADD1B2B9; Tue, 14 Sep 2021 13:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EDAfBB039580; Tue, 14 Sep 2021 13:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EDAfJw039579; Tue, 14 Sep 2021 13:10:41 GMT (envelope-from git) Date: Tue, 14 Sep 2021 13:10:41 GMT Message-Id: <202109141310.18EDAfJw039579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fa0463c384b6 - main - socket: De-duplicate SBLOCKWAIT() definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa0463c384b652e1e962d5e8e70396e6a876f01b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 13:10:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa0463c384b652e1e962d5e8e70396e6a876f01b commit fa0463c384b652e1e962d5e8e70396e6a876f01b Author: Mark Johnston AuthorDate: 2021-09-14 13:01:32 +0000 Commit: Mark Johnston CommitDate: 2021-09-14 13:01:32 +0000 socket: De-duplicate SBLOCKWAIT() definitions MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/hyperv/hvsock/hv_sock.c | 1 - sys/kern/uipc_socket.c | 2 -- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 2 -- sys/sys/socketvar.h | 2 ++ 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index b95b8eebb77d..6d5ad4fc6609 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -627,7 +627,6 @@ hvs_trans_disconnect(struct socket *so) return (0); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) struct hvs_callback_arg { struct uio *uio; struct sockbuf *sb; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index cbddd80e0546..95222a1ecf7b 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1413,8 +1413,6 @@ sodisconnect(struct socket *so) return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) - int sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index ed9dd1fcb224..973372b21761 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -1047,8 +1047,6 @@ out: return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) - /* * Send on a socket. If send must go all at once and message is larger than * send buffering, then hard error. Lock against other senders. If must go diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 57913f7bbd65..18db5e34d3b5 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -292,6 +292,8 @@ struct socket { #define SBL_NOINTR 0x00000002 /* Force non-interruptible sleep. */ #define SBL_VALID (SBL_WAIT | SBL_NOINTR) +#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? 0 : SBL_WAIT) + #define SOCK_IO_SEND_LOCK(so, flags) \ soiolock((so), &(so)->so_snd_sx, (flags)) #define SOCK_IO_SEND_UNLOCK(so) \ From owner-dev-commits-src-main@freebsd.org Tue Sep 14 13:10:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 263D86694E5; Tue, 14 Sep 2021 13:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H83cg0B4pz4mp3; Tue, 14 Sep 2021 13:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2BE71B13C; Tue, 14 Sep 2021 13:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EDAgIa039604; Tue, 14 Sep 2021 13:10:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EDAg4K039603; Tue, 14 Sep 2021 13:10:42 GMT (envelope-from git) Date: Tue, 14 Sep 2021 13:10:42 GMT Message-Id: <202109141310.18EDAg4K039603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e6c19aa94da4 - main - sctp: Allow blocking on I/O locks even with non-blocking sockets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6c19aa94da4a799472f8b82f196ffc42d0dbdaf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 13:10:43 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6c19aa94da4a799472f8b82f196ffc42d0dbdaf commit e6c19aa94da4a799472f8b82f196ffc42d0dbdaf Author: Mark Johnston AuthorDate: 2021-09-14 13:02:05 +0000 Commit: Mark Johnston CommitDate: 2021-09-14 13:02:05 +0000 sctp: Allow blocking on I/O locks even with non-blocking sockets There are two flags to request a non-blocking receive on a socket: MSG_NBIO and MSG_DONTWAIT. They are handled a bit differently in that soreceive_generic() and soreceive_stream() will block on the socket I/O lock when MSG_NBIO is set, but not if MSG_DONTWAIT is set. In general, MSG_NBIO seems to mean, "don't block if there is no data to receive" and MSG_DONTWAIT means "don't go to sleep for any reason". SCTP's soreceive implementation did not allow blocking on the I/O lock if either flag is set, but this violates an assumption in aio_process_sb(), which specifies MSG_NBIO but nonetheless expects to make progress if data is available to read. Change sctp_sorecvmsg() to block on the I/O lock only if MSG_DONTWAIT is not set. Reported by: syzbot+c7d22dbbb9aef509421d@syzkaller.appspotmail.com Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31915 --- sys/netinet/sctputil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 09d486038b65..c6cdd3315704 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -5585,7 +5585,7 @@ sctp_sorecvmsg(struct socket *so, rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } - error = SOCK_IO_RECV_LOCK(so, (block_allowed ? SBL_WAIT : 0)); + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(in_flags)); if (error) { goto release_unlocked; } From owner-dev-commits-src-main@freebsd.org Tue Sep 14 13:42:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2A0066A278; Tue, 14 Sep 2021 13:42:43 +0000 (UTC) (envelope-from SRS0=Q8r5=OE=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H84Kb3VrGz3CcC; Tue, 14 Sep 2021 13:42:43 +0000 (UTC) (envelope-from SRS0=Q8r5=OE=klop.ws=ronald-lists@realworks.nl) Date: Tue, 14 Sep 2021 15:42:35 +0200 (CEST) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=klop.ws; s=rw1; t=1631626955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5j27DK2Frb0f79bid5K+HrMK71ImIFnQs6QTowPXoGg=; b=FvZAnmJUkzTFhmtnLBKpL2JgHlexJvuasiYISmyKk/WTwjymva7F3m9gS5zxTvO0E7NXLS zrSYhGtihCHnZmAw== From: Ronald Klop To: Andrew Turner Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <629177790.2.1631626955525@mailrelay> In-Reply-To: <202109141253.18ECrVoR016500@gitrepo.freebsd.org> References: <202109141253.18ECrVoR016500@gitrepo.freebsd.org> Subject: Re: git: fd860ace3bde - main - Remove the DN flag from the initial arm64 fpcr value MIME-Version: 1.0 X-Mailer: Realworks (576.841.ea608bb) Importance: Normal X-Priority: 3 (Normal) X-Rspamd-Queue-Id: 4H84Kb3VrGz3CcC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 13:42:43 -0000 Hi, Do you have an example of this software? Just for my understanding. Ronald. Van: Andrew Turner Datum: dinsdag, 14 september 2021 14:53 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Onderwerp: git: fd860ace3bde - main - Remove the DN flag from the initial arm64 fpcr value > > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=fd860ace3bded96bee0e5c090a5a4d8b085b700c > > commit fd860ace3bded96bee0e5c090a5a4d8b085b700c > Author: Andrew Turner > AuthorDate: 2021-08-25 10:05:55 +0000 > Commit: Andrew Turner > CommitDate: 2021-09-14 12:52:48 +0000 > > Remove the DN flag from the initial arm64 fpcr value > > This fixes software that expects NaN values to propagate. > > Sponsored by: The FreeBSD Foundation > --- > sys/arm64/include/vfp.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h > index 629b1b7fadf4..bee0121d9d2a 100644 > --- a/sys/arm64/include/vfp.h > +++ b/sys/arm64/include/vfp.h > @@ -35,7 +35,7 @@ > #define VFPCR_AHP (0x04000000) /* alt. half-precision: */ > #define VFPCR_DN (0x02000000) /* default NaN enable */ > #define VFPCR_FZ (0x01000000) /* flush to zero enabled */ > -#define VFPCR_INIT VFPCR_DN /* Default fpcr after exec */ > +#define VFPCR_INIT 0 /* Default fpcr after exec */ > > #define VFPCR_RMODE_OFF 22 /* rounding mode offset */ > #define VFPCR_RMODE_MASK (0x00c00000) /* rounding mode mask */ > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" > > > From owner-dev-commits-src-main@freebsd.org Tue Sep 14 15:04:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D791C66AAF0; Tue, 14 Sep 2021 15:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H867q5LS8z3qtF; Tue, 14 Sep 2021 15:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 976E91C6F1; Tue, 14 Sep 2021 15:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EF4NtH090655; Tue, 14 Sep 2021 15:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EF4Nio090654; Tue, 14 Sep 2021 15:04:23 GMT (envelope-from git) Date: Tue, 14 Sep 2021 15:04:23 GMT Message-Id: <202109141504.18EF4Nio090654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b1746faad6d6 - main - debugnet: Include some required headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1746faad6d690e43ac78ba3a9bca96c767ea729 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 15:04:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b1746faad6d690e43ac78ba3a9bca96c767ea729 commit b1746faad6d690e43ac78ba3a9bca96c767ea729 Author: Mark Johnston AuthorDate: 2021-09-14 14:53:15 +0000 Commit: Mark Johnston CommitDate: 2021-09-14 15:02:45 +0000 debugnet: Include some required headers Don't depend on pollution from net/vnet.h. PR: 258496 MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/net/debugnet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index 8652597c55db..7a2c98ace65d 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include @@ -53,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-dev-commits-src-main@freebsd.org Tue Sep 14 15:11:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7694966B32A; Tue, 14 Sep 2021 15:11:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H86Hj5Px7z3t5f; Tue, 14 Sep 2021 15:11:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x231.google.com with SMTP id p15so24549078ljn.3; Tue, 14 Sep 2021 08:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nNYuDvZ7S81Nhz6iC5cEDTIYEweU8c+ABEPXgj568Lw=; b=mTRY4qTUVPVsocNO8GZvzfZ/pmnRfpPHA/xbUs1ui+Htb309aOMjSs5fIQ2GlHH+gN GOPReu4L03jtxDDbftXMYLgXkToWHIv7ihob3aSvlTSbaEeZv6Z5plrotRYliZt1vyq8 Cui3JYcyubR2wZfww0kcPXZ7tH7ZtBnoJ4HXf/pB9nt9raqCRu1F2FjEjIuG2zj1MfiI qOV+Q6At4RqbhamgAzOCvC2YAr8uQpfyYXFeOTOiPFa6dMqEMkHo/jkWvkQjJkwy/kTo ZpSSfS7vd6NybtiUo+UldAPMseHMDlSBRzDYl7J32+IQzkFM1N7xt7lsq90132H6sd+L ENUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nNYuDvZ7S81Nhz6iC5cEDTIYEweU8c+ABEPXgj568Lw=; b=oPIlhsRRkEXJjNHujb+r5YajYFwi25pExOs3bi8iT/g32VdgJdKyXve3kV6FKQI9NU Vqxs5+nLd/26JcnE7ZxOJKfyGtILi7/iuW+AJRBS9oJp8Mr01Ubu23nr2nb70kmtNsO+ UQrxek+qxd6rGbTLW45M9qmwcBOEPbXB0sGxPHf7ieZSp4g9z4j7140c3fjsL7pjxuVH nlL4Fk+12afu8wLRx3Sfhf030LNeEt91oxkeS5GcxHdFJiVIlONoRgbJYXCxlSZgi6dN i8KLudodR9Y0uTRqCF7qWlRPwMVfZNh9c4qxslu1ol/3EcRZEIqeHr9wX9YMgLuL6o0T 8q5Q== X-Gm-Message-State: AOAM531GUNupjN6KKgAQq/Hfe0eZJW7JnK0bJ6uEvKji3R13HWic/bfu Jp4XGqqe5U2lu98bWsHz0HEmIZUMVb8AbxLvlHdE7AR3 X-Google-Smtp-Source: ABdhPJxAn5h9YS3ZWlq1mMJyCOpSf/3h+UWRYzerrYePrWIPmb9RvFa8sHYfl4Y0LdV7gagkYBD8qteb/5+rQszFszs= X-Received: by 2002:a2e:8906:: with SMTP id d6mr15908333lji.248.1631632272501; Tue, 14 Sep 2021 08:11:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:6f04:0:0:0:0:0 with HTTP; Tue, 14 Sep 2021 08:11:11 -0700 (PDT) In-Reply-To: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 14 Sep 2021 17:11:11 +0200 Message-ID: Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test To: Gleb Smirnoff Cc: kp@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H86Hj5Px7z3t5f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=mTRY4qTU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::231 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[5]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::231:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 15:11:14 -0000 On 9/10/21, Gleb Smirnoff wrote: > Mateusz, > > On Fri, Sep 10, 2021 at 09:43:06AM +0200, Mateusz Guzik wrote: > M> > M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c > M> > M> index e2dd3eb7c0de..add76c7b98d4 100644 > M> > M> --- a/sys/netpfil/pf/pf.c > M> > M> +++ b/sys/netpfil/pf/pf.c > M> > M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet > *ifp, > M> > struct mbuf **m0, struct inpcb * > M> > M> > M> > M> PF_RULES_RLOCK(); > M> > M> > M> > M> - if (ip_divert_ptr != NULL && > M> > M> + if (__predict_false(ip_divert_ptr != NULL) && > M> > > M> > This is an optimization for a setup without divert(4) at cost of > M> > pessimization > M> > for a setup with divert(4). IMHO, __predict_false() predicate should > guard > M> > against error paths and other unusual events, not favor one setup over > M> > other. > M> > > M> > M> divert is non-standard and comes with tons of overhead, so I think > M> this is justified. > > pf is also non-standard and comes with tons of overhead, so what > about such change to ip_input(), and similar to ip_output(): > > diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c > index 465c00e4dac..e6feb837114 100644 > --- a/sys/netinet/ip_input.c > +++ b/sys/netinet/ip_input.c > @@ -605,7 +605,7 @@ ip_input(struct mbuf *m) > */ > > /* Jump over all PFIL processing if hooks are not active. */ > - if (!PFIL_HOOKED_IN(V_inet_pfil_head)) > + if (__predict_true(!PFIL_HOOKED_IN(V_inet_pfil_head))) > goto passin; > > odst = ip->ip_dst; > > I hope that brings my point. > > M> The real fix would be to either implement hot patchable branches or > M> otherwise generate pf_test always (or never) doing divert without > M> having to check for it, but that's far in the future. > > That would be great, but before we have such tools, I believe optimization > for one particular setup at cost of pessimization of other setups is not > a way to go. > So happens I would argue the pfil change should also be made, perhaps conditional on whether a known consumer is compiled in. I guess I should elaborate on how I see things here. The network stack comes with a rampant branch fest which can be significantly reduced in easy ways. For example from ip_input: #if defined(IPSEC) || defined(IPSEC_SUPPORT) /* * Bypass packet filtering for packets previously handled by IPsec. */ if (IPSEC_ENABLED(ipv4) && IPSEC_CAPS(ipv4, m, IPSEC_CAP_BYPASS_FILTER) != 0) goto passin; #endif Let's say this has to be checked every time. Even then IPSEC_CAPS is a func call which induces 2 more func calls, which also branch for no reason. Instead the complete result could be computed so that there is one bool to check (and even that could be hot patched later on). Finally, it should probably be predicted one way or the other. pf_test is an egregious example of this proble and, the commit at hand was a step towards cleaning the state up -- it is not meant to be permanent in the current form. The idea is to gradually split it into parts which have to be there and parts which are optional, the annotation will help going forward and should not measurably hurt divert. -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue Sep 14 15:36:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9489066B7BA; Tue, 14 Sep 2021 15:36:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (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 4H86rh2Grdz4VhC; Tue, 14 Sep 2021 15:36:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTP id Q5AkmMHjIczbLQATrmmjsd; Tue, 14 Sep 2021 15:36:19 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id QATqmAr9KdCHGQATrmJIhA; Tue, 14 Sep 2021 15:36:19 +0000 X-Authority-Analysis: v=2.4 cv=SdyUytdu c=1 sm=1 tr=0 ts=6140c173 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=7QKq2e-ADPsA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=a6Yr_-BYhy3xce3D-50A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 9DDDA15A; Tue, 14 Sep 2021 06:53:27 +0000 () Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 18EDrPqq022951; Tue, 14 Sep 2021 13:53:26 GMT (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202109141353.18EDrPqq022951@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Edward Tomasz Napierala cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection In-reply-to: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> References: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> Comments: In-reply-to Edward Tomasz Napierala message dated "Mon, 13 Sep 2021 14:42:13 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 14 Sep 2021 13:53:25 +0000 X-CMAE-Envelope: MS4xfHRkrkHXn0gdukaD75BkwOrZcxz5gLe0LVuC0k+VJkJQFiOJNKA5TiGGszk7VJ0WspqShQuAOjvLqwMy8JN4re7OQR+MJgg/T5xmS+uFXX2H75XCRKIw MgaDEtg4/xqLWLuzviY/UzU40sGkbMeTvlQbLd4jC43E4cLhWvpEbx8Nr1V2QK5yku2uClaG7X9ZnGpYJvIRhmrC3bdOJe0HgobZAEr0sDccRfazxN4SN3G5 6FHO/AaotyY5YFH8G9OAMGbZdAyAuqCF+xwpWIAho87RdQ6Y/GeYzoGPqxID+UYTz+UykIRSiT6/G2m8tWijGSKAQDKVd88WlnsJQ1cqXc8= X-Rspamd-Queue-Id: 4H86rh2Grdz4VhC X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 3.97.99.32) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.60 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[70.66.148.124:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.97.99.32:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_VERYGOOD(0.00)[3.97.99.32:from]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 15:36:21 -0000 In message <202109131442.18DEgDIn043709@gitrepo.freebsd.org>, Edward Tomasz Nap ierala writes: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ddedf2a11eb20af1ee52cb3da70a57c2 > 1904af8f > > commit ddedf2a11eb20af1ee52cb3da70a57c21904af8f > Author: Edward Tomasz Napierala > AuthorDate: 2021-09-12 03:07:26 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-09-12 03:07:58 +0000 > > tzcode: Implement timezone change detection > > Implement optional timezone change detection for local time libc > functions. This is disabled by default; set WITH_DETECT_TZ_CHANGES > to build it. > > Reviewed By: imp > Sponsored by: NetApp, Inc. > Sponsored by: Klara, Inc. > X-NetApp-PR: #47 > Differential Revision: https://reviews.freebsd.org/D30183 > --- > contrib/tzcode/stdtime/localtime.c | 89 ++++++++++++++++++++++++++++ > +- > lib/libc/stdtime/Makefile.inc | 4 ++ > share/mk/src.opts.mk | 1 + > tools/build/options/WITH_DETECT_TZ_CHANGES | 2 + > 4 files changed, 95 insertions(+), 1 deletion(-) > > diff --git a/contrib/tzcode/stdtime/localtime.c b/contrib/tzcode/stdtime/loca > ltime.c > index e221c1fa3964..926b24470e19 100644 > --- a/contrib/tzcode/stdtime/localtime.c > +++ b/contrib/tzcode/stdtime/localtime.c > @@ -354,6 +354,45 @@ settzname(void) > } > } > > +#ifdef DETECT_TZ_CHANGES > +/* > + * Determine if there's a change in the timezone since the last time we chec > ked. > + * Returns: -1 on error > + * 0 if the timezone has not changed > + * 1 if the timezone has changed > + */ > +static int > +change_in_tz(const char *name) > +{ > + static char old_name[PATH_MAX]; > + static struct stat old_sb; > + struct stat sb; > + int error; > + > + error = stat(name, &sb); > + if (error != 0) > + return -1; > + > + if (strcmp(name, old_name) != 0) { > + strlcpy(old_name, name, sizeof(old_name)); > + old_sb = sb; > + return 1; > + } > + > + if (sb.st_dev != old_sb.st_dev || > + sb.st_ino != old_sb.st_ino || > + sb.st_ctime != old_sb.st_ctime || > + sb.st_mtime != old_sb.st_mtime) { > + old_sb = sb; > + return 1; > + } > + > + return 0; > +} > +#else /* !DETECT_TZ_CHANGES */ > +#define change_in_tz(X) 0 > +#endif /* !DETECT_TZ_CHANGES */ > + > static int > differ_by_repeat(const time_t t1, const time_t t0) > { > @@ -379,6 +418,7 @@ register const int doextend; > int stored; > int nread; > int res; > + int ret; > union { > struct tzhead tzhead; > char buf[2 * sizeof(struct tzhead) + > @@ -427,6 +467,22 @@ register const int doextend; > (void) strcat(fullname, name); > name = fullname; > } > + if (doextend == TRUE) { > + /* > + * Detect if the timezone file has changed. Check > + * 'doextend' to ignore TZDEFRULES; the change_in_tz() > + * function can only keep state for a single file. > + */ > + ret = change_in_tz(name); > + if (ret <= 0) { > + /* > + * Returns -1 if there was an error, > + * and 0 if the timezone had not changed. > + */ > + free(fullname); > + return ret; > + } > + } > if ((fid = _open(name, OPEN_MODE)) == -1) { > free(fullname); > return -1; > @@ -1209,12 +1265,43 @@ gmtload(struct state *const sp) > (void) tzparse(gmt, sp, TRUE); > } > > +#ifdef DETECT_TZ_CHANGES > +static int > +recheck_tzdata() > +{ > + static time_t last_checked; > + struct timespec now; > + time_t current_time; > + int error; > + > + /* > + * We want to recheck the timezone file every 61 sec. > + */ > + error = clock_gettime(CLOCK_MONOTONIC, &now); > + if (error <= 0) { > + /* XXX: Can we somehow report this? */ > + return 0; > + } > + > + current_time = now.tv_sec; > + if ((current_time - last_checked > 61) || > + (last_checked > current_time)) { > + last_checked = current_time; > + return 1; > + } > + > + return 0; > +} > +#else /* !DETECT_TZ_CHANGES */ > +#define recheck_tzdata() 0 > +#endif /* !DETECT_TZ_CHANGES */ > + > static void > tzsetwall_basic(int rdlocked) > { > if (!rdlocked) > _RWLOCK_RDLOCK(&lcl_rwlock); > - if (lcl_is_set < 0) { > + if (lcl_is_set < 0 && recheck_tzdata() == 0) { > if (!rdlocked) > _RWLOCK_UNLOCK(&lcl_rwlock); > return; > diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc > index fb0d2b934148..3d483469bc97 100644 > --- a/lib/libc/stdtime/Makefile.inc > +++ b/lib/libc/stdtime/Makefile.inc > @@ -12,6 +12,10 @@ CFLAGS+= -I${SRCTOP}/contrib/tzcode/stdtime -I${LIBC_SRCTO > P}/stdtime > > CFLAGS.localtime.c= -fwrapv > > +.if ${MK_DETECT_TZ_CHANGES} != "no" > +CFLAGS+= -DDETECT_TZ_CHANGES > +.endif > + > MAN+= ctime.3 strftime.3 strptime.3 time2posix.3 > MAN+= tzfile.5 > > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > index 28e18260affd..ff894d3b3517 100644 > --- a/share/mk/src.opts.mk > +++ b/share/mk/src.opts.mk > @@ -196,6 +196,7 @@ __DEFAULT_NO_OPTIONS = \ > BHYVE_SNAPSHOT \ > CLANG_EXTRAS \ > CLANG_FORMAT \ > + DETECT_TZ_CHANGES \ > DTRACE_TESTS \ > EXPERIMENTAL \ > HESIOD \ > diff --git a/tools/build/options/WITH_DETECT_TZ_CHANGES b/tools/build/options > /WITH_DETECT_TZ_CHANGES > new file mode 100644 > index 000000000000..6a2d18473892 > --- /dev/null > +++ b/tools/build/options/WITH_DETECT_TZ_CHANGES > @@ -0,0 +1,2 @@ > +.\" $FreeBSD$ > +Make the time handling code detect changes to the timezone files. > Hi, This patch caused all of the machines on my network to display UTC. After reboot everything was ok. However moments ago my screen locked while typing on my laptop. The time is now UTC instead of PDT. TZ is still set to America/Vancouver. Changing the TZ makes no difference. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-main@freebsd.org Tue Sep 14 16:39:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A47BC66C43F; Tue, 14 Sep 2021 16:39:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H88FJ40Pqz4pyv; Tue, 14 Sep 2021 16:39:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1631637556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ofYepXUz2iKK14qNbah/IDq1cJO7Je38EViZNaT/7D4=; b=sJwss9Tcc364JsgW1L5dCbcoozPaoFeXY4/b3guQ7Fw0MqUJ6FrE8F5mZ9x/EZHG8gwW+y iYlyAd1jfFViFqtDQhgiFyGP8owYnNr2klEia6oKogniuf3+iq9OMlvcMJ878ej++iLrVp 4uuBaDwVARMq1iqmzArFLprJiv02vPLm9Kk0uXqE0TtPINohym9DMtRbzxj6lOWKBU/kpF Tpj+2cKGVxIA9nuv5dPAQwKB+z5a5uuBQZu6qlLmeI55MXJPEgsV7TfzpXqPag7kx/Mma9 6v797E8BnqZUOsh4Lt5jk072YBxMJh3UOYQtCDAQdZYyrR1ZbCfKsJ4kBVONXg== Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 62D5871EF; Tue, 14 Sep 2021 16:39:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 96B5B7D02; Tue, 14 Sep 2021 09:39:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id KAkljf4f3DHT; Tue, 14 Sep 2021 09:39:13 -0700 (PDT) Subject: Re: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 4B0B07CF5 To: Edward Tomasz Napierala , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org> Date: Tue, 14 Sep 2021 09:39:14 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wSgEHqHSqGi1wIEqfMGgf01N8RK7YaRGw" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1631637556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ofYepXUz2iKK14qNbah/IDq1cJO7Je38EViZNaT/7D4=; b=u/6TJOSHgKwB8T28EeVhtb59b8hm+V29dCvuxRbt6wRGgObehEuTHzuiliISba2KBwNz5h CsIo42jl2ipPfYV8yFjC/dC4K5nL839WwrApe+/jP5JjbWNIvtYu7A8RO4YBhgBPYNwbeX oI7v8hKR+URqFcgjyWXXHMeOUPuBGclC5bcFjJmvRh+VrYb6TUq0P5djEpzI5WdhSjDBwy l/tWmBvB/ibwlF3fXonIOwfKaja/9nd0x66WBl5hJpKZ+2ZMY8+v+epGSUIkJK4HTNQDaC SDQ+qSez7XxogJDDMxnMuBchJQkLtZkFnlOZ+x2HcwDYLctk5VH40dDeU/J05A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1631637556; a=rsa-sha256; cv=none; b=cU1qN1VRKql7m5hLqOMVAoVy9mk6HeCx0COQ55Ivo8ZMJfcXIuy7XWBuhs2dCN0okAPQcL EsqFKr0O41i4bOOMmcm4c/P/GjZgzjx7Vq0h4+r2OaQ4FA4kirQ80lNGsBhzTV3OO/2Ecd LMJuB/HOvjC+lHPSHRDdOAh9UJsONsKsS53ogUq2YfdQ8CHOTh/8+2oh8qTiAKNzD1MFft FNOYeVG/snv6i820jDLAoyzCrJVdxiGgImnCRIX1FGtHknNzzWgrFEIyIXj2XDt8kaZNw7 bk35TSYN/M/nxc6RGsVlZcQAuMj9cy3Kj09BrC66TDwSXqeceeF5l+Qh215VKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 16:39:16 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wSgEHqHSqGi1wIEqfMGgf01N8RK7YaRGw Content-Type: multipart/mixed; boundary="U0hUOraZIKiLM0PKAMawQq5Vp3r1t51sj"; protected-headers="v1" From: Bryan Drewery To: Edward Tomasz Napierala , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org> Subject: Re: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection References: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> In-Reply-To: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> --U0hUOraZIKiLM0PKAMawQq5Vp3r1t51sj Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 9/13/2021 7:42 AM, Edward Tomasz Napierala wrote: > +#else /* !DETECT_TZ_CHANGES */ > +#define change_in_tz(X) 0 WITHOUT_DETECT_TZ_CHANGES: change_in_tz() =3D=3D 0 > +#endif /* !DETECT_TZ_CHANGES */ > + > static int > differ_by_repeat(const time_t t1, const time_t t0) > { > @@ -379,6 +418,7 @@ register const int doextend; > int stored; > int nread; > int res; > + int ret; > union { > struct tzhead tzhead; > char buf[2 * sizeof(struct tzhead) + > @@ -427,6 +467,22 @@ register const int doextend; > (void) strcat(fullname, name); > name =3D fullname; > } > + if (doextend =3D=3D TRUE) { > + /* > + * Detect if the timezone file has changed. Check > + * 'doextend' to ignore TZDEFRULES; the change_in_tz() > + * function can only keep state for a single file. > + */ > + ret =3D change_in_tz(name); > + if (ret <=3D 0) { WITHOUT_DETECT_TZ_CHANGES: Always returns a false-positive "done" but short-circuits the rest of tzload(). > + /* > + * Returns -1 if there was an error, > + * and 0 if the timezone had not changed. > + */ > + free(fullname); > + return ret; > + } > + } --=20 Regards, Bryan Drewery --U0hUOraZIKiLM0PKAMawQq5Vp3r1t51sj-- --wSgEHqHSqGi1wIEqfMGgf01N8RK7YaRGw Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmFA0DIFAwAAAAAACgkQNddxu25Gl88r hAgAltyUu1Bn2s6N+Vg0AHDgThsClWA1Fq7nmTu+45BSqIilAMUQk7Uf/CvdfxAU1u658fGPhnYp t25/fxRF4hDvyO0dN/Rmlbqx7HGInLYH6+HVPC+1SxTapR5mR54O8DxCOqVaF7wn5/tZXAQoVcZw Alzsc+/aIlhlsthPjiX/6utjdGaDawLJaf6ugEWNHJncQmY7UN/8u3kbqstw+V6Kd8rQikgoO+8s zx/4ABf1/vGylOK1JsisDCdM5buRbjU98B5E1uspXmdNzP8PDoknLXRDcgeX+Fs1sggL1pabrdrb OT9K74mDkG/GqSPMs2hJfrxNSCz8zfknP7Jb45My0g== =XIeD -----END PGP SIGNATURE----- --wSgEHqHSqGi1wIEqfMGgf01N8RK7YaRGw-- From owner-dev-commits-src-main@freebsd.org Tue Sep 14 17:12:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23E4166D12B; Tue, 14 Sep 2021 17:12:04 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4H88z76zmBz3F9B; Tue, 14 Sep 2021 17:12:03 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtpclient.apple (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 16A844E703; Tue, 14 Sep 2021 17:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; s=mail; t=1631639517; bh=o3/qvZJg+yweuIv9K9P4W3NbOL9dEz137QL69GkZX1M=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=prIJnkidB4jjVISBO5fZm9WJ2+oiIdtnjJ2qvIjgdxuhNQGtXP0sJZ00Maq9Rte3a 9Nql3rYORwExPYvvqV8sVocaamU2rs9z60S3xhWdIfsyeoYtzvEE73/8vZ2IGzO/wX f85vW7rxeri6eHJgexqJ7brfFLxIKRUZGrKHtssNao6mkWV3r4DRV5HE6XPu/qaT1n SVS58Nk2dvEOi9Sv7ukUPNGMaG3YpAJQba1EI0CGmcFemJfiTMNwAynN7OeYkm2IEE wBYINCDxMHutErh9Ha/nKT86/DUzM3cfVrna/qUFXbrKPik7hhyv+uUb3LAF0oQHMv zOImSqE5FT91Eau+SMeqwNftHcD8KAHvS/t1DPk/Q2rmLuNPze6dqGZ7v7vzWElyGV PWRw0S1T2lkKPOzLmVr1gl/Z+xWpKyz6OpjWbGDrD9auIvAwSeFdLXgiGnWWDJzWtg X6gBzWqgmp7ui4E1eg15XjNeNSt7Q6/F0GdxKJKQZzW98usiTeDbXxrcbYWpUIu05F /EXdTLYZiyaQTlIGBvvkwbyxut4nriY4zSAgT6tJN2ptrOZYlf2boeRjLLZlwgV2Gd rxnncPtz40y/ioilG94f0nV16sLvHx2Nr8fiAt+7x8CWjCzUAQw5P8DziRR26ZByrM j1pUmst//7Tcuc2tPLsvQduk= Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: fd860ace3bde - main - Remove the DN flag from the initial arm64 fpcr value From: Andrew Turner X-Priority: 3 (Normal) In-Reply-To: <629177790.2.1631626955525@mailrelay> Date: Tue, 14 Sep 2021 18:11:56 +0100 Cc: Andrew Turner , "dev-commits-src-all@freebsd.org" , "src-committers@freebsd.org" , "dev-commits-src-main@freebsd.org" Message-Id: <7E354DA3-CC3D-4240-A4EF-320AD7728C59@fubar.geek.nz> References: <202109141253.18ECrVoR016500@gitrepo.freebsd.org> <629177790.2.1631626955525@mailrelay> To: Ronald Klop X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H88z76zmBz3F9B X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 17:12:04 -0000 I found it with the lldb test suite. I also checked the value Mac and = Linux initialised the register to & found it to be zero. Andrew > On 14 Sep 2021, at 14:42, Ronald Klop wrote: >=20 > Hi, >=20 > Do you have an example of this software? Just for my understanding. >=20 > Ronald. >=20 > Van: Andrew Turner > Datum: dinsdag, 14 september 2021 14:53 > Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, = dev-commits-src-main@FreeBSD.org > Onderwerp: git: fd860ace3bde - main - Remove the DN flag from the = initial arm64 fpcr value >=20 > The branch main has been updated by andrew: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dfd860ace3bded96bee0e5c090a5a4d8b= 085b700c = >=20 > commit fd860ace3bded96bee0e5c090a5a4d8b085b700c > Author: Andrew Turner > AuthorDate: 2021-08-25 10:05:55 +0000 > Commit: Andrew Turner > CommitDate: 2021-09-14 12:52:48 +0000 >=20 > Remove the DN flag from the initial arm64 fpcr value > =20 > This fixes software that expects NaN values to propagate. > =20 > Sponsored by: The FreeBSD Foundation > --- > sys/arm64/include/vfp.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h > index 629b1b7fadf4..bee0121d9d2a 100644 > --- a/sys/arm64/include/vfp.h > +++ b/sys/arm64/include/vfp.h > @@ -35,7 +35,7 @@ > #define VFPCR_AHP (0x04000000) /* alt. half-precision: */ > #define VFPCR_DN (0x02000000) /* default NaN enable */ > #define VFPCR_FZ (0x01000000) /* flush to zero enabled = */ > -#define VFPCR_INIT VFPCR_DN /* Default fpcr after exec */ > +#define VFPCR_INIT 0 /* Default fpcr after exec */ > =20 > #define VFPCR_RMODE_OFF 22 /* rounding mode offset */ > #define VFPCR_RMODE_MASK (0x00c00000) /* rounding mode mask = */ > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all = > To unsubscribe, send any mail to = "dev-commits-src-all-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Tue Sep 14 17:51:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFE1A66DA87; Tue, 14 Sep 2021 17:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H89rh62lgz3jxt; Tue, 14 Sep 2021 17:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF4531F325; Tue, 14 Sep 2021 17:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EHpWuI015755; Tue, 14 Sep 2021 17:51:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EHpWI1015754; Tue, 14 Sep 2021 17:51:32 GMT (envelope-from git) Date: Tue, 14 Sep 2021 17:51:32 GMT Message-Id: <202109141751.18EHpWI1015754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 0f9bafdfc325 - main - openssh: pass ssh context to BLACKLIST_NOTIFY MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f9bafdfc325779e4ecc5154d5bb06c752297138 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 17:51:32 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0f9bafdfc325779e4ecc5154d5bb06c752297138 commit 0f9bafdfc325779e4ecc5154d5bb06c752297138 Author: Ed Maste AuthorDate: 2021-09-14 16:39:21 +0000 Commit: Ed Maste CommitDate: 2021-09-14 17:44:39 +0000 openssh: pass ssh context to BLACKLIST_NOTIFY Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1") Sponsored by: The FreeBSD Foundation --- crypto/openssh/auth-pam.c | 2 +- crypto/openssh/auth.c | 4 ++-- crypto/openssh/auth2.c | 2 +- crypto/openssh/blacklist.c | 6 +++--- crypto/openssh/blacklist_client.h | 6 +++--- crypto/openssh/packet.c | 2 +- crypto/openssh/sshd.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crypto/openssh/auth-pam.c b/crypto/openssh/auth-pam.c index f077b70595e6..7e6f972681e9 100644 --- a/crypto/openssh/auth-pam.c +++ b/crypto/openssh/auth-pam.c @@ -923,7 +923,7 @@ sshpam_query(void *ctx, char **name, char **info, sshbuf_free(buffer); return (0); } - BLACKLIST_NOTIFY(BLACKLIST_BAD_USER, + BLACKLIST_NOTIFY(NULL, BLACKLIST_BAD_USER, sshpam_authctxt->user); error("PAM: %s for %s%.100s from %.100s", msg, sshpam_authctxt->valid ? "" : "illegal user ", diff --git a/crypto/openssh/auth.c b/crypto/openssh/auth.c index 6b53585e2567..581d8dce2792 100644 --- a/crypto/openssh/auth.c +++ b/crypto/openssh/auth.c @@ -336,7 +336,7 @@ auth_log(struct ssh *ssh, int authenticated, int partial, else { authmsg = authenticated ? "Accepted" : "Failed"; if (authenticated) - BLACKLIST_NOTIFY(BLACKLIST_AUTH_OK, "ssh"); + BLACKLIST_NOTIFY(ssh, BLACKLIST_AUTH_OK, "ssh"); } if ((extra = format_method_key(authctxt)) == NULL) { @@ -600,7 +600,7 @@ getpwnamallow(struct ssh *ssh, const char *user) aix_restoreauthdb(); #endif if (pw == NULL) { - BLACKLIST_NOTIFY(BLACKLIST_BAD_USER, user); + BLACKLIST_NOTIFY(ssh, BLACKLIST_BAD_USER, user); logit("Invalid user %.100s from %.100s port %d", user, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); #ifdef CUSTOM_FAILED_LOGIN diff --git a/crypto/openssh/auth2.c b/crypto/openssh/auth2.c index cd5bd9ff501c..ff1228513d1e 100644 --- a/crypto/openssh/auth2.c +++ b/crypto/openssh/auth2.c @@ -425,7 +425,7 @@ userauth_finish(struct ssh *ssh, int authenticated, const char *method, if (!partial && !authctxt->server_caused_failure && (authctxt->attempt > 1 || strcmp(method, "none") != 0)) { authctxt->failures++; - BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, "ssh"); + BLACKLIST_NOTIFY(ssh, BLACKLIST_AUTH_FAIL, "ssh"); } if (authctxt->failures >= options.max_authtries) { #ifdef SSH_AUDIT_EVENTS diff --git a/crypto/openssh/blacklist.c b/crypto/openssh/blacklist.c index 78830c525c85..f118edab40cf 100644 --- a/crypto/openssh/blacklist.c +++ b/crypto/openssh/blacklist.c @@ -88,10 +88,10 @@ blacklist_init(void) } void -blacklist_notify(int action, const char *msg) +blacklist_notify(struct ssh *ssh, int action, const char *msg) { - if (blstate != NULL && ssh_packet_connection_is_on_socket(NULL)) + if (blstate != NULL && ssh_packet_connection_is_on_socket(ssh)) (void)blacklist_r(blstate, action, - ssh_packet_get_connection_in(NULL), msg); + ssh_packet_get_connection_in(ssh), msg); } diff --git a/crypto/openssh/blacklist_client.h b/crypto/openssh/blacklist_client.h index af5a2a6d3c1d..236884092010 100644 --- a/crypto/openssh/blacklist_client.h +++ b/crypto/openssh/blacklist_client.h @@ -45,15 +45,15 @@ enum { #ifdef USE_BLACKLIST void blacklist_init(void); -void blacklist_notify(int, const char *); +void blacklist_notify(struct ssh *, int, const char *); #define BLACKLIST_INIT() blacklist_init() -#define BLACKLIST_NOTIFY(x,msg) blacklist_notify(x,msg) +#define BLACKLIST_NOTIFY(ssh,x,msg) blacklist_notify(ssh,x,msg) #else #define BLACKLIST_INIT() -#define BLACKLIST_NOTIFY(x,msg) +#define BLACKLIST_NOTIFY(ssh,x,msg) #endif diff --git a/crypto/openssh/packet.c b/crypto/openssh/packet.c index 3379862ebc79..bc8314287cba 100644 --- a/crypto/openssh/packet.c +++ b/crypto/openssh/packet.c @@ -1876,7 +1876,7 @@ sshpkt_vfatal(struct ssh *ssh, int r, const char *fmt, va_list ap) case SSH_ERR_NO_KEX_ALG_MATCH: case SSH_ERR_NO_HOSTKEY_ALG_MATCH: if (ssh && ssh->kex && ssh->kex->failed_choice) { - BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, "ssh"); + BLACKLIST_NOTIFY(ssh, BLACKLIST_AUTH_FAIL, "ssh"); ssh_packet_clear_keys(ssh); errno = oerrno; logdie("Unable to negotiate with %s: %s. " diff --git a/crypto/openssh/sshd.c b/crypto/openssh/sshd.c index b3a2c4151e01..864ad09b29fc 100644 --- a/crypto/openssh/sshd.c +++ b/crypto/openssh/sshd.c @@ -385,7 +385,7 @@ grace_alarm_handler(int sig) kill(0, SIGTERM); } - BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, "ssh"); + BLACKLIST_NOTIFY(NULL, BLACKLIST_AUTH_FAIL, "ssh"); /* Log error and exit. */ if (use_privsep && pmonitor != NULL && pmonitor->m_pid <= 0) From owner-dev-commits-src-main@freebsd.org Tue Sep 14 18:18:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44CBB66E11F; Tue, 14 Sep 2021 18:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8BRQ1Qq2z3s8n; Tue, 14 Sep 2021 18:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 115381EDE8; Tue, 14 Sep 2021 18:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EII94C044014; Tue, 14 Sep 2021 18:18:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EII9NB044013; Tue, 14 Sep 2021 18:18:09 GMT (envelope-from git) Date: Tue, 14 Sep 2021 18:18:09 GMT Message-Id: <202109141818.18EII9NB044013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 272c4a4dc5fb - main - Allow setting NFS server scope and owner. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 272c4a4dc5fbe3d82d735c5b9a3b6faab052808b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 18:18:10 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=272c4a4dc5fbe3d82d735c5b9a3b6faab052808b commit 272c4a4dc5fbe3d82d735c5b9a3b6faab052808b Author: Alexander Motin AuthorDate: 2021-09-14 18:14:30 +0000 Commit: Alexander Motin CommitDate: 2021-09-14 18:18:03 +0000 Allow setting NFS server scope and owner. By default NFS server reports as scope and owner major the host UUID value and zero for owner minor. It works good in case of standalone server. But in case of CARP-based HA cluster failover the values should remain persistent, otherwise some clients like VMware ESXi get confused by the change and fail to reconnect automatically. The patch makes server scope, major owner and minor owner values configurable via sysctls. If not set (by default) the host UUID value is still used. Reviewed by: rmacklem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31952 --- sys/fs/nfsserver/nfs_nfsdserv.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 85834f7796f7..4394d3033fce 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -82,6 +82,15 @@ static bool nfsrv_openaccess = true; SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, v4openaccess, CTLFLAG_RW, &nfsrv_openaccess, 0, "Enable Linux style NFSv4 Open access check"); +static char nfsrv_scope[NFSV4_OPAQUELIMIT]; +SYSCTL_STRING(_vfs_nfsd, OID_AUTO, scope, CTLFLAG_RWTUN, + &nfsrv_scope, NFSV4_OPAQUELIMIT, "Server scope"); +static char nfsrv_owner_major[NFSV4_OPAQUELIMIT]; +SYSCTL_STRING(_vfs_nfsd, OID_AUTO, owner_major, CTLFLAG_RWTUN, + &nfsrv_owner_major, NFSV4_OPAQUELIMIT, "Server owner major"); +static uint64_t nfsrv_owner_minor; +SYSCTL_U64(_vfs_nfsd, OID_AUTO, owner_minor, CTLFLAG_RWTUN, + &nfsrv_owner_minor, 0, "Server owner minor"); /* * This list defines the GSS mechanisms supported. @@ -4253,7 +4262,6 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid, confirm; uint8_t *verf; uint32_t sp4type, v41flags; - uint64_t owner_minor; struct timespec verstime; #ifdef INET struct sockaddr_in *sin, *rin; @@ -4262,6 +4270,7 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, struct sockaddr_in6 *sin6, *rin6; #endif struct thread *p = curthread; + char *s; if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; @@ -4376,12 +4385,17 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, *tl++ = txdr_unsigned(confirm.lval[0]); /* SequenceID */ *tl++ = txdr_unsigned(v41flags); /* Exch flags */ *tl++ = txdr_unsigned(NFSV4EXCH_SP4NONE); /* No SSV */ - owner_minor = 0; /* Owner */ - txdr_hyper(owner_minor, tl); /* Minor */ - (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, - strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Major */ - (void)nfsm_strtom(nd, nd->nd_cred->cr_prison->pr_hostuuid, - strlen(nd->nd_cred->cr_prison->pr_hostuuid)); /* Scope */ + txdr_hyper(nfsrv_owner_minor, tl); /* Owner Minor */ + if (nfsrv_owner_major[0] != 0) + s = nfsrv_owner_major; + else + s = nd->nd_cred->cr_prison->pr_hostuuid; + nfsm_strtom(nd, s, strlen(s)); /* Owner Major */ + if (nfsrv_scope[0] != 0) + s = nfsrv_scope; + else + s = nd->nd_cred->cr_prison->pr_hostuuid; + nfsm_strtom(nd, s, strlen(s) ); /* Scope */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(1); (void)nfsm_strtom(nd, "freebsd.org", strlen("freebsd.org")); From owner-dev-commits-src-main@freebsd.org Tue Sep 14 18:32:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B11DA66E684; Tue, 14 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8BmF4Ndyz4QyT; Tue, 14 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7065F1F5FF; Tue, 14 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EIWjcU070333; Tue, 14 Sep 2021 18:32:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EIWj5I070332; Tue, 14 Sep 2021 18:32:45 GMT (envelope-from git) Date: Tue, 14 Sep 2021 18:32:45 GMT Message-Id: <202109141832.18EIWj5I070332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cf4670fe0b10 - main - kcov: Integrate with KMSAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf4670fe0b1049863ed3150a6ffb0b80dad151b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 18:32:45 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cf4670fe0b1049863ed3150a6ffb0b80dad151b2 commit cf4670fe0b1049863ed3150a6ffb0b80dad151b2 Author: Mark Johnston AuthorDate: 2021-09-14 18:29:27 +0000 Commit: Mark Johnston CommitDate: 2021-09-14 18:29:27 +0000 kcov: Integrate with KMSAN - kern_kcov.c needs to be compiled with -fsanitize=kernel-memory when KMSAN is configured since it calls into various other subsystems. - Disable address and memory sanitizers in kcov(4)'s coverage sanitizer callbacks, as they do not provide useful checking. Moreover, with KMSAN we may otherwise get false positives since the caller (coverage sanitizer runtime) is not instrumented. - Disable KASAN and KMSAN interceptors in subr_coverage.c, as they do not provide any benefit but do introduce overhead when fuzzing. Sponsored by: The FreeBSD Foundation --- sys/conf/files | 2 +- sys/kern/kern_kcov.c | 7 ++++--- sys/kern/subr_coverage.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index a5690ec1df75..eb0c489b7833 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3826,7 +3826,7 @@ kern/kern_idle.c standard kern/kern_intr.c standard kern/kern_jail.c standard kern/kern_kcov.c optional kcov \ - compile-with "${NORMAL_C:N-fsanitize*}" + compile-with "${NORMAL_C:N-fsanitize*} ${NORMAL_C:M-fsanitize=kernel-memory}" kern/kern_khelp.c standard kern/kern_kthread.c standard kern/kern_ktr.c optional ktr diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c index 23e0da4cdb79..7a11f800c7ce 100644 --- a/sys/kern/kern_kcov.c +++ b/sys/kern/kern_kcov.c @@ -35,7 +35,8 @@ * $FreeBSD$ */ -#ifdef KCSAN +/* Interceptors are required for KMSAN. */ +#if defined(KASAN) || defined(KCSAN) #define SAN_RUNTIME #endif @@ -191,7 +192,7 @@ get_kinfo(struct thread *td) return (info); } -static void +static void __nosanitizeaddress __nosanitizememory trace_pc(uintptr_t ret) { struct thread *td; @@ -223,7 +224,7 @@ trace_pc(uintptr_t ret) buf[0] = index + 1; } -static bool +static bool __nosanitizeaddress __nosanitizememory trace_cmp(uint64_t type, uint64_t arg1, uint64_t arg2, uint64_t ret) { struct thread *td; diff --git a/sys/kern/subr_coverage.c b/sys/kern/subr_coverage.c index 9a719bcaecad..28467af6a8d0 100644 --- a/sys/kern/subr_coverage.c +++ b/sys/kern/subr_coverage.c @@ -35,7 +35,7 @@ * $FreeBSD$ */ -#ifdef KCSAN +#ifdef SAN_NEEDS_INTERCEPTORS #define SAN_RUNTIME #endif From owner-dev-commits-src-main@freebsd.org Tue Sep 14 18:51:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F2EE66EA98; Tue, 14 Sep 2021 18:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8C9w1QvVz4VqB; Tue, 14 Sep 2021 18:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 113381FC3A; Tue, 14 Sep 2021 18:51:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EIpWrH093662; Tue, 14 Sep 2021 18:51:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EIpVfE093661; Tue, 14 Sep 2021 18:51:31 GMT (envelope-from git) Date: Tue, 14 Sep 2021 18:51:31 GMT Message-Id: <202109141851.18EIpVfE093661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c782ea8bb50b - main - Add a switch structure for send tags. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c782ea8bb50bf49f5da20da66417952b0e77472e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 18:51:32 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c782ea8bb50bf49f5da20da66417952b0e77472e commit c782ea8bb50bf49f5da20da66417952b0e77472e Author: John Baldwin AuthorDate: 2021-09-14 18:43:41 +0000 Commit: John Baldwin CommitDate: 2021-09-14 18:43:41 +0000 Add a switch structure for send tags. Move the type and function pointers for operations on existing send tags (modify, query, next, free) out of 'struct ifnet' and into a new 'struct if_snd_tag_sw'. A pointer to this structure is added to the generic part of send tags and is initialized by m_snd_tag_init() (which now accepts a switch structure as a new argument in place of the type). Previously, device driver ifnet methods switched on the type to call type-specific functions. Now, those type-specific functions are saved in the switch structure and invoked directly. In addition, this more gracefully permits multiple implementations of the same tag within a driver. In particular, NIC TLS for future Chelsio adapters will use a different implementation than the existing NIC TLS support for T6 adapters. Reviewed by: gallatin, hselasky, kib (older version) Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31572 --- sys/dev/cxgbe/adapter.h | 4 -- sys/dev/cxgbe/crypto/t4_kern_tls.c | 10 +++- sys/dev/cxgbe/t4_main.c | 60 +--------------------- sys/dev/cxgbe/t4_sched.c | 22 +++++++-- sys/dev/cxgbe/t4_sge.c | 4 +- sys/dev/mlx5/mlx5_en/en.h | 5 -- sys/dev/mlx5/mlx5_en/en_hw_tls.h | 3 -- sys/dev/mlx5/mlx5_en/en_rl.h | 3 -- sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c | 73 ++++++++++++++------------- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 93 +++++------------------------------ sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 19 +++++-- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- sys/kern/kern_mbuf.c | 7 +-- sys/kern/uipc_ktls.c | 6 +-- sys/net/if_dead.c | 20 -------- sys/net/if_lagg.c | 72 ++++++++++++++++++++++++--- sys/net/if_var.h | 27 ++++++---- sys/net/if_vlan.c | 72 ++++++++++++++++++++++++--- sys/netinet/in_pcb.c | 31 +++--------- sys/netinet/tcp_ratelimit.c | 8 +-- sys/sys/mbuf.h | 7 ++- 21 files changed, 263 insertions(+), 285 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 6b25dff7081a..4762b46f3799 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1292,7 +1292,6 @@ void t4_os_dump_devlog(struct adapter *); /* t4_kern_tls.c */ int cxgbe_tls_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); -void cxgbe_tls_tag_free(struct m_snd_tag *); void t6_ktls_modload(void); void t6_ktls_modunload(void); int t6_ktls_try(struct ifnet *, struct socket *, struct ktls_session *); @@ -1409,9 +1408,6 @@ void t4_free_etid_table(struct adapter *); struct cxgbe_rate_tag *lookup_etid(struct adapter *, int); int cxgbe_rate_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); -int cxgbe_rate_tag_modify(struct m_snd_tag *, union if_snd_tag_modify_params *); -int cxgbe_rate_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); -void cxgbe_rate_tag_free(struct m_snd_tag *); void cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *); void cxgbe_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); #endif diff --git a/sys/dev/cxgbe/crypto/t4_kern_tls.c b/sys/dev/cxgbe/crypto/t4_kern_tls.c index a20c3045b5b3..f8d5e54cc3b5 100644 --- a/sys/dev/cxgbe/crypto/t4_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t4_kern_tls.c @@ -102,9 +102,15 @@ struct tlspcb { bool open_pending; }; +static void cxgbe_tls_tag_free(struct m_snd_tag *mst); static int ktls_setup_keys(struct tlspcb *tlsp, const struct ktls_session *tls, struct sge_txq *txq); +static const struct if_snd_tag_sw cxgbe_tls_tag_sw = { + .snd_tag_free = cxgbe_tls_tag_free, + .type = IF_SND_TAG_TYPE_TLS +}; + static inline struct tlspcb * mst_to_tls(struct m_snd_tag *t) { @@ -122,7 +128,7 @@ alloc_tlspcb(struct ifnet *ifp, struct vi_info *vi, int flags) if (tlsp == NULL) return (NULL); - m_snd_tag_init(&tlsp->com, ifp, IF_SND_TAG_TYPE_TLS); + m_snd_tag_init(&tlsp->com, ifp, &cxgbe_tls_tag_sw); tlsp->vi = vi; tlsp->sc = sc; tlsp->ctrlq = &sc->sge.ctrlq[pi->port_id]; @@ -2071,7 +2077,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs, return (totdesc); } -void +static void cxgbe_tls_tag_free(struct m_snd_tag *mst) { struct adapter *sc; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index af24977ec29b..f728ddf5b212 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -253,11 +253,6 @@ static void cxgbe_qflush(struct ifnet *); #if defined(KERN_TLS) || defined(RATELIMIT) static int cxgbe_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); -static int cxgbe_snd_tag_modify(struct m_snd_tag *, - union if_snd_tag_modify_params *); -static int cxgbe_snd_tag_query(struct m_snd_tag *, - union if_snd_tag_query_params *); -static void cxgbe_snd_tag_free(struct m_snd_tag *); #endif MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio T4/T5 Ethernet driver and services"); @@ -2453,9 +2448,6 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi) ifp->if_get_counter = cxgbe_get_counter; #if defined(KERN_TLS) || defined(RATELIMIT) ifp->if_snd_tag_alloc = cxgbe_snd_tag_alloc; - ifp->if_snd_tag_modify = cxgbe_snd_tag_modify; - ifp->if_snd_tag_query = cxgbe_snd_tag_query; - ifp->if_snd_tag_free = cxgbe_snd_tag_free; #endif #ifdef RATELIMIT ifp->if_ratelimit_query = cxgbe_ratelimit_query; @@ -2926,7 +2918,7 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) } #ifdef RATELIMIT if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { - if (m->m_pkthdr.snd_tag->type == IF_SND_TAG_TYPE_RATE_LIMIT) + if (m->m_pkthdr.snd_tag->sw->type == IF_SND_TAG_TYPE_RATE_LIMIT) return (ethofld_transmit(ifp, m)); } #endif @@ -3109,56 +3101,6 @@ cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, } return (error); } - -static int -cxgbe_snd_tag_modify(struct m_snd_tag *mst, - union if_snd_tag_modify_params *params) -{ - - switch (mst->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - return (cxgbe_rate_tag_modify(mst, params)); -#endif - default: - return (EOPNOTSUPP); - } -} - -static int -cxgbe_snd_tag_query(struct m_snd_tag *mst, - union if_snd_tag_query_params *params) -{ - - switch (mst->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - return (cxgbe_rate_tag_query(mst, params)); -#endif - default: - return (EOPNOTSUPP); - } -} - -static void -cxgbe_snd_tag_free(struct m_snd_tag *mst) -{ - - switch (mst->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - cxgbe_rate_tag_free(mst); - return; -#endif -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS: - cxgbe_tls_tag_free(mst); - return; -#endif - default: - panic("shouldn't get here"); - } -} #endif /* diff --git a/sys/dev/cxgbe/t4_sched.c b/sys/dev/cxgbe/t4_sched.c index b19e62474bbb..82f8537bda38 100644 --- a/sys/dev/cxgbe/t4_sched.c +++ b/sys/dev/cxgbe/t4_sched.c @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include "common/t4_regs_values.h" #include "common/t4_msg.h" - static int in_range(int val, int lo, int hi) { @@ -785,6 +784,19 @@ free_etid(struct adapter *sc, int etid) mtx_unlock(&t->etid_lock); } +static int cxgbe_rate_tag_modify(struct m_snd_tag *, + union if_snd_tag_modify_params *); +static int cxgbe_rate_tag_query(struct m_snd_tag *, + union if_snd_tag_query_params *); +static void cxgbe_rate_tag_free(struct m_snd_tag *); + +static const struct if_snd_tag_sw cxgbe_rate_tag_sw = { + .snd_tag_modify = cxgbe_rate_tag_modify, + .snd_tag_query = cxgbe_rate_tag_query, + .snd_tag_free = cxgbe_rate_tag_free, + .type = IF_SND_TAG_TYPE_RATE_LIMIT +}; + int cxgbe_rate_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **pt) @@ -819,7 +831,7 @@ failed: mtx_init(&cst->lock, "cst_lock", NULL, MTX_DEF); mbufq_init(&cst->pending_tx, INT_MAX); mbufq_init(&cst->pending_fwack, INT_MAX); - m_snd_tag_init(&cst->com, ifp, IF_SND_TAG_TYPE_RATE_LIMIT); + m_snd_tag_init(&cst->com, ifp, &cxgbe_rate_tag_sw); cst->flags |= EO_FLOWC_PENDING | EO_SND_TAG_REF; cst->adapter = sc; cst->port_id = pi->port_id; @@ -843,7 +855,7 @@ failed: /* * Change in parameters, no change in ifp. */ -int +static int cxgbe_rate_tag_modify(struct m_snd_tag *mst, union if_snd_tag_modify_params *params) { @@ -869,7 +881,7 @@ cxgbe_rate_tag_modify(struct m_snd_tag *mst, return (0); } -int +static int cxgbe_rate_tag_query(struct m_snd_tag *mst, union if_snd_tag_query_params *params) { @@ -908,7 +920,7 @@ cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *cst) free(cst, M_CXGBE); } -void +static void cxgbe_rate_tag_free(struct m_snd_tag *mst) { struct cxgbe_rate_tag *cst = mst_to_crt(mst); diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index d927d34b616b..8a502907d172 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -2369,7 +2369,7 @@ static inline int needs_eo(struct m_snd_tag *mst) { - return (mst != NULL && mst->type == IF_SND_TAG_TYPE_RATE_LIMIT); + return (mst != NULL && mst->sw->type == IF_SND_TAG_TYPE_RATE_LIMIT); } #endif @@ -2712,7 +2712,7 @@ restart: mst = NULL; #endif #ifdef KERN_TLS - if (mst != NULL && mst->type == IF_SND_TAG_TYPE_TLS) { + if (mst != NULL && mst->sw->type == IF_SND_TAG_TYPE_TLS) { int len16; cflags |= MC_TLS; diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 7c37a785f23c..e8d4dcda85de 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -1216,9 +1216,4 @@ int mlx5e_update_buf_lossy(struct mlx5e_priv *priv); int mlx5e_fec_update(struct mlx5e_priv *priv); int mlx5e_hw_temperature_update(struct mlx5e_priv *priv); -if_snd_tag_alloc_t mlx5e_ul_snd_tag_alloc; -if_snd_tag_modify_t mlx5e_ul_snd_tag_modify; -if_snd_tag_query_t mlx5e_ul_snd_tag_query; -if_snd_tag_free_t mlx5e_ul_snd_tag_free; - #endif /* _MLX5_EN_H_ */ diff --git a/sys/dev/mlx5/mlx5_en/en_hw_tls.h b/sys/dev/mlx5/mlx5_en/en_hw_tls.h index eca9843c7673..5f2c5da5dfc0 100644 --- a/sys/dev/mlx5/mlx5_en/en_hw_tls.h +++ b/sys/dev/mlx5/mlx5_en/en_hw_tls.h @@ -97,8 +97,5 @@ void mlx5e_tls_cleanup(struct mlx5e_priv *); int mlx5e_sq_tls_xmit(struct mlx5e_sq *, struct mlx5e_xmit_args *, struct mbuf **); if_snd_tag_alloc_t mlx5e_tls_snd_tag_alloc; -if_snd_tag_modify_t mlx5e_tls_snd_tag_modify; -if_snd_tag_query_t mlx5e_tls_snd_tag_query; -if_snd_tag_free_t mlx5e_tls_snd_tag_free; #endif /* _MLX5_TLS_H_ */ diff --git a/sys/dev/mlx5/mlx5_en/en_rl.h b/sys/dev/mlx5/mlx5_en/en_rl.h index f30e8ba8cc07..1d7f7afc487d 100644 --- a/sys/dev/mlx5/mlx5_en/en_rl.h +++ b/sys/dev/mlx5/mlx5_en/en_rl.h @@ -168,8 +168,5 @@ void mlx5e_rl_cleanup(struct mlx5e_priv *priv); void mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl); if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; -if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; -if_snd_tag_query_t mlx5e_rl_snd_tag_query; -if_snd_tag_free_t mlx5e_rl_snd_tag_free; #endif /* __MLX5_EN_RL_H__ */ diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c index 1a92e5aa222a..6140671fe0c2 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c @@ -37,6 +37,27 @@ #ifdef KERN_TLS +#ifdef RATELIMIT +static if_snd_tag_modify_t mlx5e_tls_rl_snd_tag_modify; +#endif +static if_snd_tag_query_t mlx5e_tls_snd_tag_query; +static if_snd_tag_free_t mlx5e_tls_snd_tag_free; + +static const struct if_snd_tag_sw mlx5e_tls_snd_tag_sw = { + .snd_tag_query = mlx5e_tls_snd_tag_query, + .snd_tag_free = mlx5e_tls_snd_tag_free, + .type = IF_SND_TAG_TYPE_TLS +}; + +#ifdef RATELIMIT +static const struct if_snd_tag_sw mlx5e_tls_rl_snd_tag_sw = { + .snd_tag_modify = mlx5e_tls_rl_snd_tag_modify, + .snd_tag_query = mlx5e_tls_snd_tag_query, + .snd_tag_free = mlx5e_tls_snd_tag_free, + .type = IF_SND_TAG_TYPE_TLS_RATE_LIMIT +}; +#endif + MALLOC_DEFINE(M_MLX5E_TLS, "MLX5E_TLS", "MLX5 ethernet HW TLS"); /* software TLS context */ @@ -281,6 +302,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, struct m_snd_tag **ppmt) { union if_snd_tag_alloc_params rl_params; + const struct if_snd_tag_sw *snd_tag_sw; struct mlx5e_priv *priv; struct mlx5e_tls_tag *ptag; const struct tls_session_params *en; @@ -384,10 +406,12 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: rl_params.hdr.type = IF_SND_TAG_TYPE_RATE_LIMIT; rl_params.rate_limit.max_rate = params->tls_rate_limit.max_rate; + snd_tag_sw = &mlx5e_tls_rl_snd_tag_sw; break; #endif case IF_SND_TAG_TYPE_TLS: rl_params.hdr.type = IF_SND_TAG_TYPE_UNLIMITED; + snd_tag_sw = &mlx5e_tls_snd_tag_sw; break; default: error = EOPNOTSUPP; @@ -400,7 +424,7 @@ mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, /* store pointer to mbuf tag */ MPASS(ptag->tag.refcount == 0); - m_snd_tag_init(&ptag->tag, ifp, params->hdr.type); + m_snd_tag_init(&ptag->tag, ifp, snd_tag_sw); *ppmt = &ptag->tag; queue_work(priv->tls.wq, &ptag->work); @@ -413,53 +437,32 @@ failure: return (error); } -int -mlx5e_tls_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) -{ #ifdef RATELIMIT +static int +mlx5e_tls_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) +{ union if_snd_tag_modify_params rl_params; struct mlx5e_tls_tag *ptag = container_of(pmt, struct mlx5e_tls_tag, tag); int error; -#endif - switch (pmt->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: - memset(&rl_params, 0, sizeof(rl_params)); - rl_params.rate_limit.max_rate = params->tls_rate_limit.max_rate; - error = ptag->rl_tag->ifp->if_snd_tag_modify(ptag->rl_tag, - &rl_params); - return (error); -#endif - default: - return (EOPNOTSUPP); - } + memset(&rl_params, 0, sizeof(rl_params)); + rl_params.rate_limit.max_rate = params->tls_rate_limit.max_rate; + error = ptag->rl_tag->sw->snd_tag_modify(ptag->rl_tag, &rl_params); + return (error); } +#endif -int +static int mlx5e_tls_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) { struct mlx5e_tls_tag *ptag = container_of(pmt, struct mlx5e_tls_tag, tag); - int error; - switch (pmt->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: -#endif - case IF_SND_TAG_TYPE_TLS: - error = ptag->rl_tag->ifp->if_snd_tag_query(ptag->rl_tag, - params); - break; - default: - error = EOPNOTSUPP; - break; - } - return (error); + return (ptag->rl_tag->sw->snd_tag_query(ptag->rl_tag, params)); } -void +static void mlx5e_tls_snd_tag_free(struct m_snd_tag *pmt) { struct mlx5e_tls_tag *ptag = @@ -690,9 +693,9 @@ mlx5e_sq_tls_xmit(struct mlx5e_sq *sq, struct mlx5e_xmit_args *parg, struct mbuf if ( #ifdef RATELIMIT - ptag->type != IF_SND_TAG_TYPE_TLS_RATE_LIMIT && + ptag->sw->type != IF_SND_TAG_TYPE_TLS_RATE_LIMIT && #endif - ptag->type != IF_SND_TAG_TYPE_TLS) + ptag->sw->type != IF_SND_TAG_TYPE_TLS) return (MLX5E_TLS_CONTINUE); ptls_tag = container_of(ptag, struct mlx5e_tls_tag, tag); diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 40e0d2b0c342..9d8854528d4a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -36,6 +36,8 @@ #include static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); +static if_snd_tag_query_t mlx5e_ul_snd_tag_query; +static if_snd_tag_free_t mlx5e_ul_snd_tag_free; struct mlx5e_channel_param { struct mlx5e_rq_param rq; @@ -346,6 +348,12 @@ static const struct media mlx5e_ext_mode_table[MLX5E_EXT_LINK_SPEEDS_NUMBER][MLX }, }; +static const struct if_snd_tag_sw mlx5e_ul_snd_tag_sw = { + .snd_tag_query = mlx5e_ul_snd_tag_query, + .snd_tag_free = mlx5e_ul_snd_tag_free, + .type = IF_SND_TAG_TYPE_UNLIMITED +}; + DEBUGNET_DEFINE(mlx5_en); MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); @@ -2113,7 +2121,7 @@ mlx5e_chan_static_init(struct mlx5e_priv *priv, struct mlx5e_channel *c, int ix) c->ix = ix; /* setup send tag */ - m_snd_tag_init(&c->tag, c->priv->ifp, IF_SND_TAG_TYPE_UNLIMITED); + m_snd_tag_init(&c->tag, c->priv->ifp, &mlx5e_ul_snd_tag_sw); init_completion(&c->completion); @@ -4174,7 +4182,7 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) PRIV_UNLOCK(priv); } -int +static int mlx5e_ul_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **ppmt) @@ -4216,7 +4224,7 @@ mlx5e_ul_snd_tag_alloc(struct ifnet *ifp, } } -int +static int mlx5e_ul_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) { struct mlx5e_channel *pch = @@ -4227,7 +4235,7 @@ mlx5e_ul_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *par return (0); } -void +static void mlx5e_ul_snd_tag_free(struct m_snd_tag *pmt) { struct mlx5e_channel *pch = @@ -4262,52 +4270,6 @@ mlx5e_snd_tag_alloc(struct ifnet *ifp, } } -static int -mlx5e_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) -{ - - switch (pmt->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - return (mlx5e_rl_snd_tag_modify(pmt, params)); -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: - return (mlx5e_tls_snd_tag_modify(pmt, params)); -#endif -#endif - case IF_SND_TAG_TYPE_UNLIMITED: -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS: -#endif - default: - return (EOPNOTSUPP); - } -} - -static int -mlx5e_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) -{ - - switch (pmt->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - return (mlx5e_rl_snd_tag_query(pmt, params)); -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: - return (mlx5e_tls_snd_tag_query(pmt, params)); -#endif -#endif - case IF_SND_TAG_TYPE_UNLIMITED: - return (mlx5e_ul_snd_tag_query(pmt, params)); -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS: - return (mlx5e_tls_snd_tag_query(pmt, params)); -#endif - default: - return (EOPNOTSUPP); - } -} - #ifdef RATELIMIT #define NUM_HDWR_RATES_MLX 13 static const uint64_t adapter_rates_mlx[NUM_HDWR_RATES_MLX] = { @@ -4352,34 +4314,6 @@ mlx5e_ratelimit_query(struct ifnet *ifp __unused, struct if_ratelimit_query_resu } #endif -static void -mlx5e_snd_tag_free(struct m_snd_tag *pmt) -{ - - switch (pmt->type) { -#ifdef RATELIMIT - case IF_SND_TAG_TYPE_RATE_LIMIT: - mlx5e_rl_snd_tag_free(pmt); - break; -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: - mlx5e_tls_snd_tag_free(pmt); - break; -#endif -#endif - case IF_SND_TAG_TYPE_UNLIMITED: - mlx5e_ul_snd_tag_free(pmt); - break; -#ifdef KERN_TLS - case IF_SND_TAG_TYPE_TLS: - mlx5e_tls_snd_tag_free(pmt); - break; -#endif - default: - break; - } -} - static void mlx5e_ifm_add(struct mlx5e_priv *priv, int type) { @@ -4467,9 +4401,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) #endif ifp->if_capabilities |= IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO; ifp->if_snd_tag_alloc = mlx5e_snd_tag_alloc; - ifp->if_snd_tag_free = mlx5e_snd_tag_free; - ifp->if_snd_tag_modify = mlx5e_snd_tag_modify; - ifp->if_snd_tag_query = mlx5e_snd_tag_query; #ifdef RATELIMIT ifp->if_ratelimit_query = mlx5e_ratelimit_query; #endif diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 43532c4d0cc0..a95a227e639d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -38,6 +38,16 @@ static void mlx5e_rl_sysctl_add_stats_u64_oid(struct mlx5e_rl_priv_data *rl, uns struct sysctl_oid *node, const char *name, const char *desc); static int mlx5e_rl_tx_limit_add(struct mlx5e_rl_priv_data *, uint64_t value); static int mlx5e_rl_tx_limit_clr(struct mlx5e_rl_priv_data *, uint64_t value); +static if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; +static if_snd_tag_query_t mlx5e_rl_snd_tag_query; +static if_snd_tag_free_t mlx5e_rl_snd_tag_free; + +static const struct if_snd_tag_sw mlx5e_rl_snd_tag_sw = { + .snd_tag_modify = mlx5e_rl_snd_tag_modify, + .snd_tag_query = mlx5e_rl_snd_tag_query, + .snd_tag_free = mlx5e_rl_snd_tag_free, + .type = IF_SND_TAG_TYPE_RATE_LIMIT +}; static void mlx5e_rl_build_sq_param(struct mlx5e_rl_priv_data *rl, @@ -830,7 +840,6 @@ mlx5e_rl_init(struct mlx5e_priv *priv) for (i = 0; i < rl->param.tx_channels_per_worker_def; i++) { struct mlx5e_rl_channel *channel = rlw->channels + i; channel->worker = rlw; - channel->tag.type = IF_SND_TAG_TYPE_RATE_LIMIT; STAILQ_INSERT_TAIL(&rlw->index_list_head, channel, entry); } MLX5E_RL_WORKER_UNLOCK(rlw); @@ -1110,14 +1119,14 @@ mlx5e_rl_snd_tag_alloc(struct ifnet *ifp, /* store pointer to mbuf tag */ MPASS(channel->tag.refcount == 0); - m_snd_tag_init(&channel->tag, ifp, IF_SND_TAG_TYPE_RATE_LIMIT); + m_snd_tag_init(&channel->tag, ifp, &mlx5e_rl_snd_tag_sw); *ppmt = &channel->tag; done: return (error); } -int +static int mlx5e_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) { struct mlx5e_rl_channel *channel = @@ -1126,7 +1135,7 @@ mlx5e_rl_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *p return (mlx5e_rl_modify(channel->worker, channel, params->rate_limit.max_rate)); } -int +static int mlx5e_rl_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) { struct mlx5e_rl_channel *channel = @@ -1135,7 +1144,7 @@ mlx5e_rl_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *par return (mlx5e_rl_query(channel->worker, channel, params)); } -void +static void mlx5e_rl_snd_tag_free(struct m_snd_tag *pmt) { struct mlx5e_rl_channel *channel = diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c index e85522bdfad7..e469482c99bd 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c @@ -98,7 +98,7 @@ mlx5e_select_queue_by_send_tag(struct ifnet *ifp, struct mbuf *mb) top: #endif /* get pointer to sendqueue */ - switch (mb_tag->type) { + switch (mb_tag->sw->type) { #ifdef RATELIMIT case IF_SND_TAG_TYPE_RATE_LIMIT: sq = container_of(mb_tag, diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 123985a7dec2..36316f2bc3ff 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1585,13 +1585,14 @@ m_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, } void -m_snd_tag_init(struct m_snd_tag *mst, struct ifnet *ifp, u_int type) +m_snd_tag_init(struct m_snd_tag *mst, struct ifnet *ifp, + const struct if_snd_tag_sw *sw) { if_ref(ifp); mst->ifp = ifp; refcount_init(&mst->refcount, 1); - mst->type = type; + mst->sw = sw; counter_u64_add(snd_tag_count, 1); } @@ -1601,7 +1602,7 @@ m_snd_tag_destroy(struct m_snd_tag *mst) struct ifnet *ifp; ifp = mst->ifp; - ifp->if_snd_tag_free(mst); + mst->sw->snd_tag_free(mst); if_rele(ifp); counter_u64_add(snd_tag_count, -1); } diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 28fc7a0a97ec..9e9a6b5b60fb 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1459,7 +1459,6 @@ ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate) .rate_limit.flags = M_NOWAIT, }; struct m_snd_tag *mst; - struct ifnet *ifp; /* Can't get to the inp, but it should be locked. */ /* INP_LOCK_ASSERT(inp); */ @@ -1477,11 +1476,10 @@ ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate) } MPASS(tls->snd_tag != NULL); - MPASS(tls->snd_tag->type == IF_SND_TAG_TYPE_TLS_RATE_LIMIT); + MPASS(tls->snd_tag->sw->type == IF_SND_TAG_TYPE_TLS_RATE_LIMIT); mst = tls->snd_tag; - ifp = mst->ifp; - return (ifp->if_snd_tag_modify(mst, ¶ms)); + return (mst->sw->snd_tag_modify(mst, ¶ms)); } #endif #endif diff --git a/sys/net/if_dead.c b/sys/net/if_dead.c index b01d17fe9b1b..5721e9490776 100644 --- a/sys/net/if_dead.c +++ b/sys/net/if_dead.c @@ -109,23 +109,6 @@ ifdead_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, return (EOPNOTSUPP); } -static int -ifdead_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) -{ - return (EOPNOTSUPP); -} - -static int -ifdead_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) -{ - return (EOPNOTSUPP); -} - -static void -ifdead_snd_tag_free(struct m_snd_tag *pmt) -{ -} - static void ifdead_ratelimit_query(struct ifnet *ifp __unused, struct if_ratelimit_query_results *q) @@ -156,8 +139,5 @@ if_dead(struct ifnet *ifp) ifp->if_transmit = ifdead_transmit; ifp->if_get_counter = ifdead_get_counter; ifp->if_snd_tag_alloc = ifdead_snd_tag_alloc; - ifp->if_snd_tag_modify = ifdead_snd_tag_modify; - ifp->if_snd_tag_query = ifdead_snd_tag_query; - ifp->if_snd_tag_free = ifdead_snd_tag_free; ifp->if_ratelimit_query = ifdead_ratelimit_query; } diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index c53e5b283b76..8f7900277f01 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -583,10 +583,6 @@ lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; #if defined(KERN_TLS) || defined(RATELIMIT) ifp->if_snd_tag_alloc = lagg_snd_tag_alloc; - ifp->if_snd_tag_modify = lagg_snd_tag_modify; - ifp->if_snd_tag_query = lagg_snd_tag_query; - ifp->if_snd_tag_free = lagg_snd_tag_free; - ifp->if_next_snd_tag = lagg_next_snd_tag; ifp->if_ratelimit_query = lagg_ratelimit_query; #endif ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS; @@ -1741,6 +1737,44 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } #if defined(KERN_TLS) || defined(RATELIMIT) +#ifdef RATELIMIT +static const struct if_snd_tag_sw lagg_snd_tag_ul_sw = { + .snd_tag_modify = lagg_snd_tag_modify, + .snd_tag_query = lagg_snd_tag_query, + .snd_tag_free = lagg_snd_tag_free, + .next_snd_tag = lagg_next_snd_tag, + .type = IF_SND_TAG_TYPE_UNLIMITED +}; + +static const struct if_snd_tag_sw lagg_snd_tag_rl_sw = { + .snd_tag_modify = lagg_snd_tag_modify, + .snd_tag_query = lagg_snd_tag_query, + .snd_tag_free = lagg_snd_tag_free, + .next_snd_tag = lagg_next_snd_tag, + .type = IF_SND_TAG_TYPE_RATE_LIMIT +}; +#endif + +#ifdef KERN_TLS +static const struct if_snd_tag_sw lagg_snd_tag_tls_sw = { + .snd_tag_modify = lagg_snd_tag_modify, + .snd_tag_query = lagg_snd_tag_query, + .snd_tag_free = lagg_snd_tag_free, + .next_snd_tag = lagg_next_snd_tag, + .type = IF_SND_TAG_TYPE_TLS +}; + +#ifdef RATELIMIT +static const struct if_snd_tag_sw lagg_snd_tag_tls_rl_sw = { + .snd_tag_modify = lagg_snd_tag_modify, + .snd_tag_query = lagg_snd_tag_query, + .snd_tag_free = lagg_snd_tag_free, + .next_snd_tag = lagg_next_snd_tag, + .type = IF_SND_TAG_TYPE_TLS_RATE_LIMIT +}; +#endif +#endif + static inline struct lagg_snd_tag * mst_to_lst(struct m_snd_tag *mst) { @@ -1796,6 +1830,7 @@ lagg_snd_tag_alloc(struct ifnet *ifp, struct m_snd_tag **ppmt) { struct epoch_tracker et; + const struct if_snd_tag_sw *sw; struct lagg_snd_tag *lst; struct lagg_softc *sc; struct lagg_port *lp; @@ -1804,6 +1839,29 @@ lagg_snd_tag_alloc(struct ifnet *ifp, sc = ifp->if_softc; + switch (params->hdr.type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_UNLIMITED: + sw = &lagg_snd_tag_ul_sw; + break; + case IF_SND_TAG_TYPE_RATE_LIMIT: + sw = &lagg_snd_tag_rl_sw; + break; +#endif +#ifdef KERN_TLS + case IF_SND_TAG_TYPE_TLS: + sw = &lagg_snd_tag_tls_sw; + break; +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: + sw = &lagg_snd_tag_tls_rl_sw; + break; +#endif +#endif + default: + return (EOPNOTSUPP); + } + NET_EPOCH_ENTER(et); lp = lookup_snd_tag_port(ifp, params->hdr.flowid, params->hdr.flowtype, params->hdr.numa_domain); @@ -1832,7 +1890,7 @@ lagg_snd_tag_alloc(struct ifnet *ifp, return (error); } - m_snd_tag_init(&lst->com, ifp, lst->tag->type); + m_snd_tag_init(&lst->com, ifp, sw); *ppmt = &lst->com; return (0); @@ -1854,7 +1912,7 @@ lagg_snd_tag_modify(struct m_snd_tag *mst, struct lagg_snd_tag *lst; lst = mst_to_lst(mst); - return (lst->tag->ifp->if_snd_tag_modify(lst->tag, params)); + return (lst->tag->sw->snd_tag_modify(lst->tag, params)); } static int @@ -1864,7 +1922,7 @@ lagg_snd_tag_query(struct m_snd_tag *mst, struct lagg_snd_tag *lst; lst = mst_to_lst(mst); - return (lst->tag->ifp->if_snd_tag_query(lst->tag, params)); + return (lst->tag->sw->snd_tag_query(lst->tag, params)); } static void diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 052ec6b407a0..45fba9513a8b 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -249,6 +249,21 @@ union if_snd_tag_query_params { struct if_snd_tag_rate_limit_params tls_rate_limit; }; +typedef int (if_snd_tag_alloc_t)(struct ifnet *, union if_snd_tag_alloc_params *, + struct m_snd_tag **); +typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_params *); +typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *); +typedef void (if_snd_tag_free_t)(struct m_snd_tag *); +typedef struct m_snd_tag *(if_next_send_tag_t)(struct m_snd_tag *); + +struct if_snd_tag_sw { + if_snd_tag_modify_t *snd_tag_modify; + if_snd_tag_query_t *snd_tag_query; + if_snd_tag_free_t *snd_tag_free; + if_next_send_tag_t *next_snd_tag; + u_int type; /* One of IF_SND_TAG_TYPE_*. */ +}; + /* Query return flags */ #define RT_NOSUPPORT 0x00000000 /* Not supported */ #define RT_IS_INDIRECT 0x00000001 /* @@ -273,12 +288,6 @@ struct if_ratelimit_query_results { uint32_t min_segment_burst; /* The amount the adapter bursts at each send */ }; -typedef int (if_snd_tag_alloc_t)(struct ifnet *, union if_snd_tag_alloc_params *, - struct m_snd_tag **); -typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_params *); -typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *); -typedef void (if_snd_tag_free_t)(struct m_snd_tag *); -typedef struct m_snd_tag *(if_next_send_tag_t)(struct m_snd_tag *); typedef void (if_ratelimit_query_t)(struct ifnet *, struct if_ratelimit_query_results *); typedef int (if_ratelimit_setup_t)(struct ifnet *, uint64_t, uint32_t); @@ -420,10 +429,8 @@ struct ifnet { * Network adapter send tag support: */ if_snd_tag_alloc_t *if_snd_tag_alloc; - if_snd_tag_modify_t *if_snd_tag_modify; - if_snd_tag_query_t *if_snd_tag_query; - if_snd_tag_free_t *if_snd_tag_free; - if_next_send_tag_t *if_next_snd_tag; + + /* Ratelimit (packet pacing) */ if_ratelimit_query_t *if_ratelimit_query; if_ratelimit_setup_t *if_ratelimit_setup; diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 10a254d22440..07c325d0cb12 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -336,6 +336,44 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner); *** 259 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Sep 14 18:56:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BDAA66EC55; Tue, 14 Sep 2021 18:56:45 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8CHw3lSZz4Wk9; Tue, 14 Sep 2021 18:56:44 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm1-x332.google.com with SMTP id c8-20020a7bc008000000b002e6e462e95fso2938815wmb.2; Tue, 14 Sep 2021 11:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=28JPq7X2OaarKyHP4zBBkeheqDsbh7iPF4faibRQIv0=; b=Nhhqoh574cX40tZoEMlUHC9vpt0uwyOUUHtAat+Y3b5kqt7RlJR/Ix1/avGXmGMV7U zs3kZzAy9rrw2rgGD7uZR/XAE2l3ZQgjkNqK0iDR64QhOibKFIXcUEWA5tu2crCZWmVD /zFq1fG+BOqHQl5lr9btSLsM8Owo4vb8lqiTkZmomty4YAgge8WfoIaQXWgXdfnN5qnZ 7sQRXHSpceuRQ0gzVBHSLkKqgdVglRXl70bsOLzoAZmksknhvNT+mK1biQQ1qFWtun97 0iW0b+Rip0KP3aDKJ94h2QJRvIlxqGK2dgrV4POqW2ba0hfH6DDxRva0IXChYz0usEpc NFNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:mime-version:subject:from:in-reply-to :date:cc:content-transfer-encoding:message-id:references:to; bh=28JPq7X2OaarKyHP4zBBkeheqDsbh7iPF4faibRQIv0=; b=bL78VYx/XoVRJE3Nv/JWl/VM554/hKgt8TB8vCP5eHSQb/d/Xkf4m9toD/FJSfjQoR hJuk9L08FG8jAN4vLEmaH4bIIN/WKB9TX0n0OH2Ox5Xysu68FrdmG7DQC2/yhN/IttBW zW5bnxGE+xGprWEmKiYb/PirLMggteO/RgxbMoUGjKNkglMOLWknuMxLmg/iOa+HA4ha 40oAzlm0HuhbyGndFr/VaQ7K3n2txzi3waq1ZwnbDeU2y0If7ONOIZueUo1sesULxFpE CrHP2IFS+NEV7L2w+TuCAbQ+jGZnhIuPKwoMvl4+Cl0i9eYop+UjQOmreyIvejMNJTil XKHg== X-Gm-Message-State: AOAM533SBRcLACED3W23F3VXlsqRlf4qyvcEz1+LJy9G0caN+CTkISjO 58mAZcM1rF6FldHGgTRTD8FX/i1BkQk= X-Google-Smtp-Source: ABdhPJzbs/0tD46Cy1rK0utfbrsKjCs3wM6hlDlDCrPWV7/7Vwhu54HYHH1OqM0Md8xGot6grcCGkA== X-Received: by 2002:a05:600c:b56:: with SMTP id k22mr585239wmr.92.1631645803542; Tue, 14 Sep 2021 11:56:43 -0700 (PDT) Received: from smtpclient.apple (cpc159423-cmbg20-2-0-cust338.5-4.cable.virginm.net. [86.7.147.83]) by smtp.gmail.com with ESMTPSA id i2sm7074632wrq.78.2021.09.14.11.56.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Sep 2021 11:56:43 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection From: Edward Napierala In-Reply-To: <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org> Date: Tue, 14 Sep 2021 19:56:42 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org> To: Bryan Drewery X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H8CHw3lSZz4Wk9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Nhhqoh57; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::332 as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[86.7.147.83:received]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::332:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 18:56:45 -0000 > On 14 Sep 2021, at 17:39, Bryan Drewery wrote: >=20 > On 9/13/2021 7:42 AM, Edward Tomasz Napierala wrote: >> +#else /* !DETECT_TZ_CHANGES */ >> +#define change_in_tz(X) 0 >=20 > WITHOUT_DETECT_TZ_CHANGES: change_in_tz() =3D=3D 0 >=20 >> +#endif /* !DETECT_TZ_CHANGES */ >> + >> static int >> differ_by_repeat(const time_t t1, const time_t t0) >> { >> @@ -379,6 +418,7 @@ register const int doextend; >> int stored; >> int nread; >> int res; >> + int ret; >> union { >> struct tzhead tzhead; >> char buf[2 * sizeof(struct tzhead) + >> @@ -427,6 +467,22 @@ register const int doextend; >> (void) strcat(fullname, name); >> name =3D fullname; >> } >> + if (doextend =3D=3D TRUE) { >> + /* >> + * Detect if the timezone file has changed. = Check >> + * 'doextend' to ignore TZDEFRULES; the = change_in_tz() >> + * function can only keep state for a single = file. >> + */ >> + ret =3D change_in_tz(name); >> + if (ret <=3D 0) { >=20 > WITHOUT_DETECT_TZ_CHANGES: Always returns a false-positive "done" but > short-circuits the rest of tzload(). >=20 >> + /* >> + * Returns -1 if there was an error, >> + * and 0 if the timezone had not = changed. >> + */ >> + free(fullname); >> + return ret; >> + } >> + } Thanks! No idea how I could miss this. Does = https://reviews.freebsd.org/D31961 look reasonable? From owner-dev-commits-src-main@freebsd.org Tue Sep 14 19:11:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA0C866F1A1; Tue, 14 Sep 2021 19:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8CdQ32vqz4bRh; Tue, 14 Sep 2021 19:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D2ED20412; Tue, 14 Sep 2021 19:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EJBsvF022641; Tue, 14 Sep 2021 19:11:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EJBsMj022640; Tue, 14 Sep 2021 19:11:54 GMT (envelope-from git) Date: Tue, 14 Sep 2021 19:11:54 GMT Message-Id: <202109141911.18EJBsMj022640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 90f33f34bace - main - Remove a bogus assertion from the gic drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90f33f34baceab33046ee8401153aaafd164bb48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 19:11:54 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=90f33f34baceab33046ee8401153aaafd164bb48 commit 90f33f34baceab33046ee8401153aaafd164bb48 Author: Andrew Turner AuthorDate: 2021-09-14 19:03:30 +0000 Commit: Andrew Turner CommitDate: 2021-09-14 19:06:25 +0000 Remove a bogus assertion from the gic drivers When setting a message based interrupt range we set the base and count. In an earlier the count was implemented as an end value, however the asserts used to check this value was correct were incorrectly left in. Reported by: emaste Sponsored by: The FreeBSD Foundation --- sys/arm/arm/gic.c | 2 -- sys/arm64/arm64/gic_v3.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index bd34e92b9e28..d7edd7885404 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -538,8 +538,6 @@ arm_gic_write_ivar(device_t dev, device_t child, int which, uintptr_t value) case GIC_IVAR_MBI_COUNT: MPASS(sc->sc_spi_start != 0); MPASS(sc->sc_spi_count == 0); - MPASS(value >= sc->sc_spi_start); - MPASS(value >= GIC_FIRST_SPI); sc->sc_spi_count = value; sc->sc_spi_end = sc->sc_spi_start + sc->sc_spi_count; diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index a53d0b272723..23e1b3632fb8 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -506,8 +506,6 @@ gic_v3_write_ivar(device_t dev, device_t child, int which, uintptr_t value) case GIC_IVAR_MBI_COUNT: MPASS(sc->gic_mbi_start != 0); MPASS(sc->gic_mbi_end == 0); - MPASS(value >= sc->gic_mbi_start); - MPASS(value >= GIC_FIRST_SPI); sc->gic_mbi_end = value - sc->gic_mbi_start; From owner-dev-commits-src-main@freebsd.org Tue Sep 14 19:14:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC3466F03E; Tue, 14 Sep 2021 19:14:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Chr2jZFz4cPF; Tue, 14 Sep 2021 19:14:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DD0A2022F; Tue, 14 Sep 2021 19:14:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EJEqn8023918; Tue, 14 Sep 2021 19:14:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EJEqDW023917; Tue, 14 Sep 2021 19:14:52 GMT (envelope-from git) Date: Tue, 14 Sep 2021 19:14:52 GMT Message-Id: <202109141914.18EJEqDW023917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 8cba2003e85b - main - Cirrus-CI: add a manually triggered arm64 task MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cba2003e85b49a482ca623945209ca537374229 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 19:14:52 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8cba2003e85b49a482ca623945209ca537374229 commit 8cba2003e85b49a482ca623945209ca537374229 Author: Ed Maste AuthorDate: 2021-06-23 19:24:36 +0000 Commit: Ed Maste CommitDate: 2021-09-14 19:12:55 +0000 Cirrus-CI: add a manually triggered arm64 task Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31953 --- .cirrus.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 461339f1bfcb..d34f189f0db0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,16 @@ compute_engine_instance: disk: 40 task: - name: World and kernel amd64 build and boot smoke test + matrix: + - name: World and kernel amd64 build and boot smoke test + env: + TARGET: amd64 + TARGET_ARCH: amd64 + - name: World and kernel arm64 build and boot smoke test + trigger_type: manual + env: + TARGET: arm64 + TARGET_ARCH: aarch64 timeout_in: 120m install_script: - sh .cirrus-ci/pkg-install.sh qemu llvm12 From owner-dev-commits-src-main@freebsd.org Tue Sep 14 19:52:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E614F66F9D1; Tue, 14 Sep 2021 19:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8DXJ65CZz4mXG; Tue, 14 Sep 2021 19:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B162B20AB8; Tue, 14 Sep 2021 19:52:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EJqWmk076357; Tue, 14 Sep 2021 19:52:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EJqWa5076356; Tue, 14 Sep 2021 19:52:32 GMT (envelope-from git) Date: Tue, 14 Sep 2021 19:52:32 GMT Message-Id: <202109141952.18EJqWa5076356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 49050613ef1f - main - ctl(4): Do hole-punching for UNMAP to file-backed LUNs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49050613ef1fac244c3cb9767cbdff3d10bee670 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 19:52:33 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=49050613ef1fac244c3cb9767cbdff3d10bee670 commit 49050613ef1fac244c3cb9767cbdff3d10bee670 Author: Ka Ho Ng AuthorDate: 2021-09-14 19:51:58 +0000 Commit: Ka Ho Ng CommitDate: 2021-09-14 19:51:58 +0000 ctl(4): Do hole-punching for UNMAP to file-backed LUNs This adds support for SCSI UNMAP command to file-backed LUNs, if the underlying file system has a non-zerofilling VOP_DEALLOCATE implementation where some or all parts of the requested operation range may be deallocated. Sponsored by: The FreeBSD Foundation Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31922 --- sys/cam/ctl/ctl_backend_block.c | 99 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 83ea6b43dac3..8c126d8be229 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -3,13 +3,16 @@ * * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2009-2011 Spectra Logic Corporation - * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2012,2021 The FreeBSD Foundation * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala * under sponsorship from the FreeBSD Foundation. * + * Portions of this software were developed by Ka Ho Ng + * 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: @@ -81,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -245,6 +249,8 @@ static void ctl_be_block_gls_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio); static uint64_t ctl_be_block_getattr_file(struct ctl_be_block_lun *be_lun, const char *attrname); +static void ctl_be_block_unmap_file(struct ctl_be_block_lun *be_lun, + struct ctl_be_block_io *beio); static void ctl_be_block_flush_dev(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio); static void ctl_be_block_unmap_dev(struct ctl_be_block_lun *be_lun, @@ -854,6 +860,84 @@ ctl_be_block_getattr_file(struct ctl_be_block_lun *be_lun, const char *attrname) return (val); } +static void +ctl_be_block_unmap_file(struct ctl_be_block_lun *be_lun, + struct ctl_be_block_io *beio) +{ + struct ctl_be_block_filedata *file_data; + union ctl_io *io; + struct ctl_ptr_len_flags *ptrlen; + struct scsi_unmap_desc *buf, *end; + struct mount *mp; + off_t off, len; + int error; + + io = beio->io; + file_data = &be_lun->backend.file; + mp = NULL; + error = 0; + + binuptime(&beio->ds_t0); + devstat_start_transaction(be_lun->disk_stats, &beio->ds_t0); + + (void)vn_start_write(be_lun->vn, &mp, V_WAIT); + vn_lock(be_lun->vn, vn_lktype_write(mp, be_lun->vn) | LK_RETRY); + if (beio->io_offset == -1) { + beio->io_len = 0; + ptrlen = (struct ctl_ptr_len_flags *) + &io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; + buf = (struct scsi_unmap_desc *)ptrlen->ptr; + end = buf + ptrlen->len / sizeof(*buf); + for (; buf < end; buf++) { + off = (off_t)scsi_8btou64(buf->lba) * + be_lun->cbe_lun.blocksize; + len = (off_t)scsi_4btoul(buf->length) * + be_lun->cbe_lun.blocksize; + beio->io_len += len; + error = vn_deallocate(be_lun->vn, &off, &len, + 0, IO_NOMACCHECK | IO_NODELOCKED, file_data->cred, + NOCRED); + if (error != 0) + break; + } + } else { + /* WRITE_SAME */ + off = beio->io_offset; + len = beio->io_len; + error = vn_deallocate(be_lun->vn, &off, &len, 0, + IO_NOMACCHECK | IO_NODELOCKED, file_data->cred, NOCRED); + } + VOP_UNLOCK(be_lun->vn); + vn_finished_write(mp); + + mtx_lock(&be_lun->io_lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + + /* + * If we got an error, set the sense data to "MEDIUM ERROR" and + * return the I/O to the user. + */ + switch (error) { + case 0: + ctl_set_success(&io->scsiio); + break; + case ENOSPC: + case EDQUOT: + ctl_set_space_alloc_fail(&io->scsiio); + break; + case EROFS: + case EACCES: + ctl_set_hw_write_protected(&io->scsiio); + break; + default: + ctl_set_medium_error(&io->scsiio, false); + } + ctl_complete_beio(beio); +} + static void ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) @@ -1804,6 +1888,7 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) struct vattr vattr; off_t ps, pss, po, pos, us, uss, uo, uos; int error; + long pconf; cbe_lun = &be_lun->cbe_lun; file_data = &be_lun->backend.file; @@ -1814,7 +1899,7 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) be_lun->lun_flush = ctl_be_block_flush_file; be_lun->get_lba_status = ctl_be_block_gls_file; be_lun->getattr = ctl_be_block_getattr_file; - be_lun->unmap = NULL; + be_lun->unmap = ctl_be_block_unmap_file; cbe_lun->flags &= ~CTL_LUN_FLAG_UNMAP; error = VOP_GETATTR(be_lun->vn, &vattr, curthread->td_ucred); @@ -1825,6 +1910,16 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) return (error); } + error = VOP_PATHCONF(be_lun->vn, _PC_DEALLOC_PRESENT, &pconf); + if (error != 0) { + snprintf(req->error_str, sizeof(req->error_str), + "error calling VOP_PATHCONF() for file %s", + be_lun->dev_path); + return (error); + } + if (pconf == 1) + cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; + file_data->cred = crhold(curthread->td_ucred); if (params->lun_size_bytes != 0) be_lun->size_bytes = params->lun_size_bytes; From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:40:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D8B6670C5C; Tue, 14 Sep 2021 20:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8FbH0x4qz3GTF; Tue, 14 Sep 2021 20:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00613211B3; Tue, 14 Sep 2021 20:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKeAt0034264; Tue, 14 Sep 2021 20:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKeAF1034262; Tue, 14 Sep 2021 20:40:10 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:40:10 GMT Message-Id: <202109142040.18EKeAF1034262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 6f43f86bf36d - main - tzcode: Fix operation without WITH_DETECT_TZ_CHANGES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f43f86bf36dba158355593bab5f81a7f8e2773c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:40:11 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=6f43f86bf36dba158355593bab5f81a7f8e2773c commit 6f43f86bf36dba158355593bab5f81a7f8e2773c Author: Edward Tomasz Napierala AuthorDate: 2021-09-14 20:17:45 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-14 20:17:50 +0000 tzcode: Fix operation without WITH_DETECT_TZ_CHANGES Reviewed By: bdrewery, kevans, cy Reported By: lwhsu, bdrewery Fixes: ddedf2a11eb Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31961 --- contrib/tzcode/stdtime/localtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/tzcode/stdtime/localtime.c b/contrib/tzcode/stdtime/localtime.c index 926b24470e19..9de1b26d74a0 100644 --- a/contrib/tzcode/stdtime/localtime.c +++ b/contrib/tzcode/stdtime/localtime.c @@ -390,7 +390,7 @@ change_in_tz(const char *name) return 0; } #else /* !DETECT_TZ_CHANGES */ -#define change_in_tz(X) 0 +#define change_in_tz(X) 1 #endif /* !DETECT_TZ_CHANGES */ static int From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:41:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A202670C71; Tue, 14 Sep 2021 20:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8FcL28Z6z3GV6; Tue, 14 Sep 2021 20:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29CEF214AD; Tue, 14 Sep 2021 20:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKf6Hk040963; Tue, 14 Sep 2021 20:41:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKf6RU040962; Tue, 14 Sep 2021 20:41:06 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:41:06 GMT Message-Id: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:41:06 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 Author: Edward Tomasz Napierala AuthorDate: 2021-09-12 11:31:10 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-14 20:19:55 +0000 linux: implement PTRACE_GET_SYSCALL_INFO This is one of the pieces required to make modern (ie Focal) strace(1) work. Reviewed By: jhb (earlier version) Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D28212 --- lib/libsysdecode/mktables | 2 +- sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- sys/compat/freebsd32/freebsd32_misc.c | 3 ++ sys/kern/sys_process.c | 17 ++++++ sys/sys/ptrace.h | 4 ++ 5 files changed, 120 insertions(+), 4 deletions(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 3d152a3a2646..1c263fd3b0b2 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -116,7 +116,7 @@ gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/ gen_table "pathconfname" "_PC_[A-Z4_]+[[:space:]]+[0-9]+" "sys/unistd.h" gen_table "prio" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" gen_table "procctlcmd" "PROC_[A-Z_]+[[:space:]]+[0-9]" "sys/procctl.h" "PROC_TRACE_CTL_" -gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" +gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" "PT_GET_SC_ARGS_ALL" gen_table "quotactlcmds" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h" gen_table "rebootopt" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h" gen_table "rforkflags" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h" diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 3afaded3a203..70e52c528c72 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -93,6 +93,12 @@ __FBSDID("$FreeBSD$"); LINUX_PTRACE_O_TRACESECCOMP | LINUX_PTRACE_O_EXITKILL | \ LINUX_PTRACE_O_SUSPEND_SECCOMP) +#define LINUX_PTRACE_SYSCALL_INFO_NONE 0 +#define LINUX_PTRACE_SYSCALL_INFO_ENTRY 1 +#define LINUX_PTRACE_SYSCALL_INFO_EXIT 2 + +#define LINUX_ARCH_AMD64 0xc000003e + static int map_signum(int lsig, int *bsigp) { @@ -172,6 +178,28 @@ struct linux_pt_reg { l_ulong ss; }; +struct syscall_info { + uint8_t op; + uint32_t arch; + uint64_t instruction_pointer; + uint64_t stack_pointer; + union { + struct { + uint64_t nr; + uint64_t args[6]; + } entry; + struct { + int64_t rval; + uint8_t is_error; + } exit; + struct { + uint64_t nr; + uint64_t args[6]; + uint32_t ret_data; + } seccomp; + }; +}; + /* * Translate amd64 ptrace registers between Linux and FreeBSD formats. * The translation is pretty straighforward, for all registers but @@ -495,11 +523,75 @@ linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) } static int -linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) +linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, + l_ulong addr, l_ulong data) { + struct ptrace_lwpinfo lwpinfo; + struct ptrace_sc_ret sr; + struct reg b_reg; + struct syscall_info si; + int error; - linux_msg(td, "PTRACE_GET_SYSCALL_INFO not implemented; returning EINVAL"); - return (EINVAL); + error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); + if (error != 0) { + linux_msg(td, "PT_LWPINFO failed with error %d", error); + return (error); + } + + memset(&si, 0, sizeof(si)); + + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + si.op = LINUX_PTRACE_SYSCALL_INFO_ENTRY; + si.entry.nr = lwpinfo.pl_syscall_code; + /* + * The reason for using PT_GET_SC_ARGS_ALL instead + * of PT_GET_SC_ARGS is to emulate Linux bug which strace(1) + * depends on: at initialization it tests whether ptrace works + * by calling close(2), or some other single-argument syscall, + * _with six arguments_, and then verifies whether it can + * fetch them all using this API; otherwise it bails out. + */ + error = kern_ptrace(td, PT_GET_SC_ARGS_ALL, pid, + &si.entry.args, sizeof(si.entry.args)); + if (error != 0) { + linux_msg(td, "PT_GET_SC_ARGS_ALL failed with error %d", + error); + return (error); + } + } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { + si.op = LINUX_PTRACE_SYSCALL_INFO_EXIT; + error = kern_ptrace(td, PT_GET_SC_RET, pid, &sr, sizeof(sr)); + + if (error != 0) { + linux_msg(td, "PT_GET_SC_RET failed with error %d", + error); + return (error); + } + + if (sr.sr_error == 0) { + si.exit.rval = sr.sr_retval[0]; + si.exit.is_error = 0; + } else { + si.exit.rval = bsd_to_linux_errno(sr.sr_error); + si.exit.is_error = 1; + } + } else { + si.op = LINUX_PTRACE_SYSCALL_INFO_NONE; + } + + error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); + if (error != 0) + return (error); + + si.arch = LINUX_ARCH_AMD64; + si.instruction_pointer = b_reg.r_rip; + si.stack_pointer = b_reg.r_rsp; + + error = copyout(&si, (void *)data, sizeof(si)); + if (error == 0) + td->td_retval[0] = sizeof(si); + + return (error); } int diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index c417a64d286a..01d772b35ee8 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1032,6 +1032,9 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) r.pc.pc_limit = PAIR32TO64(off_t, r32.pc.pc_limit); data = sizeof(r.pc); break; + case PT_GET_SC_ARGS_ALL: + error = EINVAL; + break; default: addr = uap->addr; break; diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 1b97424c58ca..e2d8042744d0 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -527,6 +527,9 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) else error = copyin(uap->addr, &r.pc, uap->data); break; + case PT_GET_SC_ARGS_ALL: + error = EINVAL; + break; default: addr = uap->addr; break; @@ -708,6 +711,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_SET_EVENT_MASK: case PT_DETACH: case PT_GET_SC_ARGS: + case PT_GET_SC_ARGS_ALL: sx_xlock(&proctree_lock); proctree_locked = true; break; @@ -1011,6 +1015,19 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) sizeof(register_t)); break; + case PT_GET_SC_ARGS_ALL: + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 +#ifdef COMPAT_FREEBSD32 + || (wrap32 && !safe) +#endif + ) { + error = EINVAL; + break; + } + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); + break; + case PT_GET_SC_RET: if ((td2->td_dbgflags & (TDB_SCX)) == 0 #ifdef COMPAT_FREEBSD32 diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 1e7c1c71056b..066a54f721c8 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -86,6 +86,10 @@ #define PT_VM_TIMESTAMP 40 /* Get VM version (timestamp) */ #define PT_VM_ENTRY 41 /* Get VM map (entry) */ +#ifdef _KERNEL +#define PT_GET_SC_ARGS_ALL 42 /* Used by linux(4) */ +#endif + #define PT_FIRSTMACH 64 /* for machine-specific requests */ #include /* machine-specific requests, if any */ From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:46:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68C1D671106; Tue, 14 Sep 2021 20:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Fkn2CGrz3JHK; Tue, 14 Sep 2021 20:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BB6721699; Tue, 14 Sep 2021 20:46:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKkfM0043872; Tue, 14 Sep 2021 20:46:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKkfEN043871; Tue, 14 Sep 2021 20:46:41 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:46:41 GMT Message-Id: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:46:41 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e Author: John Baldwin AuthorDate: 2021-09-14 20:46:14 +0000 Commit: John Baldwin CommitDate: 2021-09-14 20:46:14 +0000 cxgbe tom: Don't queue AIO requests on listen sockets. This is similar to the fixes in 141fe2dceeae. One difference is that TOE sockets do not change states (listen vs non-listen) once created, so no lock is needed for SOLISTENING(). Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_tom.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index a444f0c9d690..41f55fdbd426 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1989,6 +1989,13 @@ t4_aio_queue_tom(struct socket *so, struct kaiocb *job) struct toepcb *toep = tp->t_toe; int error; + /* + * No lock is needed as TOE sockets never change between + * active and passive. + */ + if (SOLISTENING(so)) + return (EINVAL); + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { error = t4_aio_queue_ddp(so, job); if (error != EOPNOTSUPP) From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:46:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CD53671085; Tue, 14 Sep 2021 20:46:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Fkp34Qvz3JFD; Tue, 14 Sep 2021 20:46:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A791214D9; Tue, 14 Sep 2021 20:46:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKkgsQ043896; Tue, 14 Sep 2021 20:46:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKkgFI043895; Tue, 14 Sep 2021 20:46:42 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:46:42 GMT Message-Id: <202109142046.18EKkgFI043895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5dbf8c1588da - main - cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dbf8c1588da167c17c45bdf78de51fcb4929504 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:46:42 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5dbf8c1588da167c17c45bdf78de51fcb4929504 commit 5dbf8c1588da167c17c45bdf78de51fcb4929504 Author: John Baldwin AuthorDate: 2021-09-14 20:46:14 +0000 Commit: John Baldwin CommitDate: 2021-09-14 20:46:14 +0000 cxgbe tom: Update rcv_nxt for a FIN after handle_ddp_close(). For TCP DDP, handle_ddp_close() needs to see the pre-FIN rcv_nxt to determine how much data was placed in the local buffer before the FIN was received. The changes in d59f1c49e26b broke this by updating rcv_nxt before calling handle_ddp_close(). Fixes: d59f1c49e26b cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_cpl_io.c | 20 ++++++++++---------- sys/dev/cxgbe/tom/t4_ddp.c | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index ca04cb88b10f..4c558df3f258 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1374,6 +1374,16 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) if (toep->flags & TPF_ABORT_SHUTDOWN) goto done; + so = inp->inp_socket; + socantrcvmore(so); + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { + DDP_LOCK(toep); + if (__predict_false(toep->ddp.flags & + (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) + handle_ddp_close(toep, tp, cpl->rcv_nxt); + DDP_UNLOCK(toep); + } + if (ulp_mode(toep) == ULP_MODE_RDMA || (ulp_mode(toep) == ULP_MODE_ISCSI && chip_id(sc) >= CHELSIO_T6)) { /* @@ -1390,16 +1400,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tp->rcv_nxt = be32toh(cpl->rcv_nxt); - so = inp->inp_socket; - socantrcvmore(so); - if (ulp_mode(toep) == ULP_MODE_TCPDDP) { - DDP_LOCK(toep); - if (__predict_false(toep->ddp.flags & - (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) - handle_ddp_close(toep, tp, cpl->rcv_nxt); - DDP_UNLOCK(toep); - } - switch (tp->t_state) { case TCPS_SYN_RECEIVED: tp->t_starttime = ticks; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 2b58cb60d4fd..be142ffb9e4f 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -700,7 +700,8 @@ handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, __be32 rcv_nxt) INP_WLOCK_ASSERT(toep->inp); DDP_ASSERT_LOCKED(toep); - len = be32toh(rcv_nxt) - tp->rcv_nxt; + /* - 1 is to ignore the byte for FIN */ + len = be32toh(rcv_nxt) - tp->rcv_nxt - 1; tp->rcv_nxt += len; while (toep->ddp.active_count > 0) { From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:46:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7750670E5B; Tue, 14 Sep 2021 20:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Fkq5yCJz3J8c; Tue, 14 Sep 2021 20:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CD4121627; Tue, 14 Sep 2021 20:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKkhvD043924; Tue, 14 Sep 2021 20:46:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKkhh4043923; Tue, 14 Sep 2021 20:46:43 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:46:43 GMT Message-Id: <202109142046.18EKkhh4043923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9affbb0f5271 - main - cxgbe tom: Enter network epoch in t4_aiotx_task(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9affbb0f5271b199de8a2203fd7d8b1fbedca2af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:46:44 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9affbb0f5271b199de8a2203fd7d8b1fbedca2af commit 9affbb0f5271b199de8a2203fd7d8b1fbedca2af Author: John Baldwin AuthorDate: 2021-09-14 20:46:15 +0000 Commit: John Baldwin CommitDate: 2021-09-14 20:46:15 +0000 cxgbe tom: Enter network epoch in t4_aiotx_task(). While here, don't restore the old vnet until after sorele(). Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_cpl_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 4c558df3f258..686819065863 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -2353,9 +2353,11 @@ t4_aiotx_task(void *context, int pending) struct toepcb *toep = context; struct socket *so; struct kaiocb *job; + struct epoch_tracker et; so = toep->aiotx_so; CURVNET_SET(toep->vnet); + NET_EPOCH_ENTER(et); SOCKBUF_LOCK(&so->so_snd); while (!TAILQ_EMPTY(&toep->aiotx_jobq) && sowriteable(so)) { job = TAILQ_FIRST(&toep->aiotx_jobq); @@ -2367,11 +2369,12 @@ t4_aiotx_task(void *context, int pending) } toep->aiotx_so = NULL; SOCKBUF_UNLOCK(&so->so_snd); - CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); free_toepcb(toep); SOCK_LOCK(so); sorele(so); + CURVNET_RESTORE(); } static void From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:51:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9437E67132E; Tue, 14 Sep 2021 20:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Fqt3lT0z3JZK; Tue, 14 Sep 2021 20:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 609EB215CA; Tue, 14 Sep 2021 20:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18EKp6n9052572; Tue, 14 Sep 2021 20:51:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18EKp64w052571; Tue, 14 Sep 2021 20:51:06 GMT (envelope-from git) Date: Tue, 14 Sep 2021 20:51:06 GMT Message-Id: <202109142051.18EKp64w052571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 5dc5f849be90 - main - tools/test/upsdl: fix compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dc5f849be9047309d32c4df8e7ee617c27ec43f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:51:06 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=5dc5f849be9047309d32c4df8e7ee617c27ec43f commit 5dc5f849be9047309d32c4df8e7ee617c27ec43f Author: Alan Somers AuthorDate: 2021-09-14 20:50:01 +0000 Commit: Alan Somers CommitDate: 2021-09-14 20:50:01 +0000 tools/test/upsdl: fix compiler warnings MFC after: 2 weeks Sponsored by: Axcient --- tools/test/upsdl/upsdl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/test/upsdl/upsdl.c b/tools/test/upsdl/upsdl.c index fc4a761e450b..960b034ffcfe 100644 --- a/tools/test/upsdl/upsdl.c +++ b/tools/test/upsdl/upsdl.c @@ -32,20 +32,21 @@ #include #include #include +#include #include -int prepareFile(char* filename,int* fdp); +int prepareFile(const char* filename,int* fdp); int mapBuffer(char** bufferp,int fd1,int fd2); int startIO(int fd,char *buffer); -int pagesize; +static int pagesize; #define FILESIZE (32*1024) -char wbuffer[FILESIZE]; +static char wbuffer[FILESIZE]; /* Create a FILESIZE sized file - then remove file data from the cache*/ -int prepareFile(char* filename,int* fdp) +int prepareFile(const char* filename,int* fdp) { int fd; int len; @@ -134,7 +135,7 @@ int startIO(int fd,char *buffer) } -int main(int argc,char *argv[],char *envp[]) +int main(int argc __unused, char *argv[] __unused) { int fdA,fdB,fdDelayA,fdDelayB; From owner-dev-commits-src-main@freebsd.org Tue Sep 14 20:53:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA40C671172; Tue, 14 Sep 2021 20:53:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Ftd4qjGz3L8R; Tue, 14 Sep 2021 20:53:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f176.google.com with SMTP id bd1so1063167oib.5; Tue, 14 Sep 2021 13:53:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=su3faFPazvSp0p9xlGtdC9I1yunW3UbVWIb0oP1yTLI=; b=OPITaAtedDLFhM1elpOBClEXe39nBAYSysgLTVtOCKWJfMhBdJyyqRNAwLnwcUaog0 p1jAO4t+VPHnwefzK26g+8KY4gzzVVcFaHACEe38PU94QD0ZDro+/9CcB4eMN2yOe13E YajnGxVPLFNKm14nJ7b5ddUNO8ZdF3ld3WidNURoE1vHIVY32kCWQnEGGkzX3in0LUT5 LZquChc1K/sgZdwmJ61tnxsslEBUA8X5CHYy5q0phFUIfuEL9xApHJnWaHETnebBBb6V 3u0QMCG/2XUNWv8LBGcVl4uQzJpJ/c06lPsuNLFAzbBSTPYr4Uk0N1zHve3E0Gm/K7qk gSSw== X-Gm-Message-State: AOAM533IJjbscJ30VdFxvb47yIHwzP4REfdSzrbJEKj1hffgEJQfrU4f psz4S9ODcHuDzM9N3aGPNkxd086srSIhmujVLfmC0a6E X-Google-Smtp-Source: ABdhPJxiNWqbu2vPJGuOMonF3aK0FnKDnYKclQqQP1ZGS40JShM66ar9h0GQEHBG4JdermGu/yo6ZfP5+8q7PaGbxZY= X-Received: by 2002:a54:4e94:: with SMTP id c20mr2902901oiy.57.1631652803303; Tue, 14 Sep 2021 13:53:23 -0700 (PDT) MIME-Version: 1.0 References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> In-Reply-To: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> From: Alan Somers Date: Tue, 14 Sep 2021 14:53:11 -0600 Message-ID: Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: John Baldwin Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4H8Ftd4qjGz3L8R X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 20:53:29 -0000 On Tue, Sep 14, 2021 at 2:46 PM John Baldwin wrote: > The branch main has been updated by jhb: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > > commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > Author: John Baldwin > AuthorDate: 2021-09-14 20:46:14 +0000 > Commit: John Baldwin > CommitDate: 2021-09-14 20:46:14 +0000 > > cxgbe tom: Don't queue AIO requests on listen sockets. > > This is similar to the fixes in 141fe2dceeae. One difference is that > TOE sockets do not change states (listen vs non-listen) once created, > so no lock is needed for SOLISTENING(). > > Sponsored by: Chelsio Communications > I've always wondered: what's the point to using AIO with sockets? Can't everything socket-related be done better with non-blocking read/write and kqueue? From owner-dev-commits-src-main@freebsd.org Tue Sep 14 21:40:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CE616719BE; Tue, 14 Sep 2021 21:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Gx234D5z3n7M; Tue, 14 Sep 2021 21:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AC9721FB2; Tue, 14 Sep 2021 21:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ELecfT019277; Tue, 14 Sep 2021 21:40:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ELectS019276; Tue, 14 Sep 2021 21:40:38 GMT (envelope-from git) Date: Tue, 14 Sep 2021 21:40:38 GMT Message-Id: <202109142140.18ELectS019276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 02d8194012a9 - main - mps/mpr(4): Move xpt_register_async() out of lock. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02d8194012a9a0e367a92c7f89567b808bf0e9a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 21:40:38 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=02d8194012a9a0e367a92c7f89567b808bf0e9a8 commit 02d8194012a9a0e367a92c7f89567b808bf0e9a8 Author: Alexander Motin AuthorDate: 2021-09-14 21:37:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-14 21:40:32 +0000 mps/mpr(4): Move xpt_register_async() out of lock. It fixes lock ordere reversal between SIM and device locks. Also remove registration for AC_FOUND_DEVICE, unused for a while now. MFC after: 1 month --- sys/dev/mpr/mpr_sas.c | 21 +++++++++++---------- sys/dev/mps/mps_sas.c | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index a8bb7c90b5c4..9b69e0654ae4 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -821,6 +821,8 @@ mpr_attach_sas(struct mpr_softc *sc) callout_init(&sassc->discovery_callout, 1 /*mpsafe*/); + mpr_unlock(sc); + /* * Register for async events so we can determine the EEDP * capabilities of devices. @@ -835,7 +837,7 @@ mpr_attach_sas(struct mpr_softc *sc) } else { int event; - event = AC_ADVINFO_CHANGED | AC_FOUND_DEVICE; + event = AC_ADVINFO_CHANGED; status = xpt_register_async(event, mprsas_async, sc, sassc->path); @@ -855,8 +857,6 @@ mpr_attach_sas(struct mpr_softc *sc) mpr_printf(sc, "EEDP capabilities disabled.\n"); } - mpr_unlock(sc); - mprsas_register_events(sc); out: if (error) @@ -890,12 +890,6 @@ mpr_detach_sas(struct mpr_softc *sc) if (sassc->ev_tq != NULL) taskqueue_free(sassc->ev_tq); - /* Make sure CAM doesn't wedge if we had to bail out early. */ - mpr_lock(sc); - - while (sassc->startup_refcount != 0) - mprsas_startup_decrement(sassc); - /* Deregister our async handler */ if (sassc->path != NULL) { xpt_register_async(0, mprsas_async, sc, sassc->path); @@ -903,6 +897,12 @@ mpr_detach_sas(struct mpr_softc *sc) sassc->path = NULL; } + /* Make sure CAM doesn't wedge if we had to bail out early. */ + mpr_lock(sc); + + while (sassc->startup_refcount != 0) + mprsas_startup_decrement(sassc); + if (sassc->flags & MPRSAS_IN_STARTUP) xpt_release_simq(sassc->sim, 1); @@ -3326,6 +3326,7 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, sc = (struct mpr_softc *)callback_arg; + mpr_lock(sc); switch (code) { case AC_ADVINFO_CHANGED: { struct mprsas_target *target; @@ -3413,10 +3414,10 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, } break; } - case AC_FOUND_DEVICE: default: break; } + mpr_unlock(sc); } /* diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c index 2413fa532d92..c86cf1850048 100644 --- a/sys/dev/mps/mps_sas.c +++ b/sys/dev/mps/mps_sas.c @@ -779,6 +779,8 @@ mps_attach_sas(struct mps_softc *sc) callout_init(&sassc->discovery_callout, 1 /*mpsafe*/); + mps_unlock(sc); + /* * Register for async events so we can determine the EEDP * capabilities of devices. @@ -812,8 +814,6 @@ mps_attach_sas(struct mps_softc *sc) mps_printf(sc, "EEDP capabilities disabled.\n"); } - mps_unlock(sc); - mpssas_register_events(sc); out: if (error) @@ -847,12 +847,6 @@ mps_detach_sas(struct mps_softc *sc) if (sassc->ev_tq != NULL) taskqueue_free(sassc->ev_tq); - /* Make sure CAM doesn't wedge if we had to bail out early. */ - mps_lock(sc); - - while (sassc->startup_refcount != 0) - mpssas_startup_decrement(sassc); - /* Deregister our async handler */ if (sassc->path != NULL) { xpt_register_async(0, mpssas_async, sc, sassc->path); @@ -860,6 +854,12 @@ mps_detach_sas(struct mps_softc *sc) sassc->path = NULL; } + /* Make sure CAM doesn't wedge if we had to bail out early. */ + mps_lock(sc); + + while (sassc->startup_refcount != 0) + mpssas_startup_decrement(sassc); + if (sassc->flags & MPSSAS_IN_STARTUP) xpt_release_simq(sassc->sim, 1); @@ -3150,6 +3150,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path, sc = (struct mps_softc *)callback_arg; + mps_lock(sc); switch (code) { case AC_ADVINFO_CHANGED: { struct mpssas_target *target; @@ -3241,6 +3242,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path, default: break; } + mps_unlock(sc); } /* From owner-dev-commits-src-main@freebsd.org Tue Sep 14 22:45:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D42A36727AF; Tue, 14 Sep 2021 22:45:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8JMm3CFBz4YDg; Tue, 14 Sep 2021 22:45:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18EMjG7I004715 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Sep 2021 01:45:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18EMjG7I004715 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18EMjGYo004712; Wed, 15 Sep 2021 01:45:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Sep 2021 01:45:16 +0300 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO Message-ID: References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4H8JMm3CFBz4YDg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 22:45:24 -0000 On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > > commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > Author: Edward Tomasz Napierala > AuthorDate: 2021-09-12 11:31:10 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-09-14 20:19:55 +0000 > > linux: implement PTRACE_GET_SYSCALL_INFO > > This is one of the pieces required to make modern (ie Focal) > strace(1) work. > > Reviewed By: jhb (earlier version) > Sponsored by: EPSRC > Differential Revision: https://reviews.freebsd.org/D28212 > --- > lib/libsysdecode/mktables | 2 +- > sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- > sys/compat/freebsd32/freebsd32_misc.c | 3 ++ > sys/kern/sys_process.c | 17 ++++++ > sys/sys/ptrace.h | 4 ++ > 5 files changed, 120 insertions(+), 4 deletions(-) > > + case PT_GET_SC_ARGS_ALL: > + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); > + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 > +#ifdef COMPAT_FREEBSD32 > + || (wrap32 && !safe) > +#endif > + ) { > + error = EINVAL; > + break; > + } > + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); > + break; This is awful, you already got that feedback in review, as I read it. I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks something in the implementation of PT_GET_SC_ARGS to select either full copy or just nargs args. Easiest thing for 'something' would be SV_PROC_ABI(p) == SV_ABI_LINUX. From owner-dev-commits-src-main@freebsd.org Tue Sep 14 22:52:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 519BE672C6A; Tue, 14 Sep 2021 22:52:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8JWr2rWjz4ZcM; Tue, 14 Sep 2021 22:52:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18EMqH1s006830 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Sep 2021 01:52:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18EMqH1s006830 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18EMqHwO006829; Wed, 15 Sep 2021 01:52:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Sep 2021 01:52:17 +0300 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO Message-ID: References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4H8JWr2rWjz4ZcM 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.22 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.983]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; TO_DN_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.24)[-0.241]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 22:52:25 -0000 On Wed, Sep 15, 2021 at 01:45:16AM +0300, Konstantin Belousov wrote: > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala wrote: > > The branch main has been updated by trasz: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > > > > commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > > Author: Edward Tomasz Napierala > > AuthorDate: 2021-09-12 11:31:10 +0000 > > Commit: Edward Tomasz Napierala > > CommitDate: 2021-09-14 20:19:55 +0000 > > > > linux: implement PTRACE_GET_SYSCALL_INFO > > > > This is one of the pieces required to make modern (ie Focal) > > strace(1) work. > > > > Reviewed By: jhb (earlier version) > > Sponsored by: EPSRC > > Differential Revision: https://reviews.freebsd.org/D28212 > > --- > > lib/libsysdecode/mktables | 2 +- > > sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- > > sys/compat/freebsd32/freebsd32_misc.c | 3 ++ > > sys/kern/sys_process.c | 17 ++++++ > > sys/sys/ptrace.h | 4 ++ > > 5 files changed, 120 insertions(+), 4 deletions(-) > > > > + case PT_GET_SC_ARGS_ALL: > > + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); > > + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 > > +#ifdef COMPAT_FREEBSD32 > > + || (wrap32 && !safe) > > +#endif > > + ) { > > + error = EINVAL; > > + break; > > + } > > + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); > > + break; > > This is awful, you already got that feedback in review, as I read it. > I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks something > in the implementation of PT_GET_SC_ARGS to select either full copy or just > nargs args. > > Easiest thing for 'something' would be SV_PROC_ABI(p) == SV_ABI_LINUX. It should be SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX. From owner-dev-commits-src-main@freebsd.org Tue Sep 14 22:54:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0877A672F03 for ; Tue, 14 Sep 2021 22:54:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8JZ06fNZz4bTL for ; Tue, 14 Sep 2021 22:54:16 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f54.google.com with SMTP id 140so770258wma.0 for ; Tue, 14 Sep 2021 15:54:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DsJU0Jxs0hBwsxAQsLEhhEi7QLH5HrgYZ0H5iQQXB7g=; b=BiF6orgqrYSKnR7XaXoVnxxIIM/ytkLSFAZ6LLKDp9jghgIh/xCcg1WkZAPQsJ4pzk vSS1acMDqqADWap431cNN8VttA0x0N7hHl8xaDqBS/rIOqMBZI6kOY+4qs3ocvz3TLw8 wNsyd8ae5HRIkLia3LAhPRhPJMhGNA54EMhSDoSrTaXVqD4sN3xLRtOV2Dz1ihD8p79+ 3X/rClh3ggaBDTkOrALlifOlV5SjBj/yl/8haas845nfhgn9n1inNix9w+SC3E6/SsrJ kgyDQz1gxJ8zp2NdHDrt6OBNRYZFiA1wOIR7CGF1rDpVir/d5r23tNC6NqyLccXwMMFa x2vw== X-Gm-Message-State: AOAM532sWlfKFTytFwFIh18tuPTJqkdXRSNSCmD0deyfymWJgdJuyDyt sjxECiPAxdPVzNldGqEZrlglAg== X-Google-Smtp-Source: ABdhPJwWxSPTMSIMHwYpg9mnK8zI7qwmRbjeLfuz6xz7v9z0ZwSYscvFCiNCgeQxOY2ChhXF8DU+vw== X-Received: by 2002:a7b:c351:: with SMTP id l17mr1344455wmj.120.1631660050144; Tue, 14 Sep 2021 15:54:10 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id z17sm6248693wrr.49.2021.09.14.15.54.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Sep 2021 15:54:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO From: Jessica Clarke In-Reply-To: Date: Tue, 14 Sep 2021 23:54:08 +0100 Cc: Edward Tomasz Napierala , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H8JZ06fNZz4bTL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 22:54:17 -0000 On 14 Sep 2021, at 23:45, Konstantin Belousov = wrote: >=20 > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala = wrote: >> The branch main has been updated by trasz: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dbdf0f24bb16d556a5b1e01cdfc087d08= e91ac572 >>=20 >> commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 >> Author: Edward Tomasz Napierala >> AuthorDate: 2021-09-12 11:31:10 +0000 >> Commit: Edward Tomasz Napierala >> CommitDate: 2021-09-14 20:19:55 +0000 >>=20 >> linux: implement PTRACE_GET_SYSCALL_INFO >>=20 >> This is one of the pieces required to make modern (ie Focal) >> strace(1) work. >>=20 >> Reviewed By: jhb (earlier version) >> Sponsored by: EPSRC >> Differential Revision: https://reviews.freebsd.org/D28212 >> --- >> lib/libsysdecode/mktables | 2 +- >> sys/amd64/linux/linux_ptrace.c | 98 = +++++++++++++++++++++++++++++++++-- >> sys/compat/freebsd32/freebsd32_misc.c | 3 ++ >> sys/kern/sys_process.c | 17 ++++++ >> sys/sys/ptrace.h | 4 ++ >> 5 files changed, 120 insertions(+), 4 deletions(-) >>=20 >> + case PT_GET_SC_ARGS_ALL: >> + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", = p->p_pid); >> + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) =3D=3D 0 >> +#ifdef COMPAT_FREEBSD32 >> + || (wrap32 && !safe) >> +#endif >> + ) { >> + error =3D EINVAL; >> + break; >> + } >> + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); >> + break; >=20 > This is awful, you already got that feedback in review, as I read it. > I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks = something > in the implementation of PT_GET_SC_ARGS to select either full copy or = just > nargs args. >=20 > Easiest thing for 'something' would be SV_PROC_ABI(p) =3D=3D = SV_ABI_LINUX. That is incorrect. The original review just changed PT_GET_SC_ARGS even for FreeBSD and that was what was described as horrible. John suggested two alternatives: this approach, and having the Linuxulator bypass kern_ptrace entirely by doing its own thing. Your option seems simpler but I don=E2=80=99t know if there=E2=80=99s a = good reason why that wasn=E2=80=99t suggested. Jess From owner-dev-commits-src-main@freebsd.org Tue Sep 14 23:16:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7086673244; Tue, 14 Sep 2021 23:16:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8K3C4cZzz4hBZ; Tue, 14 Sep 2021 23:16:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18ENFxNY012877 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Sep 2021 02:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18ENFxNY012877 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18ENFxOS012876; Wed, 15 Sep 2021 02:15:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Sep 2021 02:15:59 +0300 From: Konstantin Belousov To: Jessica Clarke Cc: Edward Tomasz Napierala , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO Message-ID: References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4H8K3C4cZzz4hBZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 23:16:08 -0000 On Tue, Sep 14, 2021 at 11:54:08PM +0100, Jessica Clarke wrote: > On 14 Sep 2021, at 23:45, Konstantin Belousov wrote: > > > > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala wrote: > >> The branch main has been updated by trasz: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > >> > >> commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > >> Author: Edward Tomasz Napierala > >> AuthorDate: 2021-09-12 11:31:10 +0000 > >> Commit: Edward Tomasz Napierala > >> CommitDate: 2021-09-14 20:19:55 +0000 > >> > >> linux: implement PTRACE_GET_SYSCALL_INFO > >> > >> This is one of the pieces required to make modern (ie Focal) > >> strace(1) work. > >> > >> Reviewed By: jhb (earlier version) > >> Sponsored by: EPSRC > >> Differential Revision: https://reviews.freebsd.org/D28212 > >> --- > >> lib/libsysdecode/mktables | 2 +- > >> sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- > >> sys/compat/freebsd32/freebsd32_misc.c | 3 ++ > >> sys/kern/sys_process.c | 17 ++++++ > >> sys/sys/ptrace.h | 4 ++ > >> 5 files changed, 120 insertions(+), 4 deletions(-) > >> > >> + case PT_GET_SC_ARGS_ALL: > >> + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); > >> + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 > >> +#ifdef COMPAT_FREEBSD32 > >> + || (wrap32 && !safe) > >> +#endif > >> + ) { > >> + error = EINVAL; > >> + break; > >> + } > >> + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); > >> + break; > > > > This is awful, you already got that feedback in review, as I read it. > > I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks something > > in the implementation of PT_GET_SC_ARGS to select either full copy or just > > nargs args. > > > > Easiest thing for 'something' would be SV_PROC_ABI(p) == SV_ABI_LINUX. > > That is incorrect. The original review just changed PT_GET_SC_ARGS even > for FreeBSD and that was what was described as horrible. John suggested > two alternatives: this approach, and having the Linuxulator bypass > kern_ptrace entirely by doing its own thing. My view is that - the whole thing with reading past nargs is horrible - having hidden API interface is horrible, it is obvious layering violation when you need to hide an API: the consumer calls at the wrong level. Another reason to dislike this is that we started to add new PT_ verbs at relatively high rate recently. I am aware of at least to more PT_ ops coming in. In other words, we are not too far from exhausting the MI range and then we would need to make some arrangements. Having one more PT_ value, esp. not useful for anything but for layering violation, is not good. From owner-dev-commits-src-main@freebsd.org Wed Sep 15 01:24:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35DD2674D87; Wed, 15 Sep 2021 01:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Mty0r6dz3F0p; Wed, 15 Sep 2021 01:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F17C624D41; Wed, 15 Sep 2021 01:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18F1O9KS014480; Wed, 15 Sep 2021 01:24:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18F1O9Lm014479; Wed, 15 Sep 2021 01:24:09 GMT (envelope-from git) Date: Wed, 15 Sep 2021 01:24:09 GMT Message-Id: <202109150124.18F1O9Lm014479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 6c2d4404161a - main - ipmi(4): Limit maximum watchdog pre-timeout interval. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 01:24:10 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6c2d4404161aa2bac1c7992afbf5a763f1a6f66e commit 6c2d4404161aa2bac1c7992afbf5a763f1a6f66e Author: Alexander Motin AuthorDate: 2021-09-15 01:06:39 +0000 Commit: Alexander Motin CommitDate: 2021-09-15 01:06:39 +0000 ipmi(4): Limit maximum watchdog pre-timeout interval. Previous code by default setting pre-timeout interval to 120 seconds made impossible to set timeout interval below that, resulting in error 0xcc (Invalid data field in Request) at least on Supermicro boards. To fix that limit maximum pre-timeout interval to ~1/4 of the timeout interval, that sounds like a reasonable default: not too short to fire too late, but also not too long to give many false reports. MFC after: 2 weeks --- sys/dev/ipmi/ipmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 77baf652b4bc..a8f3e7f1be10 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -668,7 +668,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP | IPMI_SET_WD_TIMER_SMS_OS; req->ir_request[1] = (wd_timer_actions & 0xff); - req->ir_request[2] = (wd_pretimeout_countdown & 0xff); + req->ir_request[2] = min(0xff, + min(wd_pretimeout_countdown, (sec + 2) / 4)); req->ir_request[3] = 0; /* Timer use */ req->ir_request[4] = (sec * 10) & 0xff; req->ir_request[5] = (sec * 10) >> 8; From owner-dev-commits-src-main@freebsd.org Wed Sep 15 08:18:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D8DF67AD8F; Wed, 15 Sep 2021 08:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8Y5V0mGpz4qP8; Wed, 15 Sep 2021 08:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF6931E7E; Wed, 15 Sep 2021 08:18:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18F8IrcR060255; Wed, 15 Sep 2021 08:18:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18F8IrXv060254; Wed, 15 Sep 2021 08:18:53 GMT (envelope-from git) Date: Wed, 15 Sep 2021 08:18:53 GMT Message-Id: <202109150818.18F8IrXv060254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 454216468583 - main - sctp: cleanup, no functional change intended MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 454216468583481746845a1c8a45a8c18898ee72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 08:18:54 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=454216468583481746845a1c8a45a8c18898ee72 commit 454216468583481746845a1c8a45a8c18898ee72 Author: Michael Tuexen AuthorDate: 2021-09-15 08:18:11 +0000 Commit: Michael Tuexen CommitDate: 2021-09-15 08:18:11 +0000 sctp: cleanup, no functional change intended MFC after: 1 week --- sys/netinet/sctp_asconf.c | 1 - sys/netinet/sctp_input.c | 5 ++--- sys/netinet/sctp_timer.c | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 0915e187ee40..2250d084ca06 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -2195,7 +2195,6 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb, return; else continue; - break; } if (type == SCTP_ADD_IP_ADDRESS) { diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 6c4bb529fbb8..e2cd2cf87ac9 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1975,7 +1975,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, union sctp_sockstore store; struct sctp_association *asoc; int init_offset, initack_offset, initack_limit; - int retval; int error = 0; uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; @@ -2088,9 +2087,9 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, return (NULL); } /* load all addresses */ - if ((retval = sctp_load_addresses_from_init(stcb, m, + if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), - initack_offset, src, dst, init_src, port)) < 0) { + initack_offset, src, dst, init_src, port) < 0) { (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_20); return (NULL); diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 4866356bdf5c..e657bc280ccc 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -330,7 +330,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } /* Look for an alternate net, which is active. */ if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { - alt = TAILQ_NEXT(net, sctp_next);; + alt = TAILQ_NEXT(net, sctp_next); } else { alt = TAILQ_FIRST(&stcb->asoc.nets); } @@ -369,7 +369,7 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, * an alternate net, which is confirmed. */ if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { - alt = TAILQ_NEXT(net, sctp_next);; + alt = TAILQ_NEXT(net, sctp_next); } else { alt = TAILQ_FIRST(&stcb->asoc.nets); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 09:22:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B41967B9D5; Wed, 15 Sep 2021 09:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8ZVJ2RgTz3Nm7; Wed, 15 Sep 2021 09:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 342503429; Wed, 15 Sep 2021 09:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18F9M0eD050302; Wed, 15 Sep 2021 09:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18F9M0Gk050301; Wed, 15 Sep 2021 09:22:00 GMT (envelope-from git) Date: Wed, 15 Sep 2021 09:22:00 GMT Message-Id: <202109150922.18F9M0Gk050301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 1896a0094317 - main - Use a 64 bit read to access GICR_TYPER MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1896a0094317c80d46beff5ad42b68215513c996 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 09:22:00 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1896a0094317c80d46beff5ad42b68215513c996 commit 1896a0094317c80d46beff5ad42b68215513c996 Author: Andrew Turner AuthorDate: 2021-09-15 09:13:41 +0000 Commit: Andrew Turner CommitDate: 2021-09-15 09:13:41 +0000 Use a 64 bit read to access GICR_TYPER The GICv3 ITS only needs to implement 32 bit access to the GICR_TYPER when the CPU implements AArch32. As this may not always be the case use a 64 bit read when checking if the ITS is enabled on the CPU. PR: 258217 Reported by: Olivier Delande Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/gicv3_its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index af587247626b..1a0e7a79e76b 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -710,7 +710,7 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) return (0); /* Check if the ITS is enabled on this CPU */ - if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) + if ((gic_r_read_8(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) return (ENXIO); rpcpu = gicv3_get_redist(dev); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 11:04:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C730A67CCED; Wed, 15 Sep 2021 11:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8cmg50DNz4ZTb; Wed, 15 Sep 2021 11:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 872714567; Wed, 15 Sep 2021 11:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FB4Zph086663; Wed, 15 Sep 2021 11:04:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FB4Zvg086662; Wed, 15 Sep 2021 11:04:35 GMT (envelope-from git) Date: Wed, 15 Sep 2021 11:04:35 GMT Message-Id: <202109151104.18FB4Zvg086662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pietro Cerutti Subject: git: 41ba691f9209 - main - tee: use queue(9) in place of a custom linked list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gahr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41ba691f9209c37cb245c8d2df0f312e8dc855bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 11:04:35 -0000 The branch main has been updated by gahr (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=41ba691f9209c37cb245c8d2df0f312e8dc855bd commit 41ba691f9209c37cb245c8d2df0f312e8dc855bd Author: Pietro Cerutti AuthorDate: 2021-09-15 11:04:24 +0000 Commit: Pietro Cerutti CommitDate: 2021-09-15 11:04:24 +0000 tee: use queue(9) in place of a custom linked list Approved by: cognet --- usr.bin/tee/tee.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.bin/tee/tee.c b/usr.bin/tee/tee.c index b55aa84d2f63..bc338e14bd66 100644 --- a/usr.bin/tee/tee.c +++ b/usr.bin/tee/tee.c @@ -44,6 +44,7 @@ static const char rcsid[] = #endif /* not lint */ #include +#include #include #include @@ -57,12 +58,12 @@ static const char rcsid[] = #include #include -typedef struct _list { - struct _list *next; +struct entry { int fd; const char *name; -} LIST; -static LIST *head; + STAILQ_ENTRY(entry) entries; +}; +static STAILQ_HEAD(, entry) head = STAILQ_HEAD_INITIALIZER(head); static void add(int, const char *); static void usage(void); @@ -70,7 +71,7 @@ static void usage(void); int main(int argc, char *argv[]) { - LIST *p; + struct entry *p; int n, fd, rval, wval; char *bp; int append, ch, exitval; @@ -112,7 +113,7 @@ main(int argc, char *argv[]) if (caph_enter() < 0) err(EXIT_FAILURE, "unable to enter capability mode"); while ((rval = read(STDIN_FILENO, buf, BSIZE)) > 0) - for (p = head; p; p = p->next) { + STAILQ_FOREACH(p, &head, entries) { n = rval; bp = buf; do { @@ -139,7 +140,7 @@ usage(void) static void add(int fd, const char *name) { - LIST *p; + struct entry *p; cap_rights_t rights; if (fd == STDOUT_FILENO) { @@ -151,10 +152,9 @@ add(int fd, const char *name) err(EXIT_FAILURE, "unable to limit rights"); } - if ((p = malloc(sizeof(LIST))) == NULL) + if ((p = malloc(sizeof(struct entry))) == NULL) err(1, "malloc"); p->fd = fd; p->name = name; - p->next = head; - head = p; + STAILQ_INSERT_HEAD(&head, p, entries); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 13:18:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5070067EE05; Wed, 15 Sep 2021 13:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8glb61Qsz3k0P; Wed, 15 Sep 2021 13:18:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A91A8689C; Wed, 15 Sep 2021 13:18:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FDIp8B059879; Wed, 15 Sep 2021 13:18:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FDIppM059878; Wed, 15 Sep 2021 13:18:51 GMT (envelope-from git) Date: Wed, 15 Sep 2021 13:18:51 GMT Message-Id: <202109151318.18FDIppM059878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 2de4c7f6d087 - main - pci_host_generic: Add Synopsys Designware PCIe controller quirk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2de4c7f6d08798fb6269582907155703d1ab5ef4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 13:18:52 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=2de4c7f6d08798fb6269582907155703d1ab5ef4 commit 2de4c7f6d08798fb6269582907155703d1ab5ef4 Author: Pawel Anikiel AuthorDate: 2021-09-13 14:59:40 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-15 13:17:40 +0000 pci_host_generic: Add Synopsys Designware PCIe controller quirk Due to the quirky nature of the Synopsys Designware PCIe IP, the type 0 configuration is broadcast and whatever device is plugged into slot, will appear at each 32 device positions of bus0. Mitigate the issue by filtering out duplicated devices on this bus for both DT and ACPI cases. Reviewed by: mw Sponsored by: Semihalf MFC: after 3 weeks Differential revision: https://reviews.freebsd.org/D31887 --- sys/dev/pci/pci_host_generic.c | 2 ++ sys/dev/pci/pci_host_generic.h | 4 ++++ sys/dev/pci/pci_host_generic_acpi.c | 33 +++++++++++++++++++++++++++++++++ sys/dev/pci/pci_host_generic_fdt.c | 7 +++++++ 4 files changed, 46 insertions(+) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 0c45f5d316ed..22b3ccdc17b1 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -185,6 +185,8 @@ generic_pcie_read_config(device_t dev, u_int bus, u_int slot, if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX)) return (~0U); + if ((sc->quirks & PCIE_ECAM_DESIGNWARE_QUIRK) && bus == 0 && slot > 0) + return (~0U); offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg); t = sc->bst; diff --git a/sys/dev/pci/pci_host_generic.h b/sys/dev/pci/pci_host_generic.h index 36a12b9559ba..20117cbe32e3 100644 --- a/sys/dev/pci/pci_host_generic.h +++ b/sys/dev/pci/pci_host_generic.h @@ -85,8 +85,12 @@ struct generic_pcie_core_softc { device_t dev; bus_space_handle_t ioh; bus_dma_tag_t dmat; + uint32_t quirks; }; +/* Quirks */ +#define PCIE_ECAM_DESIGNWARE_QUIRK (1 << 0) + DECLARE_CLASS(generic_pcie_core_driver); int pci_host_generic_core_attach(device_t); diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c index 763a84d2fd53..3c32abc5007a 100644 --- a/sys/dev/pci/pci_host_generic_acpi.c +++ b/sys/dev/pci/pci_host_generic_acpi.c @@ -89,6 +89,21 @@ __FBSDID("$FreeBSD$"); #define PROPS_CELL_SIZE 1 #define PCI_ADDR_CELL_SIZE 2 +static struct { + char oem_id[ACPI_OEM_ID_SIZE + 1]; + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; + uint32_t quirks; +} pci_acpi_quirks[] = { + { "MRVL ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MRVL ", "CN913X ", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MVEBU ", "ARMADA7K", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MVEBU ", "ARMADA8K", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MVEBU ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MVEBU ", "CN9131 ", PCIE_ECAM_DESIGNWARE_QUIRK }, + { "MVEBU ", "CN9132 ", PCIE_ECAM_DESIGNWARE_QUIRK }, + { 0 }, +}; + /* Forward prototypes */ static int generic_pcie_acpi_probe(device_t dev); @@ -170,6 +185,23 @@ pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) return (AE_OK); } +static void +pci_host_acpi_get_oem_quirks(struct generic_pcie_acpi_softc *sc, + ACPI_TABLE_HEADER *hdr) +{ + int i; + + for (i = 0; pci_acpi_quirks[i].quirks; i++) { + if (memcmp(hdr->OemId, pci_acpi_quirks[i].oem_id, + ACPI_OEM_ID_SIZE) != 0) + continue; + if (memcmp(hdr->OemTableId, pci_acpi_quirks[i].oem_table_id, + ACPI_OEM_TABLE_ID_SIZE) != 0) + continue; + sc->base.quirks |= pci_acpi_quirks[i].quirks; + } +} + static int pci_host_acpi_get_ecam_resource(device_t dev) { @@ -209,6 +241,7 @@ pci_host_acpi_get_ecam_resource(device_t dev) sc->base.bus_start, sc->base.bus_end); return (ENXIO); } + pci_host_acpi_get_oem_quirks(sc, hdr); } else { status = acpi_GetInteger(handle, "_CBA", &val); if (ACPI_SUCCESS(status)) diff --git a/sys/dev/pci/pci_host_generic_fdt.c b/sys/dev/pci/pci_host_generic_fdt.c index 91ffaf7357b9..249637019137 100644 --- a/sys/dev/pci/pci_host_generic_fdt.c +++ b/sys/dev/pci/pci_host_generic_fdt.c @@ -151,6 +151,13 @@ pci_host_generic_setup_fdt(device_t dev) if (error != 0) return (error); + if (ofw_bus_is_compatible(dev, "marvell,armada8k-pcie-ecam") || + ofw_bus_is_compatible(dev, "socionext,synquacer-pcie-ecam") || + ofw_bus_is_compatible(dev, "snps,dw-pcie-ecam")) { + device_set_desc(dev, "Synopsys DesignWare PCIe Controller"); + sc->base.quirks |= PCIE_ECAM_DESIGNWARE_QUIRK; + } + ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t)); return (0); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 13:21:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 350E467EE20 for ; Wed, 15 Sep 2021 13:21:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8gpD0cjXz3lPL for ; Wed, 15 Sep 2021 13:21:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f41.google.com with SMTP id q11so3853272wrr.9 for ; Wed, 15 Sep 2021 06:21:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tI08zHBmt3DSlD8uL1cSShXRCTjTmaiHhAu/CspMGv0=; b=I00Yh4/Hx3Z3aqq5sw9siJyu4UCM/JVrU6IJqUR4CiBPfnGl1LpFVTqTsz/bGdDGXQ sQqHaSdhpQKtg4lgHJdWdTgrAulRoG6xSED6J5Fk8xMWw4zddMyPb6zvR+7Yyt0YMyE0 DkfYK9IiLl9XglipNbEmdzbJvCqtGUFOJJEwQbC6kZWa2hjkHN694H7LF5gAqYLrnJWU NNKbTxziwufX6+rIHBNJ3YAswhiCDcdFle2m3Hu1a2SpbLSaYz9Mm+dBOkOAyQAEK0VD 4o67AidQBx2i69bDf372pCXTCAJtUarfNRh3wIfXUWCuzs8gA6ff6qEwTJvAbRQ9MnJa glYQ== X-Gm-Message-State: AOAM530KHCEuQvZr3Yd7PMno2D3d898jO9C/fM3x0sBCFUvyKzWPRdZb wInidQVyONw4iN820SkIwyPwjA== X-Google-Smtp-Source: ABdhPJwNqPRFdP1nIHMiGkWpAk2T1rU18DlX/18PrsdUmeJ1ktE4jV3hXLAAH5fZALVKeWtzntCsow== X-Received: by 2002:adf:f507:: with SMTP id q7mr5235096wro.7.1631712060928; Wed, 15 Sep 2021 06:21:00 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id j23sm15477wmo.14.2021.09.15.06.21.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Sep 2021 06:21:00 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 2de4c7f6d087 - main - pci_host_generic: Add Synopsys Designware PCIe controller quirk From: Jessica Clarke In-Reply-To: <202109151318.18FDIppM059878@gitrepo.freebsd.org> Date: Wed, 15 Sep 2021 14:20:59 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202109151318.18FDIppM059878@gitrepo.freebsd.org> To: Marcin Wojtas X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H8gpD0cjXz3lPL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 13:21:08 -0000 On 15 Sep 2021, at 14:18, Marcin Wojtas wrote: >=20 > The branch main has been updated by mw: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D2de4c7f6d08798fb6269582907155703= d1ab5ef4 >=20 > commit 2de4c7f6d08798fb6269582907155703d1ab5ef4 > Author: Pawel Anikiel > AuthorDate: 2021-09-13 14:59:40 +0000 > Commit: Marcin Wojtas > CommitDate: 2021-09-15 13:17:40 +0000 >=20 > pci_host_generic: Add Synopsys Designware PCIe controller quirk >=20 > Due to the quirky nature of the Synopsys Designware PCIe IP, > the type 0 configuration is broadcast and whatever device > is plugged into slot, will appear at each 32 device > positions of bus0. Mitigate the issue by filtering out > duplicated devices on this bus for both DT and ACPI cases. >=20 > Reviewed by: mw > Sponsored by: Semihalf > MFC: after 3 weeks > Differential revision: https://reviews.freebsd.org/D31887 > --- > sys/dev/pci/pci_host_generic.c | 2 ++ > sys/dev/pci/pci_host_generic.h | 4 ++++ > sys/dev/pci/pci_host_generic_acpi.c | 33 = +++++++++++++++++++++++++++++++++ > sys/dev/pci/pci_host_generic_fdt.c | 7 +++++++ > 4 files changed, 46 insertions(+) >=20 > diff --git a/sys/dev/pci/pci_host_generic.c = b/sys/dev/pci/pci_host_generic.c > index 0c45f5d316ed..22b3ccdc17b1 100644 > --- a/sys/dev/pci/pci_host_generic.c > +++ b/sys/dev/pci/pci_host_generic.c > @@ -185,6 +185,8 @@ generic_pcie_read_config(device_t dev, u_int bus, = u_int slot, > if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || > (reg > PCIE_REGMAX)) > return (~0U); > + if ((sc->quirks & PCIE_ECAM_DESIGNWARE_QUIRK) && bus =3D=3D 0 && = slot > 0) > + return (~0U); >=20 > offset =3D PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, = reg); > t =3D sc->bst; > diff --git a/sys/dev/pci/pci_host_generic.h = b/sys/dev/pci/pci_host_generic.h > index 36a12b9559ba..20117cbe32e3 100644 > --- a/sys/dev/pci/pci_host_generic.h > +++ b/sys/dev/pci/pci_host_generic.h > @@ -85,8 +85,12 @@ struct generic_pcie_core_softc { > device_t dev; > bus_space_handle_t ioh; > bus_dma_tag_t dmat; > + uint32_t quirks; > }; >=20 > +/* Quirks */ > +#define PCIE_ECAM_DESIGNWARE_QUIRK (1 << 0) > + > DECLARE_CLASS(generic_pcie_core_driver); >=20 > int pci_host_generic_core_attach(device_t); > diff --git a/sys/dev/pci/pci_host_generic_acpi.c = b/sys/dev/pci/pci_host_generic_acpi.c > index 763a84d2fd53..3c32abc5007a 100644 > --- a/sys/dev/pci/pci_host_generic_acpi.c > +++ b/sys/dev/pci/pci_host_generic_acpi.c > @@ -89,6 +89,21 @@ __FBSDID("$FreeBSD$"); > #define PROPS_CELL_SIZE 1 > #define PCI_ADDR_CELL_SIZE 2 >=20 > +static struct { > + char oem_id[ACPI_OEM_ID_SIZE + 1]; > + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; > + uint32_t quirks; > +} pci_acpi_quirks[] =3D { > + { "MRVL ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MRVL ", "CN913X ", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MVEBU ", "ARMADA7K", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MVEBU ", "ARMADA8K", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MVEBU ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MVEBU ", "CN9131 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { "MVEBU ", "CN9132 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > + { 0 }, > +}; > + > /* Forward prototypes */ >=20 > static int generic_pcie_acpi_probe(device_t dev); > @@ -170,6 +185,23 @@ = pci_host_generic_acpi_parse_resource(ACPI_RESOURCE *res, void *arg) > return (AE_OK); > } >=20 > +static void > +pci_host_acpi_get_oem_quirks(struct generic_pcie_acpi_softc *sc, > + ACPI_TABLE_HEADER *hdr) > +{ > + int i; > + > + for (i =3D 0; pci_acpi_quirks[i].quirks; i++) { > + if (memcmp(hdr->OemId, pci_acpi_quirks[i].oem_id, > + ACPI_OEM_ID_SIZE) !=3D 0) > + continue; > + if (memcmp(hdr->OemTableId, = pci_acpi_quirks[i].oem_table_id, > + ACPI_OEM_TABLE_ID_SIZE) !=3D 0) > + continue; > + sc->base.quirks |=3D pci_acpi_quirks[i].quirks; > + } > +} > + > static int > pci_host_acpi_get_ecam_resource(device_t dev) > { > @@ -209,6 +241,7 @@ pci_host_acpi_get_ecam_resource(device_t dev) > sc->base.bus_start, sc->base.bus_end); > return (ENXIO); > } > + pci_host_acpi_get_oem_quirks(sc, hdr); > } else { > status =3D acpi_GetInteger(handle, "_CBA", &val); > if (ACPI_SUCCESS(status)) > diff --git a/sys/dev/pci/pci_host_generic_fdt.c = b/sys/dev/pci/pci_host_generic_fdt.c > index 91ffaf7357b9..249637019137 100644 > --- a/sys/dev/pci/pci_host_generic_fdt.c > +++ b/sys/dev/pci/pci_host_generic_fdt.c > @@ -151,6 +151,13 @@ pci_host_generic_setup_fdt(device_t dev) > if (error !=3D 0) > return (error); >=20 > + if (ofw_bus_is_compatible(dev, "marvell,armada8k-pcie-ecam") || > + ofw_bus_is_compatible(dev, "socionext,synquacer-pcie-ecam") = || > + ofw_bus_is_compatible(dev, "snps,dw-pcie-ecam")) { > + device_set_desc(dev, "Synopsys DesignWare PCIe = Controller"); It seems inconsistent to set this for _fdt but not _acpi? Jess From owner-dev-commits-src-main@freebsd.org Wed Sep 15 13:30:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75D0167EDD0; Wed, 15 Sep 2021 13:30:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8h0q48wtz3n3J; Wed, 15 Sep 2021 13:30:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 18FDU5NE023847 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Sep 2021 16:30:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18FDU5NE023847 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18FDU5hT023846; Wed, 15 Sep 2021 16:30:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Sep 2021 16:30:05 +0300 From: Konstantin Belousov To: Jessica Clarke Cc: Edward Tomasz Napierala , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO Message-ID: References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4H8h0q48wtz3n3J 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.29 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_SHORT(-0.29)[-0.292]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 13:30:20 -0000 On Wed, Sep 15, 2021 at 02:15:59AM +0300, Konstantin Belousov wrote: > On Tue, Sep 14, 2021 at 11:54:08PM +0100, Jessica Clarke wrote: > > On 14 Sep 2021, at 23:45, Konstantin Belousov wrote: > > > > > > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala wrote: > > >> The branch main has been updated by trasz: > > >> > > >> URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > > >> > > >> commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > > >> Author: Edward Tomasz Napierala > > >> AuthorDate: 2021-09-12 11:31:10 +0000 > > >> Commit: Edward Tomasz Napierala > > >> CommitDate: 2021-09-14 20:19:55 +0000 > > >> > > >> linux: implement PTRACE_GET_SYSCALL_INFO > > >> > > >> This is one of the pieces required to make modern (ie Focal) > > >> strace(1) work. > > >> > > >> Reviewed By: jhb (earlier version) > > >> Sponsored by: EPSRC > > >> Differential Revision: https://reviews.freebsd.org/D28212 > > >> --- > > >> lib/libsysdecode/mktables | 2 +- > > >> sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- > > >> sys/compat/freebsd32/freebsd32_misc.c | 3 ++ > > >> sys/kern/sys_process.c | 17 ++++++ > > >> sys/sys/ptrace.h | 4 ++ > > >> 5 files changed, 120 insertions(+), 4 deletions(-) > > >> > > >> + case PT_GET_SC_ARGS_ALL: > > >> + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); > > >> + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 > > >> +#ifdef COMPAT_FREEBSD32 > > >> + || (wrap32 && !safe) > > >> +#endif > > >> + ) { > > >> + error = EINVAL; > > >> + break; > > >> + } > > >> + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); > > >> + break; > > > > > > This is awful, you already got that feedback in review, as I read it. > > > I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks something > > > in the implementation of PT_GET_SC_ARGS to select either full copy or just > > > nargs args. > > > > > > Easiest thing for 'something' would be SV_PROC_ABI(p) == SV_ABI_LINUX. > > > > That is incorrect. The original review just changed PT_GET_SC_ARGS even > > for FreeBSD and that was what was described as horrible. John suggested > > two alternatives: this approach, and having the Linuxulator bypass > > kern_ptrace entirely by doing its own thing. > My view is that > - the whole thing with reading past nargs is horrible > - having hidden API interface is horrible, it is obvious layering violation > when you need to hide an API: the consumer calls at the wrong level. > > Another reason to dislike this is that we started to add new PT_ verbs > at relatively high rate recently. I am aware of at least to more PT_ > ops coming in. In other words, we are not too far from exhausting the > MI range and then we would need to make some arrangements. Having one > more PT_ value, esp. not useful for anything but for layering violation, > is not good. https://reviews.freebsd.org/D31968 From owner-dev-commits-src-main@freebsd.org Wed Sep 15 14:33:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19C5467FBBC; Wed, 15 Sep 2021 14:33:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8jPK6hQhz4Z60; Wed, 15 Sep 2021 14:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6E667C02; Wed, 15 Sep 2021 14:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FEX9sn065180; Wed, 15 Sep 2021 14:33:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FEX9NF065179; Wed, 15 Sep 2021 14:33:09 GMT (envelope-from git) Date: Wed, 15 Sep 2021 14:33:09 GMT Message-Id: <202109151433.18FEX9NF065179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 6e8272f317b8 - main - mount: improve error message for invalid filesystem names MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e8272f317b899438165108a72fa04a4995611bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 14:33:10 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=6e8272f317b899438165108a72fa04a4995611bd commit 6e8272f317b899438165108a72fa04a4995611bd Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-14 20:06:08 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 14:25:31 +0000 mount: improve error message for invalid filesystem names For an invalid filesystem name used like this: mount -t asdfs /dev/ada1p5 /usr/obj emit an error message like this: mount: /dev/ada1p5: Invalid fstype: Invalid argument instead of: mount: /dev/ada1p5: Operation not supported by device Differential Revision: https://reviews.freebsd.org/D31540 --- sys/kern/vfs_mount.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 73fd8321c9da..55c62b7fe491 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -966,6 +966,12 @@ vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) } error = vfs_domount(td, fstype, fspath, fsflags, &optlist); + if (error == ENOENT) { + error = EINVAL; + if (errmsg != NULL) + strncpy(errmsg, "Invalid fstype", errmsg_len); + goto bail; + } /* * See if we can mount in the read-only mode if the error code suggests @@ -1525,12 +1531,13 @@ vfs_domount( vfsp = NULL; if ((fsflags & MNT_UPDATE) == 0) { /* Don't try to load KLDs if we're mounting the root. */ - if (fsflags & MNT_ROOTFS) - vfsp = vfs_byname(fstype); - else - vfsp = vfs_byname_kld(fstype, td, &error); - if (vfsp == NULL) - return (ENODEV); + if (fsflags & MNT_ROOTFS) { + if ((vfsp = vfs_byname(fstype)) == NULL) + return (ENODEV); + } else { + if ((vfsp = vfs_byname_kld(fstype, td, &error)) == NULL) + return (error); + } } /* From owner-dev-commits-src-main@freebsd.org Wed Sep 15 15:20:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69BBA66835C; Wed, 15 Sep 2021 15:20:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8kSW24ZGz4m71; Wed, 15 Sep 2021 15:20:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id A640B258BF; Wed, 15 Sep 2021 15:20:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: Alan Somers Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Wed, 15 Sep 2021 08:20:56 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 15:20:59 -0000 On 9/14/21 1:53 PM, Alan Somers wrote: > On Tue, Sep 14, 2021 at 2:46 PM John Baldwin wrote: > >> The branch main has been updated by jhb: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e >> >> commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e >> Author: John Baldwin >> AuthorDate: 2021-09-14 20:46:14 +0000 >> Commit: John Baldwin >> CommitDate: 2021-09-14 20:46:14 +0000 >> >> cxgbe tom: Don't queue AIO requests on listen sockets. >> >> This is similar to the fixes in 141fe2dceeae. One difference is that >> TOE sockets do not change states (listen vs non-listen) once created, >> so no lock is needed for SOLISTENING(). >> >> Sponsored by: Chelsio Communications >> > > I've always wondered: what's the point to using AIO with sockets? Can't > everything socket-related be done better with non-blocking read/write and > kqueue? Zero-copy operation with TOE is why TOE uses AIO. Zero-copy of user buffers can't really work with the non-AIO APIs because the user buffer is free to be reused immediately after write(2) (and on the read side you don't know the buffer in advance to allow the NIC to write directly into the use buffer). In theory we could support zero-copy using mb_ext_pgs for aio_write() for the non-TOE case similar to what sendfile() does. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Wed Sep 15 15:31:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8539F6686D9; Wed, 15 Sep 2021 15:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8khx3Kb5z4pxj; Wed, 15 Sep 2021 15:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5291610571; Wed, 15 Sep 2021 15:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FFVjJ5045223; Wed, 15 Sep 2021 15:31:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FFVj3k045222; Wed, 15 Sep 2021 15:31:45 GMT (envelope-from git) Date: Wed, 15 Sep 2021 15:31:45 GMT Message-Id: <202109151531.18FFVj3k045222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 53b70c86d93c - main - zfs: merge openzfs/zfs@4a1195ca5 (master) into main MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53b70c86d93c1e4d3c76f1282e94154e88780d7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 15:31:45 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=53b70c86d93c1e4d3c76f1282e94154e88780d7e commit 53b70c86d93c1e4d3c76f1282e94154e88780d7e Merge: 6e8272f317b8 4a1195ca5041 Author: Martin Matuska AuthorDate: 2021-09-15 15:30:07 +0000 Commit: Martin Matuska CommitDate: 2021-09-15 15:30:53 +0000 zfs: merge openzfs/zfs@4a1195ca5 (master) into main Notable upstream pull request merges: #11312 Temporarily use root credentials to mount snapshots in .zfs #12246 arc: Drop an incorrect assert #12443 Fixed data integrity issue when underlying disk returns error to zfs #12522 Compressed receive with different ashift can result in incorrect PSIZE on disk #12535 Verify embedded blkptr's in arc_read() #12541 Allow sending corrupt snapshots even if metadata is corrupted Obtained from: OpenZFS OpenZFS commit: 4a1195ca5041cbff2a6b025a31937fef84876c52 .../openzfs/.github/workflows/checkstyle.yaml | 6 +- sys/contrib/openzfs/Makefile.am | 14 +- sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c | 2 +- sys/contrib/openzfs/cmd/zdb/zdb.c | 13 +- sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c | 1 + sys/contrib/openzfs/cmd/zed/zed.c | 2 +- sys/contrib/openzfs/cmd/zed/zed_conf.c | 1 + sys/contrib/openzfs/cmd/zed/zed_exec.c | 2 + sys/contrib/openzfs/cmd/zfs/zfs_main.c | 1 + sys/contrib/openzfs/cmd/zpool/zpool.d/media | 9 +- .../openzfs/cmd/zpool_influxdb/zpool_influxdb.c | 2 +- sys/contrib/openzfs/config/Abigail.am | 2 + sys/contrib/openzfs/config/Rules.am | 1 + .../openzfs/config/always-compiler-options.m4 | 23 + sys/contrib/openzfs/config/kernel-acl.m4 | 23 +- sys/contrib/openzfs/config/kernel-blk-queue.m4 | 40 + sys/contrib/openzfs/config/kernel-stdarg.m4 | 32 + sys/contrib/openzfs/config/kernel.m4 | 2 + sys/contrib/openzfs/config/zfs-build.m4 | 1 + sys/contrib/openzfs/config/zfs-meta.m4 | 4 +- sys/contrib/openzfs/include/libzfs.h | 4 +- .../openzfs/include/os/freebsd/linux/compiler.h | 1 + .../include/os/linux/kernel/linux/blkdev_compat.h | 3 + .../os/linux/kernel/linux/compiler_compat.h | 8 + .../openzfs/include/os/linux/spl/sys/cmn_err.h | 4 + .../include/os/linux/zfs/sys/zfs_context_os.h | 1 + sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 4 + sys/contrib/openzfs/include/sys/fm/fs/zfs.h | 9 + sys/contrib/openzfs/include/sys/spa.h | 2 + sys/contrib/openzfs/include/sys/zfs_context.h | 1 - sys/contrib/openzfs/include/sys/zio.h | 2 + sys/contrib/openzfs/lib/libnvpair/libnvpair.abi | 5257 +++++++------- .../openzfs/lib/libspl/include/sys/feature_tests.h | 11 +- sys/contrib/openzfs/lib/libuutil/libuutil.abi | 2778 ++++--- sys/contrib/openzfs/lib/libzfs/libzfs.abi | 7642 ++++++++------------ sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c | 5 +- sys/contrib/openzfs/lib/libzfs/libzfs_mount.c | 4 + sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 4 +- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_util.c | 2 +- .../openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c | 12 + .../openzfs/lib/libzfs/os/linux/libzfs_mount_os.c | 12 + .../openzfs/lib/libzfs_core/libzfs_core.abi | 5040 ++++++------- .../openzfs/lib/libzfsbootenv/libzfsbootenv.abi | 361 +- .../openzfs/lib/libzfsbootenv/lzbe_device.c | 2 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 3 +- .../openzfs/module/icp/core/kcf_prov_tabs.c | 2 +- sys/contrib/openzfs/module/icp/io/aes.c | 2 +- sys/contrib/openzfs/module/lua/lcode.c | 4 + sys/contrib/openzfs/module/lua/lgc.c | 2 +- sys/contrib/openzfs/module/lua/llex.c | 2 +- sys/contrib/openzfs/module/lua/lstrlib.c | 2 +- sys/contrib/openzfs/module/lua/ltable.c | 2 +- .../openzfs/module/os/freebsd/spl/spl_vfs.c | 10 +- .../openzfs/module/os/freebsd/zfs/zfs_acl.c | 4 +- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 2 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_znode.c | 2 +- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 34 +- sys/contrib/openzfs/module/zfs/abd.c | 8 +- sys/contrib/openzfs/module/zfs/arc.c | 20 +- sys/contrib/openzfs/module/zfs/dmu_send.c | 2 + sys/contrib/openzfs/module/zfs/dsl_prop.c | 2 +- sys/contrib/openzfs/module/zfs/spa.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_label.c | 2 +- .../openzfs/module/zfs/vdev_raidz_math_scalar.c | 2 +- sys/contrib/openzfs/module/zfs/zfs_fm.c | 52 + sys/contrib/openzfs/module/zfs/zfs_replay.c | 8 +- sys/contrib/openzfs/module/zfs/zil.c | 34 +- sys/contrib/openzfs/module/zfs/zio.c | 14 +- sys/contrib/openzfs/module/zfs/zio_compress.c | 2 +- sys/contrib/openzfs/module/zfs/zvol.c | 64 + .../openzfs/tests/test-runner/bin/zts-report.py.in | 7 - .../openzfs/tests/zfs-tests/cmd/mkbusy/mkbusy.c | 2 +- .../cli_root/zfs_copies/zfs_copies.kshlib | 7 +- .../cli_root/zfs_rename/zfs_rename_006_pos.ksh | 2 +- .../cli_root/zpool_import/zpool_import_errata3.ksh | 4 +- .../zvol/zvol_misc/zvol_misc_volmode.ksh | 2 + sys/modules/zfs/zfs_config.h | 4 +- sys/modules/zfs/zfs_gitrev.h | 2 +- 80 files changed, 9815 insertions(+), 11854 deletions(-) diff --cc sys/contrib/openzfs/config/kernel-stdarg.m4 index 000000000000,5bc8dd859d6b..5bc8dd859d6b mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-stdarg.m4 +++ b/sys/contrib/openzfs/config/kernel-stdarg.m4 diff --cc sys/contrib/openzfs/lib/libspl/include/sys/feature_tests.h index 1a68b75f0cdc,000000000000..c9564b2c3269 mode 100644,000000..100644 --- a/sys/contrib/openzfs/lib/libspl/include/sys/feature_tests.h +++ b/sys/contrib/openzfs/lib/libspl/include/sys/feature_tests.h @@@ -1,32 -1,0 +1,41 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (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 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_FEATURE_TESTS_H +#define _SYS_FEATURE_TESTS_H + - #define __NORETURN __attribute__((__noreturn__)) ++#define ____cacheline_aligned ++#define __NORETURN __attribute__((__noreturn__)) ++ ++#if !defined(fallthrough) && !defined(_LIBCPP_VERSION) ++#if defined(HAVE_IMPLICIT_FALLTHROUGH) ++#define fallthrough __attribute__((__fallthrough__)) ++#else ++#define fallthrough ((void)0) ++#endif ++#endif + +#endif diff --cc sys/modules/zfs/zfs_config.h index ecc1e2940105,000000000000..82f6d415f966 mode 100644,000000..100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@@ -1,849 -1,0 +1,849 @@@ +/* + * $FreeBSD$ + */ + +/* zfs_config.h. Generated from zfs_config.h.in by configure. */ +/* zfs_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* bio_end_io_t wants 1 arg */ +/* #undef HAVE_1ARG_BIO_END_IO_T */ + +/* lookup_bdev() wants 1 arg */ +/* #undef HAVE_1ARG_LOOKUP_BDEV */ + +/* submit_bio() wants 1 arg */ +/* #undef HAVE_1ARG_SUBMIT_BIO */ + +/* bdi_setup_and_register() wants 2 args */ +/* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 2 args */ +/* #undef HAVE_2ARGS_VFS_GETATTR */ + +/* zlib_deflate_workspacesize() wants 2 args */ +/* #undef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */ + +/* bdi_setup_and_register() wants 3 args */ +/* #undef HAVE_3ARGS_BDI_SETUP_AND_REGISTER */ + +/* vfs_getattr wants 3 args */ +/* #undef HAVE_3ARGS_VFS_GETATTR */ + +/* vfs_getattr wants 4 args */ +/* #undef HAVE_4ARGS_VFS_GETATTR */ + +/* kernel has access_ok with 'type' parameter */ +/* #undef HAVE_ACCESS_OK_TYPE */ + +/* posix_acl has refcount_t */ +/* #undef HAVE_ACL_REFCOUNT */ + +/* Define if host toolchain supports AES */ +#define HAVE_AES 1 + +#ifdef __amd64__ +#ifndef RESCUE +/* Define if host toolchain supports AVX */ +#define HAVE_AVX 1 +#endif + +/* Define if host toolchain supports AVX2 */ +#define HAVE_AVX2 1 + +/* Define if host toolchain supports AVX512BW */ +#define HAVE_AVX512BW 1 + +/* Define if host toolchain supports AVX512CD */ +#define HAVE_AVX512CD 1 + +/* Define if host toolchain supports AVX512DQ */ +#define HAVE_AVX512DQ 1 + +/* Define if host toolchain supports AVX512ER */ +#define HAVE_AVX512ER 1 + +/* Define if host toolchain supports AVX512F */ +#define HAVE_AVX512F 1 + +/* Define if host toolchain supports AVX512IFMA */ +#define HAVE_AVX512IFMA 1 + +/* Define if host toolchain supports AVX512PF */ +#define HAVE_AVX512PF 1 + +/* Define if host toolchain supports AVX512VBMI */ +#define HAVE_AVX512VBMI 1 + +/* Define if host toolchain supports AVX512VL */ +#define HAVE_AVX512VL 1 +#endif + +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + +/* bio->bi_bdev->bd_disk exists */ +/* #undef HAVE_BIO_BDEV_DISK */ + +/* bio->bi_opf is defined */ +/* #undef HAVE_BIO_BI_OPF */ + +/* bio->bi_status exists */ +/* #undef HAVE_BIO_BI_STATUS */ + +/* bio has bi_iter */ +/* #undef HAVE_BIO_BVEC_ITER */ + +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + +/* bio_max_segs() is implemented */ +/* #undef HAVE_BIO_MAX_SEGS */ + +/* bio_set_dev() is available */ +/* #undef HAVE_BIO_SET_DEV */ + +/* bio_set_dev() GPL-only */ +/* #undef HAVE_BIO_SET_DEV_GPL_ONLY */ + +/* bio_set_op_attrs is available */ +/* #undef HAVE_BIO_SET_OP_ATTRS */ + +/* blkdev_reread_part() exists */ +/* #undef HAVE_BLKDEV_REREAD_PART */ + +/* blkg_tryget() is available */ +/* #undef HAVE_BLKG_TRYGET */ + +/* blkg_tryget() GPL-only */ +/* #undef HAVE_BLKG_TRYGET_GPL_ONLY */ + +/* blk_alloc_disk() exists */ +/* #undef HAVE_BLK_ALLOC_DISK */ + +/* blk_alloc_queue() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ + +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + +/* blk queue backing_dev_info is dynamic */ +/* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ + +/* blk_queue_flag_clear() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_CLEAR */ + +/* blk_queue_flag_set() exists */ +/* #undef HAVE_BLK_QUEUE_FLAG_SET */ + +/* blk_queue_flush() is available */ +/* #undef HAVE_BLK_QUEUE_FLUSH */ + +/* blk_queue_flush() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */ + +/* blk_queue_secdiscard() is available */ +/* #undef HAVE_BLK_QUEUE_SECDISCARD */ + +/* blk_queue_secure_erase() is available */ +/* #undef HAVE_BLK_QUEUE_SECURE_ERASE */ + +/* blk_queue_write_cache() exists */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE */ + +/* blk_queue_write_cache() is GPL-only */ +/* #undef HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY */ + +/* Define if revalidate_disk() in block_device_operations */ +/* #undef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function + CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + +/* clear_inode() is available */ +/* #undef HAVE_CLEAR_INODE */ + +/* dentry uses const struct dentry_operations */ +/* #undef HAVE_CONST_DENTRY_OPERATIONS */ + +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + +/* current_time() exists */ +/* #undef HAVE_CURRENT_TIME */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* DECLARE_EVENT_CLASS() is available */ +/* #undef HAVE_DECLARE_EVENT_CLASS */ + +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + +/* sops->dirty_inode() wants flags */ +/* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ + +/* disk_*_io_acct() available */ +/* #undef HAVE_DISK_IO_ACCT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* d_make_root() is available */ +/* #undef HAVE_D_MAKE_ROOT */ + +/* d_prune_aliases() is available */ +/* #undef HAVE_D_PRUNE_ALIASES */ + +/* dops->d_revalidate() operation takes nameidata */ +/* #undef HAVE_D_REVALIDATE_NAMEIDATA */ + +/* eops->encode_fh() wants child and parent inodes */ +/* #undef HAVE_ENCODE_FH_WITH_INODE */ + +/* sops->evict_inode() exists */ +/* #undef HAVE_EVICT_INODE */ + +/* fops->aio_fsync() exists */ +/* #undef HAVE_FILE_AIO_FSYNC */ + +/* file_dentry() is available */ +/* #undef HAVE_FILE_DENTRY */ + +/* file_inode() is available */ +/* #undef HAVE_FILE_INODE */ + +/* iops->follow_link() cookie */ +/* #undef HAVE_FOLLOW_LINK_COOKIE */ + +/* iops->follow_link() nameidata */ +/* #undef HAVE_FOLLOW_LINK_NAMEIDATA */ + +/* fops->fsync() with range */ +/* #undef HAVE_FSYNC_RANGE */ + +/* fops->fsync() without dentry */ +/* #undef HAVE_FSYNC_WITHOUT_DENTRY */ + +/* generic_fillattr requires struct user_namespace* */ +/* #undef HAVE_GENERIC_FILLATTR_USERNS */ + +/* generic_*_io_acct() 3 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_3ARG */ + +/* generic_*_io_acct() 4 arg available */ +/* #undef HAVE_GENERIC_IO_ACCT_4ARG */ + +/* generic_readlink is global */ +/* #undef HAVE_GENERIC_READLINK */ + +/* generic_setxattr() exists */ +/* #undef HAVE_GENERIC_SETXATTR */ + +/* generic_write_checks() takes kiocb */ +/* #undef HAVE_GENERIC_WRITE_CHECKS_KIOCB */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* iops->get_link() cookie */ +/* #undef HAVE_GET_LINK_COOKIE */ + +/* iops->get_link() delayed */ +/* #undef HAVE_GET_LINK_DELAYED */ + +/* group_info->gid exists */ +/* #undef HAVE_GROUP_INFO_GID */ + +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* yes */ +/* #undef HAVE_INODE_LOCK_SHARED */ + +/* inode_owner_or_capable() exists */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE */ + +/* inode_owner_or_capable() takes user_ns */ +/* #undef HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED */ + +/* inode_set_flags() exists */ +/* #undef HAVE_INODE_SET_FLAGS */ + +/* inode_set_iversion() exists */ +/* #undef HAVE_INODE_SET_IVERSION */ + +/* inode->i_*time's are timespec64 */ +/* #undef HAVE_INODE_TIMESPEC64_TIMES */ + +/* timestamp_truncate() exists */ +/* #undef HAVE_INODE_TIMESTAMP_TRUNCATE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* in_compat_syscall() is available */ +/* #undef HAVE_IN_COMPAT_SYSCALL */ + +/* iops->create() takes struct user_namespace* */ +/* #undef HAVE_IOPS_CREATE_USERNS */ + +/* iops->mkdir() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKDIR_USERNS */ + +/* iops->mknod() takes struct user_namespace* */ +/* #undef HAVE_IOPS_MKNOD_USERNS */ + +/* iops->rename() takes struct user_namespace* */ +/* #undef HAVE_IOPS_RENAME_USERNS */ + +/* iops->symlink() takes struct user_namespace* */ +/* #undef HAVE_IOPS_SYMLINK_USERNS */ + +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + +/* yes */ +/* #undef HAVE_IO_SCHEDULE_TIMEOUT */ + +/* Define to 1 if you have the `issetugid' function. */ +#define HAVE_ISSETUGID 1 + +/* kernel has kernel_fpu_* functions */ +/* #undef HAVE_KERNEL_FPU */ + +/* kernel has asm/fpu/api.h */ +/* #undef HAVE_KERNEL_FPU_API_HEADER */ + +/* kernel fpu internal */ +/* #undef HAVE_KERNEL_FPU_INTERNAL */ + +/* uncached_acl_sentinel() exists */ +/* #undef HAVE_KERNEL_GET_ACL_HANDLE_CACHE */ + +/* kernel does stack verification */ +/* #undef HAVE_KERNEL_OBJTOOL */ + +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + +/* kernel_read() take loff_t pointer */ +/* #undef HAVE_KERNEL_READ_PPOS */ + +/* timer_list.function gets a timer_list */ +/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */ + +/* struct timer_list has a flags member */ +/* #undef HAVE_KERNEL_TIMER_LIST_FLAGS */ + +/* timer_setup() is available */ +/* #undef HAVE_KERNEL_TIMER_SETUP */ + +/* kernel_write() take loff_t pointer */ +/* #undef HAVE_KERNEL_WRITE_PPOS */ + +/* kmem_cache_create_usercopy() exists */ +/* #undef HAVE_KMEM_CACHE_CREATE_USERCOPY */ + +/* kstrtoul() exists */ +/* #undef HAVE_KSTRTOUL */ + +/* ktime_get_coarse_real_ts64() exists */ +/* #undef HAVE_KTIME_GET_COARSE_REAL_TS64 */ + +/* ktime_get_raw_ts64() exists */ +/* #undef HAVE_KTIME_GET_RAW_TS64 */ + +/* kvmalloc exists */ +/* #undef HAVE_KVMALLOC */ + +/* Define if you have [aio] */ +/* #undef HAVE_LIBAIO */ + +/* Define if you have [blkid] */ +/* #undef HAVE_LIBBLKID */ + +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have [tirpc] */ +/* #undef HAVE_LIBTIRPC */ + +/* Define if you have [udev] */ +/* #undef HAVE_LIBUDEV */ + +/* Define if you have [uuid] */ +/* #undef HAVE_LIBUUID */ + +/* lseek_execute() is available */ +/* #undef HAVE_LSEEK_EXECUTE */ + +/* makedev() is declared in sys/mkdev.h */ +/* #undef HAVE_MAKEDEV_IN_MKDEV */ + +/* makedev() is declared in sys/sysmacros.h */ +/* #undef HAVE_MAKEDEV_IN_SYSMACROS */ + +/* Noting that make_request_fn() returns blk_qc_t */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_QC */ + +/* Noting that make_request_fn() returns void */ +/* #undef HAVE_MAKE_REQUEST_FN_RET_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* iops->mkdir() takes umode_t */ +/* #undef HAVE_MKDIR_UMODE_T */ + +/* Define to 1 if you have the `mlockall' function. */ +#define HAVE_MLOCKALL 1 + +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + +/* Define if host toolchain supports MOVBE */ +#define HAVE_MOVBE 1 + +/* new_sync_read()/new_sync_write() are available */ +/* #undef HAVE_NEW_SYNC_READ */ + +/* iops->getattr() takes a path */ +/* #undef HAVE_PATH_IOPS_GETATTR */ + +/* Define if host toolchain supports PCLMULQDQ */ +#define HAVE_PCLMULQDQ 1 + +/* percpu_counter_add_batch() is defined */ +/* #undef HAVE_PERCPU_COUNTER_ADD_BATCH */ + +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + +/* posix_acl_chmod() exists */ +/* #undef HAVE_POSIX_ACL_CHMOD */ + +/* posix_acl_from_xattr() needs user_ns */ +/* #undef HAVE_POSIX_ACL_FROM_XATTR_USERNS */ + +/* posix_acl_release() is available */ +/* #undef HAVE_POSIX_ACL_RELEASE */ + +/* posix_acl_release() is GPL-only */ +/* #undef HAVE_POSIX_ACL_RELEASE_GPL_ONLY */ + +/* posix_acl_valid() wants user namespace */ +/* #undef HAVE_POSIX_ACL_VALID_WITH_NS */ + +/* proc_ops structure exists */ +/* #undef HAVE_PROC_OPS_STRUCT */ + +/* iops->put_link() cookie */ +/* #undef HAVE_PUT_LINK_COOKIE */ + +/* iops->put_link() delayed */ +/* #undef HAVE_PUT_LINK_DELAYED */ + +/* iops->put_link() nameidata */ +/* #undef HAVE_PUT_LINK_NAMEIDATA */ + +/* If available, contains the Python version number currently in use. */ +#define HAVE_PYTHON "3.7" + +/* qat is enabled and existed */ +/* #undef HAVE_QAT */ + +/* iops->rename() wants flags */ +/* #undef HAVE_RENAME_WANTS_FLAGS */ + +/* REQ_DISCARD is defined */ +/* #undef HAVE_REQ_DISCARD */ + +/* REQ_FLUSH is defined */ +/* #undef HAVE_REQ_FLUSH */ + +/* REQ_OP_DISCARD is defined */ +/* #undef HAVE_REQ_OP_DISCARD */ + +/* REQ_OP_FLUSH is defined */ +/* #undef HAVE_REQ_OP_FLUSH */ + +/* REQ_OP_SECURE_ERASE is defined */ +/* #undef HAVE_REQ_OP_SECURE_ERASE */ + +/* REQ_PREFLUSH is defined */ +/* #undef HAVE_REQ_PREFLUSH */ + +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + +/* struct rw_semaphore has member activity */ +/* #undef HAVE_RWSEM_ACTIVITY */ + +/* struct rw_semaphore has atomic_long_t member count */ +/* #undef HAVE_RWSEM_ATOMIC_LONG_COUNT */ + +/* linux/sched/signal.h exists */ +/* #undef HAVE_SCHED_SIGNAL_HEADER */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + +/* setattr_prepare() is available, doesn't accept user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_NO_USERNS */ + +/* setattr_prepare() accepts user_namespace */ +/* #undef HAVE_SETATTR_PREPARE_USERNS */ + +/* iops->set_acl() exists, takes 3 args */ +/* #undef HAVE_SET_ACL */ + +/* iops->set_acl() takes 4 args */ +/* #undef HAVE_SET_ACL_USERNS */ + +/* set_cached_acl() is usable */ +/* #undef HAVE_SET_CACHED_ACL_USABLE */ + +/* set_special_state() exists */ +/* #undef HAVE_SET_SPECIAL_STATE */ + +/* struct shrink_control exists */ +/* #undef HAVE_SHRINK_CONTROL_STRUCT */ + +/* kernel_siginfo_t exists */ +/* #undef HAVE_SIGINFO */ + +/* signal_stop() exists */ +/* #undef HAVE_SIGNAL_STOP */ + +/* new shrinker callback wants 2 args */ +/* #undef HAVE_SINGLE_SHRINKER_CALLBACK */ + +/* ->count_objects exists */ +/* #undef HAVE_SPLIT_SHRINKER_CALLBACK */ + +#if defined(__amd64__) || defined(__i386__) +/* Define if host toolchain supports SSE */ +#define HAVE_SSE 1 + +/* Define if host toolchain supports SSE2 */ +#define HAVE_SSE2 1 + +/* Define if host toolchain supports SSE3 */ +#define HAVE_SSE3 1 + +/* Define if host toolchain supports SSE4.1 */ +#define HAVE_SSE4_1 1 + +/* Define if host toolchain supports SSE4.2 */ +#define HAVE_SSE4_2 1 + +/* Define if host toolchain supports SSSE3 */ +#define HAVE_SSSE3 1 +#endif + +/* STACK_FRAME_NON_STANDARD is defined */ +/* #undef HAVE_STACK_FRAME_NON_STANDARD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + +/* super_setup_bdi_name() exits */ +/* #undef HAVE_SUPER_SETUP_BDI_NAME */ + +/* super_block->s_user_ns exists */ +/* #undef HAVE_SUPER_USER_NS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* i_op->tmpfile() exists */ +/* #undef HAVE_TMPFILE */ + +/* i_op->tmpfile() has userns */ +/* #undef HAVE_TMPFILE_USERNS */ + +/* totalhigh_pages() exists */ +/* #undef HAVE_TOTALHIGH_PAGES */ + +/* kernel has totalram_pages() */ +/* #undef HAVE_TOTALRAM_PAGES_FUNC */ + +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + +/* kernel has __kernel_fpu_* functions */ +/* #undef HAVE_UNDERSCORE_KERNEL_FPU */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* iops->getattr() takes struct user_namespace* */ +/* #undef HAVE_USERNS_IOPS_GETATTR */ + +/* iops->getattr() takes a vfsmount */ +/* #undef HAVE_VFSMOUNT_IOPS_GETATTR */ + +/* aops->direct_IO() uses iovec */ +/* #undef HAVE_VFS_DIRECT_IO_IOVEC */ + +/* aops->direct_IO() uses iov_iter without rw */ +/* #undef HAVE_VFS_DIRECT_IO_ITER */ + +/* aops->direct_IO() uses iov_iter with offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_OFFSET */ + +/* aops->direct_IO() uses iov_iter with rw and offset */ +/* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ + +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + +/* fops->iterate() is available */ +/* #undef HAVE_VFS_ITERATE */ + +/* fops->iterate_shared() is available */ +/* #undef HAVE_VFS_ITERATE_SHARED */ + +/* fops->readdir() is available */ +/* #undef HAVE_VFS_READDIR */ + +/* fops->read/write_iter() are available */ +/* #undef HAVE_VFS_RW_ITERATE */ + +/* __set_page_dirty_nobuffers exists */ +/* #undef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS */ + +/* __vmalloc page flags exists */ +/* #undef HAVE_VMALLOC_PAGE_KERNEL */ + +/* yes */ +/* #undef HAVE_WAIT_ON_BIT_ACTION */ + +/* wait_queue_entry_t exists */ +/* #undef HAVE_WAIT_QUEUE_ENTRY_T */ + +/* wq_head->head and wq_entry->entry exist */ +/* #undef HAVE_WAIT_QUEUE_HEAD_ENTRY */ + +/* xattr_handler->get() wants dentry */ +/* #undef HAVE_XATTR_GET_DENTRY */ + +/* xattr_handler->get() wants both dentry and inode */ +/* #undef HAVE_XATTR_GET_DENTRY_INODE */ + +/* xattr_handler->get() wants xattr_handler */ +/* #undef HAVE_XATTR_GET_HANDLER */ + +/* xattr_handler has name */ +/* #undef HAVE_XATTR_HANDLER_NAME */ + +/* xattr_handler->list() wants dentry */ +/* #undef HAVE_XATTR_LIST_DENTRY */ + +/* xattr_handler->list() wants xattr_handler */ +/* #undef HAVE_XATTR_LIST_HANDLER */ + +/* xattr_handler->list() wants simple */ +/* #undef HAVE_XATTR_LIST_SIMPLE */ + +/* xattr_handler->set() wants dentry */ +/* #undef HAVE_XATTR_SET_DENTRY */ + +/* xattr_handler->set() wants both dentry and inode */ +/* #undef HAVE_XATTR_SET_DENTRY_INODE */ + +/* xattr_handler->set() wants xattr_handler */ +/* #undef HAVE_XATTR_SET_HANDLER */ + +/* xattr_handler->set() takes user_namespace */ +/* #undef HAVE_XATTR_SET_USERNS */ + +/* Define if you have [z] */ +#define HAVE_ZLIB 1 + +/* __posix_acl_chmod() exists */ +/* #undef HAVE___POSIX_ACL_CHMOD */ + +/* kernel exports FPU functions */ +/* #undef KERNEL_EXPORTS_X86_FPU */ + +/* TBD: fetch(3) support */ +#if 0 +/* whether the chosen libfetch is to be loaded at run-time */ +#define LIBFETCH_DYNAMIC 1 + +/* libfetch is fetch(3) */ +#define LIBFETCH_IS_FETCH 1 + +/* libfetch is libcurl */ +#define LIBFETCH_IS_LIBCURL 0 + +/* soname of chosen libfetch */ +#define LIBFETCH_SONAME "libfetch.so.6" +#endif + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* make_request_fn() return type */ +/* #undef MAKE_REQUEST_FN_RET */ + +/* hardened module_param_call */ +/* #undef MODULE_PARAM_CALL_CONST */ + +/* struct shrink_control has nid */ +/* #undef SHRINK_CONTROL_HAS_NID */ + +/* Defined for legacy compatibility. */ +#define SPL_META_ALIAS ZFS_META_ALIAS + +/* Defined for legacy compatibility. */ +#define SPL_META_RELEASE ZFS_META_RELEASE + +/* Defined for legacy compatibility. */ +#define SPL_META_VERSION ZFS_META_VERSION + +/* True if ZFS is to be compiled for a FreeBSD system */ +#define SYSTEM_FREEBSD 1 + +/* True if ZFS is to be compiled for a Linux system */ +/* #undef SYSTEM_LINUX */ + +/* zfs debugging enabled */ +/* #undef ZFS_DEBUG */ + +/* /dev/zfs minor */ +/* #undef ZFS_DEVICE_MINOR */ + +/* enum node_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum node_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum node_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* enum zone_stat_item contains NR_FILE_PAGES */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ + +/* enum zone_stat_item contains NR_INACTIVE_ANON */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_ANON */ + +/* enum zone_stat_item contains NR_INACTIVE_FILE */ +/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ + +/* global_node_page_state() exists */ +/* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ + +/* global_zone_page_state() exists */ +/* #undef ZFS_GLOBAL_ZONE_PAGE_STATE */ + +/* Define to 1 if GPL-only symbols can be used */ +/* #undef ZFS_IS_GPL_COMPATIBLE */ + +/* Define the project alias string. */ - #define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g3b89d9518" ++#define ZFS_META_ALIAS "zfs-2.1.99-FreeBSD_g4a1195ca5" + +/* Define the project author. */ +#define ZFS_META_AUTHOR "OpenZFS" + +/* Define the project release date. */ +/* #undef ZFS_META_DATA */ + *** 43 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Sep 15 15:47:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1AD6668CC7; Wed, 15 Sep 2021 15:47:25 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8l31417gz4vGh; Wed, 15 Sep 2021 15:47:25 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f179.google.com with SMTP id v2so4729308oie.6; Wed, 15 Sep 2021 08:47:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eqSjJu5+J4GLd99U8MMNOTU4Qc/OtiFED+ir0R27a8o=; b=XEs5dg15VI6d19an30FbD+V2MUgr6xou5q90qSR6WYDLvqL9X0ewkdmbp68vecBH0P 126Ct63f09jF6oPMuYIYb/A5KRDf3vxx3ImUVDXvvYdVYHogZW60DvyZ0WPL4m1gqDZQ mbpXuMqYY1kpIxom4puw0Y+zgWySBJMv+sJ2WhsO6tbd112+Tml6RggSFoEh03TunQgG 3maIKI8LjXd+OI0aMEe3AsCrSe/TCJwy+E7FFcGEXrPFEs8sHv5Si+0CQy2HEBMEmYIg sMWdpn5b3SwG0QjWayHskc6A8MqMefq7wn3ZwnHB1mbYqULYmUEt6QSXvxcsZ53QVczL kpog== X-Gm-Message-State: AOAM5300AsyeRh+fNy8rN1Yx62sn/lJ9xeNrTWjhFmMANWw8A/RpwVjJ 6B/UDxhneLhl+lAx3zW0+r9NIu+mwklX6HzXs5bv+wGW X-Google-Smtp-Source: ABdhPJyVp8yiznXozERg69PZizR+01cYaw/7rQYozlH+c3sy8nLhL+2NR84uE7VBxeWxTm7jgAnAjMoWSZM9TyR3zOo= X-Received: by 2002:a54:4e94:: with SMTP id c20mr225040oiy.57.1631720839235; Wed, 15 Sep 2021 08:47:19 -0700 (PDT) MIME-Version: 1.0 References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> In-Reply-To: From: Alan Somers Date: Wed, 15 Sep 2021 09:47:08 -0600 Message-ID: Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: John Baldwin Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4H8l31417gz4vGh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 15:47:25 -0000 On Wed, Sep 15, 2021 at 9:21 AM John Baldwin wrote: > On 9/14/21 1:53 PM, Alan Somers wrote: > > On Tue, Sep 14, 2021 at 2:46 PM John Baldwin wrote: > > > >> The branch main has been updated by jhb: > >> > >> URL: > >> > https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > >> > >> commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > >> Author: John Baldwin > >> AuthorDate: 2021-09-14 20:46:14 +0000 > >> Commit: John Baldwin > >> CommitDate: 2021-09-14 20:46:14 +0000 > >> > >> cxgbe tom: Don't queue AIO requests on listen sockets. > >> > >> This is similar to the fixes in 141fe2dceeae. One difference is > that > >> TOE sockets do not change states (listen vs non-listen) once > created, > >> so no lock is needed for SOLISTENING(). > >> > >> Sponsored by: Chelsio Communications > >> > > > > I've always wondered: what's the point to using AIO with sockets? Can't > > everything socket-related be done better with non-blocking read/write and > > kqueue? > > Zero-copy operation with TOE is why TOE uses AIO. Zero-copy of user > buffers > can't really work with the non-AIO APIs because the user buffer is free to > be reused immediately after write(2) (and on the read side you don't know > the buffer in advance to allow the NIC to write directly into the use > buffer). > > In theory we could support zero-copy using mb_ext_pgs for aio_write() for > the non-TOE case similar to what sendfile() does. > > -- > John Baldwin > Interesting. Do you know of any common applications that include this optimization? I've been working on the AIO ecosystem for Rust. It would be good to ensure that this use case works, especially if zero-copy ever works for non-TOE. From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBD80668BB8; Wed, 15 Sep 2021 16:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRh5QQQz3G89; Wed, 15 Sep 2021 16:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F4EB11299; Wed, 15 Sep 2021 16:05:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5KTk086243; Wed, 15 Sep 2021 16:05:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5KDn086242; Wed, 15 Sep 2021 16:05:20 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:20 GMT Message-Id: <202109151605.18FG5KDn086242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 828f257277bd - main - Remove nonexistent include path for arm64 crypto files. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 828f257277bd7418bbc0431bbd78569a2f609af1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:20 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=828f257277bd7418bbc0431bbd78569a2f609af1 commit 828f257277bd7418bbc0431bbd78569a2f609af1 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 Remove nonexistent include path for arm64 crypto files. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D31932 --- sys/conf/files.arm64 | 4 ++-- sys/modules/armv8crypto/Makefile | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index bae23b17cc40..36dea68306f3 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -113,12 +113,12 @@ armv8_crypto_wrap.o optional armv8crypto \ clean "armv8_crypto_wrap.o" aesv8-armx.o optional armv8crypto \ dependency "$S/crypto/openssl/aarch64/aesv8-armx.S" \ - compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \ no-implicit-rule \ clean "aesv8-armx.o" ghashv8-armx.o optional armv8crypto \ dependency "$S/crypto/openssl/aarch64/ghashv8-armx.S" \ - compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \ no-implicit-rule \ clean "ghashv8-armx.o" diff --git a/sys/modules/armv8crypto/Makefile b/sys/modules/armv8crypto/Makefile index bd38fe039fc9..b252a72609be 100644 --- a/sys/modules/armv8crypto/Makefile +++ b/sys/modules/armv8crypto/Makefile @@ -20,7 +20,6 @@ armv8_crypto_wrap.o: armv8_crypto_wrap.c aesv8-armx.o: aesv8-armx.S ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ -I${SRCTOP}/sys/crypto/armv8 \ - -I${SRCTOP}/sys/crypto/openssl/crypto \ ${WERROR} ${PROF} \ -march=armv8-a+crypto ${.IMPSRC} ${CTFCONVERT_CMD} @@ -28,7 +27,6 @@ aesv8-armx.o: aesv8-armx.S ghashv8-armx.o: ghashv8-armx.S ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ -I${SRCTOP}/sys/crypto/armv8 \ - -I${SRCTOP}/sys/crypto/openssl/crypto \ ${WERROR} ${PROF} \ -march=armv8-a+crypto ${.IMPSRC} ${CTFCONVERT_CMD} From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28FD7668FA8; Wed, 15 Sep 2021 16:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRj6JyVz3GNh; Wed, 15 Sep 2021 16:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9E8C10DC2; Wed, 15 Sep 2021 16:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5L1L086267; Wed, 15 Sep 2021 16:05:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5LuJ086266; Wed, 15 Sep 2021 16:05:21 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:21 GMT Message-Id: <202109151605.18FG5LuJ086266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d2bc7754a226 - main - Assert that invalid bus widths can't be passed to bus_width_str(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2bc7754a226c031b76184277e32c4d65a763f67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d2bc7754a226c031b76184277e32c4d65a763f67 commit d2bc7754a226c031b76184277e32c4d65a763f67 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 Assert that invalid bus widths can't be passed to bus_width_str(). This appeases a -Wreturn-type warning from GCC. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31935 --- sys/cam/mmc/mmc_da.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index e41792dcebc1..4212e2aa805d 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -1178,6 +1178,8 @@ static inline const char return ("4-bit"); case bus_width_8: return ("8-bit"); + default: + __assert_unreachable(); } } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B322668BB9; Wed, 15 Sep 2021 16:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRl0CKzz3GF0; Wed, 15 Sep 2021 16:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBE8811118; Wed, 15 Sep 2021 16:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5Mpo086291; Wed, 15 Sep 2021 16:05:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5Mue086290; Wed, 15 Sep 2021 16:05:22 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:22 GMT Message-Id: <202109151605.18FG5Mue086290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 45cb7671133e - main - Only define sanitizer wrappers for atomic fences once. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45cb7671133efa52b63f301e8439a71259abe478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:23 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=45cb7671133efa52b63f301e8439a71259abe478 commit 45cb7671133efa52b63f301e8439a71259abe478 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 Only define sanitizer wrappers for atomic fences once. Previously, this was defining duplicate definitions for each type. This fixes a redundat definition warning from GCC. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31965 --- sys/sys/atomic_san.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index 30bd01c97cf2..b0790962d8bd 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -76,13 +76,16 @@ int sp##_atomic_##op##_##name(volatile type *, u_int); \ int sp##_atomic_##op##_acq_##name(volatile type *, u_int) -#define ATOMIC_SAN_THREAD_FENCE(sp) \ +#define _ATOMIC_SAN_THREAD_FENCE(sp) \ void sp##_atomic_thread_fence_acq(void); \ void sp##_atomic_thread_fence_rel(void); \ void sp##_atomic_thread_fence_acq_rel(void); \ void sp##_atomic_thread_fence_seq_cst(void); \ void sp##_atomic_interrupt_fence(void) +#define ATOMIC_SAN_THREAD_FENCE(sp) \ + _ATOMIC_SAN_THREAD_FENCE(sp) + #define _ATOMIC_SAN_FUNCS(sp, name, type) \ ATOMIC_SAN_FUNC_1(sp, add, name, type); \ ATOMIC_SAN_FUNC_1(sp, clear, name, type); \ @@ -96,8 +99,7 @@ ATOMIC_SAN_STORE(sp, name, type); \ ATOMIC_SAN_READ(sp, swap, name, type); \ ATOMIC_SAN_TEST(sp, testandclear, name, type); \ - ATOMIC_SAN_TEST(sp, testandset, name, type); \ - ATOMIC_SAN_THREAD_FENCE(sp); + ATOMIC_SAN_TEST(sp, testandset, name, type) #define ATOMIC_SAN_FUNCS(name, type) \ _ATOMIC_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, name, type) @@ -111,6 +113,7 @@ ATOMIC_SAN_FUNCS(8, uint8_t); ATOMIC_SAN_FUNCS(16, uint16_t); ATOMIC_SAN_FUNCS(32, uint32_t); ATOMIC_SAN_FUNCS(64, uint64_t); +ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); #ifndef SAN_RUNTIME From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BAF86693AA; Wed, 15 Sep 2021 16:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRm1HZ1z3GNt; Wed, 15 Sep 2021 16:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B43D10DC3; Wed, 15 Sep 2021 16:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5Npf086321; Wed, 15 Sep 2021 16:05:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5NsZ086320; Wed, 15 Sep 2021 16:05:23 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:23 GMT Message-Id: <202109151605.18FG5NsZ086320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 11647befcbb8 - main - Only define sanitizer wrappers for unsized bus space operations once. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11647befcbb81f2fc89c29020b4be80a251ec321 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:24 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=11647befcbb81f2fc89c29020b4be80a251ec321 commit 11647befcbb81f2fc89c29020b4be80a251ec321 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 Only define sanitizer wrappers for unsized bus space operations once. Previously, this was defining duplicate definitions for each size. This fixes a redundant definition warning from GCC. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31966 --- sys/sys/bus_san.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/sys/bus_san.h b/sys/sys/bus_san.h index fd3c4c803675..09feb0660525 100644 --- a/sys/sys/bus_san.h +++ b/sys/sys/bus_san.h @@ -93,7 +93,7 @@ int sp##_bus_space_poke_##width(bus_space_tag_t, \ bus_space_handle_t, bus_size_t, type); -#define BUS_SAN_MISC(sp) \ +#define _BUS_SAN_MISC(sp) \ int sp##_bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, \ int, bus_space_handle_t *); \ void sp##_bus_space_unmap(bus_space_tag_t, bus_space_handle_t, \ @@ -108,14 +108,16 @@ void sp##_bus_space_barrier(bus_space_tag_t, bus_space_handle_t,\ bus_size_t, bus_size_t, int); +#define BUS_SAN_MISC(sp) \ + _BUS_SAN_MISC(sp) + #define _BUS_SAN_FUNCS(sp, width, type) \ BUS_SAN_READ(sp, width, type); \ BUS_SAN_WRITE(sp, width, type); \ BUS_SAN_SET(sp, width, type); \ BUS_SAN_COPY(sp, width, type) \ BUS_SAN_PEEK(sp, width, type); \ - BUS_SAN_POKE(sp, width, type); \ - BUS_SAN_MISC(sp); + BUS_SAN_POKE(sp, width, type) #define BUS_SAN_FUNCS(width, type) \ _BUS_SAN_FUNCS(SAN_INTERCEPTOR_PREFIX, width, type) @@ -124,6 +126,7 @@ BUS_SAN_FUNCS(1, uint8_t); BUS_SAN_FUNCS(2, uint16_t); BUS_SAN_FUNCS(4, uint32_t); BUS_SAN_FUNCS(8, uint64_t); +BUS_SAN_MISC(SAN_INTERCEPTOR_PREFIX); #ifndef SAN_RUNTIME From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4257669483; Wed, 15 Sep 2021 16:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRn2wjQz3G8Y; Wed, 15 Sep 2021 16:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2953C10DC4; Wed, 15 Sep 2021 16:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5PUf086348; Wed, 15 Sep 2021 16:05:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5PIS086347; Wed, 15 Sep 2021 16:05:25 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:25 GMT Message-Id: <202109151605.18FG5PIS086347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5ac4ac85ca20 - main - Remove an always-true check. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ac4ac85ca20ce1f00c84502a65a3291bf416c18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:25 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5ac4ac85ca20ce1f00c84502a65a3291bf416c18 commit 5ac4ac85ca20ce1f00c84502a65a3291bf416c18 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 Remove an always-true check. This fixes a -Wtype-limits error from GCC 9. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31936 --- lib/libvmmapi/vmmapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 0543c92f4300..a2d26b1b33b9 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -486,7 +486,7 @@ vm_rev_map_gpa(struct vmctx *ctx, void *addr) offaddr = (char *)addr - ctx->baseaddr; if (ctx->lowmem > 0) - if (offaddr >= 0 && offaddr <= ctx->lowmem) + if (offaddr <= ctx->lowmem) return (offaddr); if (ctx->highmem > 0) From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA6CA66904F; Wed, 15 Sep 2021 16:05:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRq4TrJz3GHJ; Wed, 15 Sep 2021 16:05:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7376E11193; Wed, 15 Sep 2021 16:05:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5RpA086396; Wed, 15 Sep 2021 16:05:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5RTK086395; Wed, 15 Sep 2021 16:05:27 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:27 GMT Message-Id: <202109151605.18FG5RTK086395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b14cd3a8339e - main - efitable: Don't pass NULL as a format string to xo_err(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b14cd3a8339ea72cf39df4ccc53c830875c5d866 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:28 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b14cd3a8339ea72cf39df4ccc53c830875c5d866 commit b14cd3a8339ea72cf39df4ccc53c830875c5d866 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 efitable: Don't pass NULL as a format string to xo_err(). This fixes a -Wformat error reported by GCC 9. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D31939 --- usr.sbin/efitable/efitable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/efitable/efitable.c b/usr.sbin/efitable/efitable.c index 367ce3f033b1..6bd4d96ffd2a 100644 --- a/usr.sbin/efitable/efitable.c +++ b/usr.sbin/efitable/efitable.c @@ -146,13 +146,13 @@ main(int argc, char **argv) table.uuid = efi_table_ops[efi_idx].uuid; if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) - xo_err(EX_OSERR, NULL); + xo_err(EX_OSERR, "EFIIOC_GET_TABLE (len == 0)"); table.buf = malloc(table.table_len); table.buf_len = table.table_len; if (ioctl(efi_fd, EFIIOC_GET_TABLE, &table) == -1) - xo_err(EX_OSERR, NULL); + xo_err(EX_OSERR, "EFIIOC_GET_TABLE"); efi_table_ops[efi_idx].parse(table.buf); close(efi_fd); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3678668FBD; Wed, 15 Sep 2021 16:05:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRr51D8z3G5f; Wed, 15 Sep 2021 16:05:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B11B1131C; Wed, 15 Sep 2021 16:05:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5SlC086429; Wed, 15 Sep 2021 16:05:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5SHQ086428; Wed, 15 Sep 2021 16:05:28 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:28 GMT Message-Id: <202109151605.18FG5SHQ086428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9553c6af881e - main - : Don't use __has_builtin(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9553c6af881e1f869cecb11b4476279e0ed6c4e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:28 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9553c6af881e1f869cecb11b4476279e0ed6c4e0 commit 9553c6af881e1f869cecb11b4476279e0ed6c4e0 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 : Don't use __has_builtin(). GCC only added support for __has_builtin in GCC 10. However, all supported versions of GCC and clang include these builtins so just use them unconditionally. This fixes the build with GCC 9. Reviewed by: manu, hselasky, imp Differential Revision: https://reviews.freebsd.org/D31942 --- sys/compat/linuxkpi/common/include/linux/overflow.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/overflow.h b/sys/compat/linuxkpi/common/include/linux/overflow.h index 6f53f0b59384..2d540796cd43 100644 --- a/sys/compat/linuxkpi/common/include/linux/overflow.h +++ b/sys/compat/linuxkpi/common/include/linux/overflow.h @@ -34,18 +34,9 @@ #include #include -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif - -#if __has_builtin(__builtin_add_overflow) #define check_add_overflow(a, b, c) \ __builtin_add_overflow(a, b, c) -#else -#error "Compiler does not support __builtin_add_overflow" -#endif -#if __has_builtin(__builtin_mul_overflow) #define check_mul_overflow(a, b, c) \ __builtin_mul_overflow(a, b, c) @@ -58,8 +49,5 @@ array_size(size_t x, size_t y) retval = SIZE_MAX; return (retval); } -#else -#error "Compiler does not support __builtin_mul_overflow" -#endif #endif /* __LINUX_OVERFLOW_H__ */ From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40A62668FBF; Wed, 15 Sep 2021 16:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRs6KYlz3GQc; Wed, 15 Sep 2021 16:05:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADC6610DC6; Wed, 15 Sep 2021 16:05:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5TSd086453; Wed, 15 Sep 2021 16:05:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5Tn7086452; Wed, 15 Sep 2021 16:05:29 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:29 GMT Message-Id: <202109151605.18FG5Tn7086452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 44126818d2ec - main - infiniband: Disable -Wredundant-decl warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 44126818d2ec96d8247eafcae9b96905a473a264 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:30 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=44126818d2ec96d8247eafcae9b96905a473a264 commit 44126818d2ec96d8247eafcae9b96905a473a264 Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 infiniband: Disable -Wredundant-decl warnings. ib_uverbs_flow_resources_free() is declard in two header files in upstream OFED. Disable the warning to avoid introducing diffs to fix the build on GCC 9. While here, fix the ibcore module to disable the same warnings disabled in OFED_CFLAGS. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D31943 --- sys/conf/kern.pre.mk | 2 +- sys/modules/ibcore/Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index d9621273c57b..9d9e32027ec7 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -297,7 +297,7 @@ LINUXKPI_C= ${NORMAL_C} ${LINUXKPI_INCLUDES} # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES} -OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith +OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -Wno-redundant-decls OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \ ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} diff --git a/sys/modules/ibcore/Makefile b/sys/modules/ibcore/Makefile index 00d7ed976416..951f0abab453 100644 --- a/sys/modules/ibcore/Makefile +++ b/sys/modules/ibcore/Makefile @@ -53,3 +53,5 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include CFLAGS+= -DINET6 -DINET -DCONFIG_INFINIBAND_USER_MEM .include + +CWARNFLAGS+= -Wno-cast-qual -Wno-pointer-arith -Wno-redundant-decls From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD94F66904E; Wed, 15 Sep 2021 16:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRp3Z6Fz3GQW; Wed, 15 Sep 2021 16:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 503E010DC5; Wed, 15 Sep 2021 16:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5QXo086372; Wed, 15 Sep 2021 16:05:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5Q5l086371; Wed, 15 Sep 2021 16:05:26 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:26 GMT Message-Id: <202109151605.18FG5Q5l086371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4c9cb057bd96 - main - top: Remove a duplicate extern declaration for show_args. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c9cb057bd96bd10278f5ce7a735fff4c08e3c30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:26 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4c9cb057bd96bd10278f5ce7a735fff4c08e3c30 commit 4c9cb057bd96bd10278f5ce7a735fff4c08e3c30 Author: John Baldwin AuthorDate: 2021-09-15 16:03:17 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:17 +0000 top: Remove a duplicate extern declaration for show_args. This fixes a -Wnested-extern error with GCC 9. There is an existing extern declaration in top.h. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D31937 --- usr.bin/top/machine.c | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 1fe2a91a655c..315c8be1a4c2 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -895,7 +895,6 @@ get_process_info(struct system_info *si, struct process_select *sel, static int cmd_matches(struct kinfo_proc *proc, const char *term) { - extern int show_args; char **args = NULL; if (!term) { From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57B7166948F; Wed, 15 Sep 2021 16:05:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRv15l1z3GVj; Wed, 15 Sep 2021 16:05:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA4DD11119; Wed, 15 Sep 2021 16:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5U6g086483; Wed, 15 Sep 2021 16:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5Ujj086482; Wed, 15 Sep 2021 16:05:30 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:30 GMT Message-Id: <202109151605.18FG5Ujj086482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: df005aa9b3d8 - main - pf: Remove duplicate declaration of pf_ioctl_maxcount. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df005aa9b3d8d5bf78bff749b261e9ae5bea80a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:31 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=df005aa9b3d8d5bf78bff749b261e9ae5bea80a3 commit df005aa9b3d8d5bf78bff749b261e9ae5bea80a3 Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 pf: Remove duplicate declaration of pf_ioctl_maxcount. Fixes a -Wredundant-decls warning with GCC 9. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D31944 --- sys/netpfil/pf/pf_ioctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 6d240326361e..e7e37d5a6d5a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -273,8 +273,6 @@ pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; /* pflog */ pflog_packet_t *pflog_packet_ptr = NULL; -extern u_long pf_ioctl_maxcount; - /* * Copy a user-provided string, returning an error if truncation would occur. * Avoid scanning past "sz" bytes in the source string since there's no From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E9A3668FC1; Wed, 15 Sep 2021 16:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRw11gPz3GQk; Wed, 15 Sep 2021 16:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03D9310DC7; Wed, 15 Sep 2021 16:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5VIx086507; Wed, 15 Sep 2021 16:05:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5Vu3086506; Wed, 15 Sep 2021 16:05:31 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:31 GMT Message-Id: <202109151605.18FG5Vu3086506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: cd16a848d1b3 - main - posixshmtest: Fix various warnings raised by GCC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd16a848d1b34016b1a1c663223729a92c247be3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:32 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cd16a848d1b34016b1a1c663223729a92c247be3 commit cd16a848d1b34016b1a1c663223729a92c247be3 Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 posixshmtest: Fix various warnings raised by GCC. - Remove unused format string arguments. - Remove a set but unused variable. Reviewed by: khng, kib Differential Revision: https://reviews.freebsd.org/D31946 --- tests/sys/posixshm/posixshm_test.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c index eddb1d2d8250..b460639ba647 100644 --- a/tests/sys/posixshm/posixshm_test.c +++ b/tests/sys/posixshm/posixshm_test.c @@ -1105,7 +1105,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Aligned fspacectl failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Aligned fspacectl content checking failed", errno); + "Aligned fspacectl content checking failed"); /* Unaligned fspacectl(fd, SPACECTL_DEALLOC, ...) */ ATF_REQUIRE(shm_fill(fd, 0, shm_sz) == 0); @@ -1115,7 +1115,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Unaligned fspacectl failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Unaligned fspacectl content checking failed", errno); + "Unaligned fspacectl content checking failed"); /* Aligned fspacectl(fd, SPACECTL_DEALLOC, ...) to OFF_MAX */ ATF_REQUIRE(shm_fill(fd, 0, shm_sz) == 0); @@ -1124,7 +1124,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Aligned fspacectl to OFF_MAX failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Aligned fspacectl to OFF_MAX content checking failed", errno); + "Aligned fspacectl to OFF_MAX content checking failed"); /* Unaligned fspacectl(fd, SPACECTL_DEALLOC, ...) to OFF_MAX */ ATF_REQUIRE(shm_fill(fd, 0, shm_sz) == 0); @@ -1133,7 +1133,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Unaligned fspacectl to OFF_MAX failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Unaligned fspacectl to OFF_MAX content checking failed", errno); + "Unaligned fspacectl to OFF_MAX content checking failed"); /* Aligned fspacectl(fd, SPACECTL_DEALLOC, ...) past shm_sz */ ATF_REQUIRE(shm_fill(fd, 0, shm_sz) == 0); @@ -1142,7 +1142,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Aligned fspacectl past shm_sz failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Aligned fspacectl past shm_sz content checking failed", errno); + "Aligned fspacectl past shm_sz content checking failed"); /* Unaligned fspacectl(fd, SPACECTL_DEALLOC, ...) past shm_sz */ ATF_REQUIRE(shm_fill(fd, 0, shm_sz) == 0); @@ -1151,7 +1151,7 @@ ATF_TC_BODY(fspacectl, tc) ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, "Unaligned fspacectl past shm_sz failed; errno=%d", errno); ATF_CHECK_MSG(check_content_dealloc(fd, offset, length, shm_sz) == 0, - "Unaligned fspacectl past shm_sz content checking failed", errno); + "Unaligned fspacectl past shm_sz content checking failed"); ATF_REQUIRE(close(fd) == 0); } @@ -1251,9 +1251,7 @@ ATF_TC_BODY(largepage_config, tc) struct shm_largepage_conf lpc; char *addr, *buf; size_t ps[MAXPAGESIZES + 1]; /* silence warnings if MAXPAGESIZES == 1 */ - int error, fd, pscnt; - - pscnt = pagesizes(ps); + int error, fd; fd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0); ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; error=%d", errno); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D604B66951E; Wed, 15 Sep 2021 16:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRy50K1z3GSG; Wed, 15 Sep 2021 16:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AA3A1101D; Wed, 15 Sep 2021 16:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5Y1j086557; Wed, 15 Sep 2021 16:05:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5YvK086556; Wed, 15 Sep 2021 16:05:34 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:34 GMT Message-Id: <202109151605.18FG5YvK086556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8753039a8f23 - main - arm64: Fix a logic bug in is_load_instr(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8753039a8f231ab04c7f3db9eaa5d9144d73440d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8753039a8f231ab04c7f3db9eaa5d9144d73440d commit 8753039a8f231ab04c7f3db9eaa5d9144d73440d Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 arm64: Fix a logic bug in is_load_instr(). Logical and ('&&') was used to join two conditions instead of logical or ('||') causing some store instructions to not be recognized. Reported by: GCC 9 -Wparentheses Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D31949 --- sys/arm64/include/db_machdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index 105e8e507ce3..9ec0b6402a91 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -97,7 +97,7 @@ typedef long db_expr_t; (((ins) & 0xffe00c00u) != 0x3c800000u)) || /* unscaled immediate */ \ ((((ins) & 0x3b000000u) == 0x39000000u) && \ (((ins) & 0x3bc00000u) != 0x39000000u) && \ - (((ins) & 0xffc00000u) != 0x3d800000u)) && /* unsigned immediate */ \ + (((ins) & 0xffc00000u) != 0x3d800000u)) || /* unsigned immediate */ \ (((ins) & 0x3bc00000u) == 0x28400000u) || /* pair (offset) */ \ (((ins) & 0x3bc00000u) == 0x28c00000u) || /* pair (post-indexed) */ \ (((ins) & 0x3bc00000u) == 0x29800000u)) /* pair (pre-indexed) */ From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0F7366906E; Wed, 15 Sep 2021 16:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRz4CXGz3GYH; Wed, 15 Sep 2021 16:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 657CD1131E; Wed, 15 Sep 2021 16:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5Z7E086581; Wed, 15 Sep 2021 16:05:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5ZBu086580; Wed, 15 Sep 2021 16:05:35 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:35 GMT Message-Id: <202109151605.18FG5ZBu086580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 857dc1c0ecfb - main - arm64: Pass the right label to END() for handle_empty_exception. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 857dc1c0ecfbf40509706b87de832a3f6d7338b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=857dc1c0ecfbf40509706b87de832a3f6d7338b2 commit 857dc1c0ecfbf40509706b87de832a3f6d7338b2 Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 arm64: Pass the right label to END() for handle_empty_exception. GNU as reported an error for the argument to .size not being a constant. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D31950 --- sys/arm64/arm64/exception.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index 413b9523eb06..22f6b7ce6145 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -225,7 +225,7 @@ ENTRY(handle_empty_exception) mov x0, sp 1: bl unhandled_exception b 1b -END(handle_unhandled_exception) +END(handle_empty_exception) .macro vempty .align 7 From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:05:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCB2566951B; Wed, 15 Sep 2021 16:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lRx520hz3GSB; Wed, 15 Sep 2021 16:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29AE61131D; Wed, 15 Sep 2021 16:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG5Xmw086531; Wed, 15 Sep 2021 16:05:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG5XNb086530; Wed, 15 Sep 2021 16:05:33 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:05:33 GMT Message-Id: <202109151605.18FG5XNb086530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d99c87c8d54a - main - evdev: Add parentheses around '-' expression in operand of '&'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d99c87c8d54a02a229cbeaa19ec8784b1d5afbb9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:05:34 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d99c87c8d54a02a229cbeaa19ec8784b1d5afbb9 commit d99c87c8d54a02a229cbeaa19ec8784b1d5afbb9 Author: John Baldwin AuthorDate: 2021-09-15 16:03:18 +0000 Commit: John Baldwin CommitDate: 2021-09-15 16:03:18 +0000 evdev: Add parentheses around '-' expression in operand of '&'. This fixes a -Wparentheses error with GCC 9. Reviewed by: wulf Differential Revision: https://reviews.freebsd.org/D31947 --- sys/dev/evdev/evdev_mt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index a3cb76cbbdb4..1b4ec1233ef2 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -101,7 +101,7 @@ static void evdev_mt_replay_events(struct evdev_dev *); static inline int ffc_slot(struct evdev_dev *evdev, slotset_t slots) { - return (ffs(~slots & (2U << MAXIMAL_MT_SLOT(evdev)) - 1) - 1); + return (ffs(~slots & ((2U << MAXIMAL_MT_SLOT(evdev)) - 1)) - 1); } void From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:06:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3CBF6697B9; Wed, 15 Sep 2021 16:06:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8lSj5DVTz3GrX; Wed, 15 Sep 2021 16:06:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CDEF110C0; Wed, 15 Sep 2021 16:06:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FG6DGu086812; Wed, 15 Sep 2021 16:06:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FG6D4K086811; Wed, 15 Sep 2021 16:06:13 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:06:13 GMT Message-Id: <202109151606.18FG6D4K086811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: e3e7d953323c - main - tcp: Avoid division by zero when KERN_TLS is enabled in tcp_account_for_send(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3e7d953323c450dbe3ecbb21f9741f049ee3017 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:06:14 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e3e7d953323c450dbe3ecbb21f9741f049ee3017 commit e3e7d953323c450dbe3ecbb21f9741f049ee3017 Author: Hans Petter Selasky AuthorDate: 2021-09-15 16:03:38 +0000 Commit: Hans Petter Selasky CommitDate: 2021-09-15 16:05:31 +0000 tcp: Avoid division by zero when KERN_TLS is enabled in tcp_account_for_send(). If the "len" variable is non-zero, we can assume that the sum of "tp->t_snd_rxt_bytes + tp->t_sndbytes" is also non-zero. It is also assumed that the 64-bit byte counters will never wrap around. Differential Revision: https://reviews.freebsd.org/D31959 Reviewed by: gallatin, rrs and tuexen Found by: "I told you so", also called hselasky MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/netinet/tcp_var.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 64e954cf4ad5..c26f503f4a1d 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1155,7 +1155,7 @@ tcp_account_for_send(struct tcpcb *tp, uint32_t len, uint8_t is_rxt, tp->t_sndbytes += len; #ifdef KERN_TLS - if (hw_tls && is_rxt) { + if (hw_tls && is_rxt && len != 0) { uint64_t rexmit_percent = (1000ULL * tp->t_snd_rxt_bytes) / (10ULL * (tp->t_snd_rxt_bytes + tp->t_sndbytes)); if (rexmit_percent > ktls_ifnet_max_rexmit_pct) ktls_disable_ifnet(tp); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:52:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC4AC66A78D; Wed, 15 Sep 2021 16:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8mTz58Yyz3m0B; Wed, 15 Sep 2021 16:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9135411840; Wed, 15 Sep 2021 16:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FGqNB9052481; Wed, 15 Sep 2021 16:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FGqNQx052480; Wed, 15 Sep 2021 16:52:23 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:52:23 GMT Message-Id: <202109151652.18FGqNQx052480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 731e418bd748 - main - arm64: rockchip: clk_mux: Add support for mux in GRF type clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 731e418bd748f6602bb184ca3a35bab8af241cf1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:52:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=731e418bd748f6602bb184ca3a35bab8af241cf1 commit 731e418bd748f6602bb184ca3a35bab8af241cf1 Author: Emmanuel Vadot AuthorDate: 2021-09-09 16:24:33 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-15 16:43:04 +0000 arm64: rockchip: clk_mux: Add support for mux in GRF type clock Some clocks have their mux register in the GRF and not in the CRU. Add support for that in the rk_clk_mux clock type. --- sys/arm64/rockchip/clk/rk_clk_mux.c | 50 ++++++++++++++++++++++++++++++++++--- sys/arm64/rockchip/clk/rk_clk_mux.h | 1 + sys/arm64/rockchip/clk/rk_cru.h | 17 +++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk_clk_mux.c b/sys/arm64/rockchip/clk/rk_clk_mux.c index eb3cdeb99f4b..20e612b8c764 100644 --- a/sys/arm64/rockchip/clk/rk_clk_mux.c +++ b/sys/arm64/rockchip/clk/rk_clk_mux.c @@ -38,11 +38,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include "clkdev_if.h" +#include "syscon_if.h" #define WR4(_clk, off, val) \ CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) @@ -72,6 +74,7 @@ struct rk_clk_mux_sc { uint32_t shift; uint32_t mask; int mux_flags; + struct syscon *grf; }; static clknode_method_t rk_clk_mux_methods[] = { @@ -84,6 +87,25 @@ static clknode_method_t rk_clk_mux_methods[] = { DEFINE_CLASS_1(rk_clk_mux, rk_clk_mux_class, rk_clk_mux_methods, sizeof(struct rk_clk_mux_sc), clknode_class); +static struct syscon * +rk_clk_mux_get_grf(struct clknode *clk) +{ + device_t dev; + phandle_t node; + struct syscon *grf; + + grf = NULL; + dev = clknode_get_device(clk); + node = ofw_bus_get_node(dev); + if (OF_hasprop(node, "rockchip,grf") && + syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &grf) != 0) { + return (NULL); + } + + return (grf); +} + static int rk_clk_mux_init(struct clknode *clk, device_t dev) { @@ -93,8 +115,19 @@ rk_clk_mux_init(struct clknode *clk, device_t dev) sc = clknode_get_softc(clk); + if ((sc->mux_flags & RK_CLK_MUX_GRF) != 0) { + sc->grf = rk_clk_mux_get_grf(clk); + if (sc->grf == NULL) + panic("clock %s has GRF flag set but no syscon is available", + clknode_get_name(clk)); + } + DEVICE_LOCK(clk); - rv = RD4(clk, sc->offset, ®); + if (sc->grf) { + reg = SYSCON_READ_4(sc->grf, sc->offset); + rv = 0; + } else + rv = RD4(clk, sc->offset, ®); DEVICE_UNLOCK(clk); if (rv != 0) { return (rv); @@ -114,13 +147,18 @@ rk_clk_mux_set_mux(struct clknode *clk, int idx) sc = clknode_get_softc(clk); DEVICE_LOCK(clk); - rv = MD4(clk, sc->offset, sc->mask << sc->shift, - ((idx & sc->mask) << sc->shift) | RK_CLK_MUX_MASK); + if (sc->grf) + rv = SYSCON_MODIFY_4(sc->grf, sc->offset, sc->mask << sc->shift, + ((idx & sc->mask) << sc->shift) | RK_CLK_MUX_MASK); + else + rv = MD4(clk, sc->offset, sc->mask << sc->shift, + ((idx & sc->mask) << sc->shift) | RK_CLK_MUX_MASK); if (rv != 0) { DEVICE_UNLOCK(clk); return (rv); } - RD4(clk, sc->offset, ®); + if (sc->grf == NULL) + RD4(clk, sc->offset, ®); DEVICE_UNLOCK(clk); return(0); @@ -138,6 +176,10 @@ rk_clk_mux_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, sc = clknode_get_softc(clk); + if ((sc->mux_flags & RK_CLK_MUX_GRF) != 0) { + *stop = 1; + return (ENOTSUP); + } if ((sc->mux_flags & RK_CLK_MUX_REPARENT) == 0) { *stop = 0; return (0); diff --git a/sys/arm64/rockchip/clk/rk_clk_mux.h b/sys/arm64/rockchip/clk/rk_clk_mux.h index 7825f8892ac3..c2b5f9cdad69 100644 --- a/sys/arm64/rockchip/clk/rk_clk_mux.h +++ b/sys/arm64/rockchip/clk/rk_clk_mux.h @@ -42,6 +42,7 @@ struct rk_clk_mux_def { #define RK_CLK_MUX_MASK 0xFFFF0000 #define RK_CLK_MUX_REPARENT (1 << 0) +#define RK_CLK_MUX_GRF (1 << 1) int rk_clk_mux_register(struct clkdom *clkdom, struct rk_clk_mux_def *clkdef); diff --git a/sys/arm64/rockchip/clk/rk_cru.h b/sys/arm64/rockchip/clk/rk_cru.h index 0d1c49f01290..1c749d1d2c87 100644 --- a/sys/arm64/rockchip/clk/rk_cru.h +++ b/sys/arm64/rockchip/clk/rk_cru.h @@ -186,6 +186,23 @@ }, \ } +/* Complex clock without divider (multiplexer only in GRF). */ +#define MUXGRF(_id, _name, _pn, _f, _mo, _ms, _mw) \ +{ \ + .type = RK_CLK_MUX, \ + .clk.mux = &(struct rk_clk_mux_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = _pn, \ + .clkdef.parent_cnt = nitems(_pn), \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .offset = _mo, \ + .shift = _ms, \ + .width = _mw, \ + .mux_flags = RK_CLK_MUX_GRF | _f, \ + }, \ +} + struct rk_cru_gate { const char *name; const char *parent_name; From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:52:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45FBB66A451; Wed, 15 Sep 2021 16:52:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8mV06mslz3m65; Wed, 15 Sep 2021 16:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAF1211C94; Wed, 15 Sep 2021 16:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FGqOKD052505; Wed, 15 Sep 2021 16:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FGqO7P052504; Wed, 15 Sep 2021 16:52:24 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:52:24 GMT Message-Id: <202109151652.18FGqO7P052504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: deff1fb3dccb - main - arm64: rockchip: clk: Add MUXRAW macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: deff1fb3dccb13b6961b1e8595f74a2134e65b93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:52:25 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=deff1fb3dccb13b6961b1e8595f74a2134e65b93 commit deff1fb3dccb13b6961b1e8595f74a2134e65b93 Author: Emmanuel Vadot AuthorDate: 2021-09-15 16:25:09 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-15 16:43:07 +0000 arm64: rockchip: clk: Add MUXRAW macros Some clocks in the RK3328 SoC (and possibly others) have registers not in the CLKSEL_CON range. Add a macros for muxes which lives not in the range of CLKSEL_CON which just takes a raw offset. --- sys/arm64/rockchip/clk/rk_cru.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk_cru.h b/sys/arm64/rockchip/clk/rk_cru.h index 1c749d1d2c87..fc838fc11d19 100644 --- a/sys/arm64/rockchip/clk/rk_cru.h +++ b/sys/arm64/rockchip/clk/rk_cru.h @@ -170,7 +170,7 @@ } /* Complex clock without divider (multiplexer only). */ -#define MUX(_id, _name, _pn, _f, _mo, _ms, _mw) \ +#define MUXRAW(_id, _name, _pn, _f, _mo, _ms, _mw) \ { \ .type = RK_CLK_MUX, \ .clk.mux = &(struct rk_clk_mux_def) { \ @@ -179,13 +179,16 @@ .clkdef.parent_names = _pn, \ .clkdef.parent_cnt = nitems(_pn), \ .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .offset = CRU_CLKSEL_CON(_mo), \ + .offset = _mo, \ .shift = _ms, \ .width = _mw, \ - .mux_flags = _f, \ + .mux_flags = _f, \ }, \ } +#define MUX(_id, _name, _pn, _f, _mo, _ms, _mw) \ + MUXRAW(_id, _name, _pn, _f, CRU_CLKSEL_CON(_mo), _ms, _mw) + /* Complex clock without divider (multiplexer only in GRF). */ #define MUXGRF(_id, _name, _pn, _f, _mo, _ms, _mw) \ { \ From owner-dev-commits-src-main@freebsd.org Wed Sep 15 16:52:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47A2B66A452; Wed, 15 Sep 2021 16:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8mV20dtvz3mF1; Wed, 15 Sep 2021 16:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D864611DB3; Wed, 15 Sep 2021 16:52:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FGqPiO052529; Wed, 15 Sep 2021 16:52:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FGqP2a052528; Wed, 15 Sep 2021 16:52:25 GMT (envelope-from git) Date: Wed, 15 Sep 2021 16:52:25 GMT Message-Id: <202109151652.18FGqP2a052528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: cc2f9bbbad3b - main - arm64: rockchip: rk3328: Finish implementing clocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc2f9bbbad3b9cd81b8e66d57f9d34d8a42048dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 16:52:26 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cc2f9bbbad3b9cd81b8e66d57f9d34d8a42048dd commit cc2f9bbbad3b9cd81b8e66d57f9d34d8a42048dd Author: Emmanuel Vadot AuthorDate: 2021-09-15 16:33:38 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-15 16:43:10 +0000 arm64: rockchip: rk3328: Finish implementing clocks This finish (almost) the clocks implementations for the RK3328 SoC. The clocks are now correctly implemented respecting the clock hiearchy. The missing clocks are mostly the DDR clocks, implementing those is only useful for debugging as we will never set them in the kernel. The ARMCLK still needs to be rewritten so it looks closer to how the hardware is done. Tested-on: Rock64 --- sys/arm64/rockchip/clk/rk3328_cru.c | 2096 ++++++++++++----------------------- 1 file changed, 712 insertions(+), 1384 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk3328_cru.c b/sys/arm64/rockchip/clk/rk3328_cru.c index 95a87cfd0e00..344bf3bcd7aa 100644 --- a/sys/arm64/rockchip/clk/rk3328_cru.c +++ b/sys/arm64/rockchip/clk/rk3328_cru.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2018 Emmanuel Vadot + * Copyright (c) 2018-2021 Emmanuel Vadot * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,18 +49,76 @@ __FBSDID("$FreeBSD$"); #include +#define CRU_CLKSEL_CON(x) (0x100 + (x) * 0x4) + /* Registers */ #define RK3328_GRF_SOC_CON4 0x410 #define RK3328_GRF_MAC_CON1 0x904 #define RK3328_GRF_MAC_CON2 0x908 -/* GATES */ - +/* Exported clocks */ + +#define PLL_APLL 1 +#define PLL_DPLL 2 +#define PLL_CPLL 3 +#define PLL_GPLL 4 +#define PLL_NPLL 5 +#define ARMCLK 6 + +/* SCLK */ +#define SCLK_RTC32K 30 +#define SCLK_SDMMC_EXT 31 +#define SCLK_SPI 32 +#define SCLK_SDMMC 33 +#define SCLK_SDIO 34 +#define SCLK_EMMC 35 +#define SCLK_TSADC 36 +#define SCLK_SARADC 37 +#define SCLK_UART0 38 +#define SCLK_UART1 39 +#define SCLK_UART2 40 #define SCLK_I2S0 41 #define SCLK_I2S1 42 #define SCLK_I2S2 43 #define SCLK_I2S1_OUT 44 #define SCLK_I2S2_OUT 45 +#define SCLK_SPDIF 46 +#define SCLK_TIMER0 47 +#define SCLK_TIMER1 48 +#define SCLK_TIMER2 49 +#define SCLK_TIMER3 50 +#define SCLK_TIMER4 51 +#define SCLK_TIMER5 52 +#define SCLK_WIFI 53 +#define SCLK_CIF_OUT 54 +#define SCLK_I2C0 55 +#define SCLK_I2C1 56 +#define SCLK_I2C2 57 +#define SCLK_I2C3 58 +#define SCLK_CRYPTO 59 +#define SCLK_PWM 60 +#define SCLK_PDM 61 +#define SCLK_EFUSE 62 +#define SCLK_OTP 63 +#define SCLK_DDRCLK 64 +#define SCLK_VDEC_CABAC 65 +#define SCLK_VDEC_CORE 66 +#define SCLK_VENC_DSP 67 +#define SCLK_VENC_CORE 68 +#define SCLK_RGA 69 +#define SCLK_HDMI_SFC 70 +#define SCLK_HDMI_CEC 71 /* Unused ? */ +#define SCLK_USB3_REF 72 +#define SCLK_USB3_SUSPEND 73 +#define SCLK_SDMMC_DRV 74 +#define SCLK_SDIO_DRV 75 +#define SCLK_EMMC_DRV 76 +#define SCLK_SDMMC_EXT_DRV 77 +#define SCLK_SDMMC_SAMPLE 78 +#define SCLK_SDIO_SAMPLE 79 +#define SCLK_EMMC_SAMPLE 80 +#define SCLK_SDMMC_EXT_SAMPLE 81 +#define SCLK_VOP 82 #define SCLK_MAC2PHY_RXTX 83 #define SCLK_MAC2PHY_SRC 84 #define SCLK_MAC2PHY_REF 85 @@ -70,528 +128,553 @@ __FBSDID("$FreeBSD$"); #define SCLK_MAC2IO_REFOUT 89 #define SCLK_MAC2IO_REF 90 #define SCLK_MAC2IO_OUT 91 +#define SCLK_TSP 92 +#define SCLK_HSADC_TSP 93 +#define SCLK_USB3PHY_REF 94 +#define SCLK_REF_USB3OTG 95 #define SCLK_USB3OTG_REF 96 +#define SCLK_USB3OTG_SUSPEND 97 +#define SCLK_REF_USB3OTG_SRC 98 #define SCLK_MAC2IO_SRC 99 #define SCLK_MAC2IO 100 #define SCLK_MAC2PHY 101 #define SCLK_MAC2IO_EXT 102 + +/* DCLK */ +#define DCLK_LCDC 120 +#define DCLK_HDMIPHY 121 +#define HDMIPHY 122 +#define USB480M 123 +#define DCLK_LCDC_SRC 124 + +/* ACLK */ +#define ACLK_AXISRAM 130 /* Unused */ +#define ACLK_VOP_PRE 131 #define ACLK_USB3OTG 132 -#define ACLK_GMAC 146 -#define ACLK_MAC2PHY 149 -#define ACLK_MAC2IO 150 +#define ACLK_RGA_PRE 133 +#define ACLK_DMAC 134 /* Unused */ +#define ACLK_GPU 135 +#define ACLK_BUS_PRE 136 +#define ACLK_PERI_PRE 137 +#define ACLK_RKVDEC_PRE 138 +#define ACLK_RKVDEC 139 +#define ACLK_RKVENC 140 +#define ACLK_VPU_PRE 141 +#define ACLK_VIO_PRE 142 +#define ACLK_VPU 143 +#define ACLK_VIO 144 +#define ACLK_VOP 145 +#define ACLK_GMAC 146 +#define ACLK_H265 147 +#define ACLK_H264 148 +#define ACLK_MAC2PHY 149 +#define ACLK_MAC2IO 150 +#define ACLK_DCF 151 +#define ACLK_TSP 152 #define ACLK_PERI 153 +#define ACLK_RGA 154 +#define ACLK_IEP 155 +#define ACLK_CIF 156 +#define ACLK_HDCP 157 + +/* PCLK */ #define PCLK_GPIO0 200 #define PCLK_GPIO1 201 #define PCLK_GPIO2 202 #define PCLK_GPIO3 203 +#define PCLK_GRF 204 #define PCLK_I2C0 205 #define PCLK_I2C1 206 #define PCLK_I2C2 207 #define PCLK_I2C3 208 +#define PCLK_SPI 209 +#define PCLK_UART0 210 +#define PCLK_UART1 211 +#define PCLK_UART2 212 #define PCLK_TSADC 213 -#define PCLK_GMAC 220 -#define PCLK_MAC2PHY 222 -#define PCLK_MAC2IO 223 +#define PCLK_PWM 214 +#define PCLK_TIMER 215 +#define PCLK_BUS_PRE 216 +#define PCLK_PERI_PRE 217 /* Unused */ +#define PCLK_HDMI_CTRL 218 /* Unused */ +#define PCLK_HDMI_PHY 219 /* Unused */ +#define PCLK_GMAC 220 +#define PCLK_H265 221 +#define PCLK_MAC2PHY 222 +#define PCLK_MAC2IO 223 #define PCLK_USB3PHY_OTG 224 #define PCLK_USB3PHY_PIPE 225 #define PCLK_USB3_GRF 226 +#define PCLK_USB2_GRF 227 +#define PCLK_HDMIPHY 228 +#define PCLK_DDR 229 +#define PCLK_PERI 230 +#define PCLK_HDMI 231 +#define PCLK_HDCP 232 +#define PCLK_DCF 233 +#define PCLK_SARADC 234 #define PCLK_ACODECPHY 235 +#define PCLK_WDT 236 /* Controlled from the secure GRF */ + +/* HCLK */ +#define HCLK_PERI 308 +#define HCLK_TSP 309 +#define HCLK_GMAC 310 /* Unused */ #define HCLK_I2S0_8CH 311 #define HCLK_I2S1_8CH 312 #define HCLK_I2S2_2CH 313 +#define HCLK_SPDIF_8CH 314 +#define HCLK_VOP 315 +#define HCLK_NANDC 316 /* Unused */ #define HCLK_SDMMC 317 #define HCLK_SDIO 318 #define HCLK_EMMC 319 #define HCLK_SDMMC_EXT 320 +#define HCLK_RKVDEC_PRE 321 +#define HCLK_RKVDEC 322 +#define HCLK_RKVENC 323 +#define HCLK_VPU_PRE 324 +#define HCLK_VIO_PRE 325 +#define HCLK_VPU 326 +/* 327 doesn't exists */ +#define HCLK_BUS_PRE 328 +#define HCLK_PERI_PRE 329 /* Unused */ +#define HCLK_H264 330 +#define HCLK_CIF 331 +#define HCLK_OTG_PMU 332 +#define HCLK_OTG 333 +#define HCLK_HOST0 334 +#define HCLK_HOST0_ARB 335 +#define HCLK_CRYPTO_MST 336 +#define HCLK_CRYPTO_SLV 337 +#define HCLK_PDM 338 +#define HCLK_IEP 339 +#define HCLK_RGA 340 +#define HCLK_HDCP 341 static struct rk_cru_gate rk3328_gates[] = { /* CRU_CLKGATE_CON0 */ - CRU_GATE(0, "apll_core", "apll", 0x200, 0) - CRU_GATE(0, "dpll_core", "dpll", 0x200, 1) - CRU_GATE(0, "gpll_core", "gpll", 0x200, 2) - CRU_GATE(0, "npll_core", "npll", 0x200, 12) + CRU_GATE(0, "core_apll_clk", "apll", 0x200, 0) + CRU_GATE(0, "core_dpll_clk", "dpll", 0x200, 1) + CRU_GATE(0, "core_gpll_clk", "gpll", 0x200, 2) + /* Bit 3 bus_src_clk_en */ + /* Bit 4 clk_ddrphy_src_en */ + /* Bit 5 clk_ddrpd_src_en */ + /* Bit 6 clk_ddrmon_en */ + /* Bit 7-8 unused */ + /* Bit 9 testclk_en */ + CRU_GATE(SCLK_WIFI, "sclk_wifi", "sclk_wifi_c", 0x200, 10) + CRU_GATE(SCLK_RTC32K, "clk_rtc32k", "clk_rtc32k_c", 0x200, 11) + CRU_GATE(0, "core_npll_clk", "npll", 0x200, 12) + /* Bit 13-15 unused */ /* CRU_CLKGATE_CON1 */ + /* Bit 0 unused */ + CRU_GATE(0, "clk_i2s0_div", "clk_i2s0_div_c", 0x204, 1) + CRU_GATE(0, "clk_i2s0_frac", "clk_i2s0_frac_f", 0x204, 2) CRU_GATE(SCLK_I2S0, "clk_i2s0", "clk_i2s0_mux", 0x204, 3) + CRU_GATE(0, "clk_i2s1_div", "clk_i2s1_div_c", 0x204, 4) + CRU_GATE(0, "clk_i2s1_frac", "clk_i2s1_frac_f", 0x204, 5) CRU_GATE(SCLK_I2S1, "clk_i2s1", "clk_i2s1_mux", 0x204, 6) + CRU_GATE(0, "clk_i2s1_out", "clk_i2s1_mux", 0x204, 7) + CRU_GATE(0, "clk_i2s2_div", "clk_i2s2_div_c", 0x204, 8) + CRU_GATE(0, "clk_i2s2_frac", "clk_i2s2_frac_f", 0x204, 9) CRU_GATE(SCLK_I2S2, "clk_i2s2", "clk_i2s2_mux", 0x204, 10) + CRU_GATE(0, "clk_i2s2_out", "clk_i2s2_mux", 0x204, 11) + CRU_GATE(0, "clk_spdif_div", "clk_spdif_div_c", 0x204, 12) + CRU_GATE(0, "clk_spdif_frac", "clk_spdif_frac_f", 0x204, 13) + CRU_GATE(0, "clk_uart0_div", "clk_uart0_div_c", 0x204, 14) + CRU_GATE(0, "clk_uart0_frac", "clk_uart0_frac_f", 0x204, 15) + + /* CRU_CLKGATE_CON2 */ + CRU_GATE(0, "clk_uart1_div", "clk_uart1_div_c", 0x208, 0) + CRU_GATE(0, "clk_uart1_frac", "clk_uart1_frac_f", 0x208, 1) + CRU_GATE(0, "clk_uart2_div", "clk_uart2_div_c", 0x208, 2) + CRU_GATE(0, "clk_uart2_frac", "clk_uart2_frac_f", 0x208, 3) + CRU_GATE(SCLK_CRYPTO, "clk_crypto", "clk_crypto_c", 0x208, 4) + CRU_GATE(SCLK_TSP, "clk_tsp", "clk_tsp_c", 0x208, 5) + CRU_GATE(SCLK_TSADC, "clk_tsadc_src", "clk_tsadc_c", 0x208, 6) + CRU_GATE(SCLK_SPI, "clk_spi", "clk_spi_c", 0x208, 7) + CRU_GATE(SCLK_PWM, "clk_pwm", "clk_pwm_c", 0x208, 8) + CRU_GATE(SCLK_I2C0, "clk_i2c0_src", "clk_i2c0_c", 0x208, 9) + CRU_GATE(SCLK_I2C1, "clk_i2c1_src", "clk_i2c1_c", 0x208, 10) + CRU_GATE(SCLK_I2C2, "clk_i2c2_src", "clk_i2c2_c", 0x208, 11) + CRU_GATE(SCLK_I2C3, "clk_i2c3_src", "clk_i2c3_c", 0x208, 12) + CRU_GATE(SCLK_EFUSE, "clk_efuse", "clk_efuse_c", 0x208, 13) + CRU_GATE(SCLK_SARADC, "clk_saradc", "clk_saradc_c", 0x208, 14) + CRU_GATE(SCLK_PDM, "clk_pdm", "clk_pdm_c", 0x208, 15) + + /* CRU_CLKGATE_CON3 */ + CRU_GATE(SCLK_MAC2PHY_SRC, "clk_mac2phy_src", "clk_mac2phy_src_c", 0x20c, 0) + CRU_GATE(SCLK_MAC2IO_SRC, "clk_mac2io_src", "clk_mac2io_src_c", 0x20c, 1) + CRU_GATE(ACLK_GMAC, "aclk_gmac", "aclk_gmac_c", 0x20c, 2) + /* Bit 3 gmac_gpll_src_en Unused ? */ + /* Bit 4 gmac_vpll_src_en Unused ? */ + CRU_GATE(SCLK_MAC2IO_OUT, "clk_mac2io_out", "clk_mac2io_out_c", 0x20c, 5) + /* Bit 6-7 unused */ + CRU_GATE(SCLK_OTP, "clk_otp", "clk_otp_c", 0x20c, 8) + /* Bit 9-15 unused */ /* CRU_CLKGATE_CON4 */ - CRU_GATE(0, "gpll_peri", "gpll", 0x210, 0) - CRU_GATE(0, "cpll_peri", "cpll", 0x210, 1) - CRU_GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0x210, 7) + CRU_GATE(0, "periph_gclk_src", "gpll", 0x210, 0) + CRU_GATE(0, "periph_cclk_src", "cpll", 0x210, 1) + CRU_GATE(0, "hdmiphy_peri", "hdmiphy", 0x210, 2) + CRU_GATE(SCLK_SDMMC, "clk_mmc0_src", "clk_sdmmc_c", 0x210, 3) + CRU_GATE(SCLK_SDIO, "clk_sdio_src", "clk_sdio_c", 0x210, 4) + CRU_GATE(SCLK_EMMC, "clk_emmc_src", "clk_emmc_c", 0x210, 5) + CRU_GATE(SCLK_REF_USB3OTG_SRC, "clk_ref_usb3otg_src", "clk_ref_usb3otg_src_c", 0x210, 6) + CRU_GATE(SCLK_USB3OTG_REF, "clk_usb3_otg0_ref", "xin24m", 0x210, 7) + CRU_GATE(SCLK_USB3OTG_SUSPEND, "clk_usb3otg_suspend", "clk_usb3otg_suspend_c", 0x210, 8) + /* Bit 9 clk_usb3phy_ref_25m_en */ + CRU_GATE(SCLK_SDMMC_EXT, "clk_sdmmc_ext", "clk_sdmmc_ext_c", 0x210, 10) + /* Bit 11-15 unused */ + + /* CRU_CLKGATE_CON5 */ + CRU_GATE(ACLK_RGA_PRE, "aclk_rga_pre", "aclk_rga_pre_c", 0x214, 0) + CRU_GATE(SCLK_RGA, "sclk_rga", "sclk_rga_c", 0x214, 0) + CRU_GATE(ACLK_VIO_PRE, "aclk_vio_pre", "aclk_vio_pre_c", 0x214, 2) + CRU_GATE(SCLK_CIF_OUT, "clk_cif_src", "clk_cif_src_c", 0x214, 3) + CRU_GATE(SCLK_HDMI_SFC, "clk_hdmi_sfc", "xin24m", 0x214, 4) + CRU_GATE(ACLK_VOP_PRE, "aclk_vop_pre", "aclk_vop_pre_c", 0x214, 5) + CRU_GATE(DCLK_LCDC_SRC, "vop_dclk_src", "vop_dclk_src_c", 0x214, 6) + /* Bit 7-15 unused */ + + /* CRU_CLKGATE_CON6 */ + CRU_GATE(ACLK_RKVDEC_PRE, "aclk_rkvdec_pre", "aclk_rkvdec_c", 0x218, 0) + CRU_GATE(SCLK_VDEC_CABAC, "sclk_cabac", "sclk_cabac_c", 0x218, 1) + CRU_GATE(SCLK_VDEC_CORE, "sclk_vdec_core", "sclk_vdec_core_c", 0x218, 2) + CRU_GATE(ACLK_RKVENC, "aclk_rkvenc", "aclk_rkvenc_c", 0x218, 3) + CRU_GATE(SCLK_VENC_CORE, "sclk_venc", "sclk_venc_c", 0x218, 4) + CRU_GATE(ACLK_VPU_PRE, "aclk_vpu_pre", "aclk_vpu_pre_c", 0x218, 5) + CRU_GATE(0, "aclk_gpu_pre", "aclk_gpu_pre_c", 0x218, 6) + CRU_GATE(SCLK_VENC_DSP, "sclk_venc_dsp", "sclk_venc_dsp_c", 0x218, 7) + /* Bit 8-15 unused */ + + /* CRU_CLKGATE_CON7 */ + /* Bit 0 aclk_core_en */ + /* Bit 1 clk_core_periph_en */ + /* Bit 2 clk_jtag_en */ + /* Bit 3 unused */ + /* Bit 4 pclk_ddr_en */ + /* Bit 5-15 unused */ /* CRU_CLKGATE_CON8 */ + CRU_GATE(ACLK_BUS_PRE, "aclk_bus_pre", "aclk_bus_pre_c", 0x220, 0) + CRU_GATE(HCLK_BUS_PRE, "hclk_bus_pre", "hclk_bus_pre_c", 0x220, 1) + CRU_GATE(PCLK_BUS_PRE, "pclk_bus_pre", "pclk_bus_pre_c", 0x220, 2) CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3) - CRU_GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0x220, 4) + CRU_GATE(0, "pclk_phy", "pclk_bus_pre", 0x220, 4) + CRU_GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0x220, 5) + CRU_GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 0x220, 6) + CRU_GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 0x220, 7) + CRU_GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 0x220, 8) + CRU_GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 0x220, 9) + CRU_GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 0x220, 10) + /* Bit 11-15 unused */ - /* CRU_CLKGATE_CON8 */ - CRU_GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0x224, 7) - CRU_GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0x224, 6) - CRU_GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0x224, 5) - CRU_GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0x224, 4) - CRU_GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0x224, 3) - CRU_GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0x224, 1) + /* CRU_CLKGATE_CON9 */ + CRU_GATE(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0x224, 0) + CRU_GATE(SCLK_MAC2PHY_RXTX, "clk_gmac2phy_rx", "clk_mac2phy", 0x224, 1) + CRU_GATE(SCLK_MAC2PHY_OUT, "clk_mac2phy_out", "clk_mac2phy_out_c", 0x224, 2) + CRU_GATE(SCLK_MAC2PHY_REF, "clk_gmac2phy_ref", "clk_mac2phy", 0x224, 3) + CRU_GATE(SCLK_MAC2IO_RX, "clk_gmac2io_rx", "clk_mac2io", 0x224, 4) + CRU_GATE(SCLK_MAC2IO_TX, "clk_gmac2io_tx", "clk_mac2io", 0x224, 5) + CRU_GATE(SCLK_MAC2IO_REFOUT, "clk_gmac2io_refout", "clk_mac2io", 0x224, 6) + CRU_GATE(SCLK_MAC2IO_REF, "clk_gmac2io_ref", "clk_mac2io", 0x224, 7) + /* Bit 8-15 unused */ /* CRU_CLKGATE_CON10 */ CRU_GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", 0x228, 0) + CRU_GATE(HCLK_PERI, "hclk_peri", "hclk_peri_c", 0x228, 1) + CRU_GATE(PCLK_PERI, "pclk_peri", "pclk_peri_c", 0x228, 2) + /* Bit 3-15 unused */ + + /* CRU_CLKGATE_CON11 */ + CRU_GATE(HCLK_RKVDEC_PRE, "hclk_rkvdec_pre", "aclk_rkvdec_pre", 0x22C, 0) + /* Bit 1-3 unused */ + CRU_GATE(HCLK_RKVENC, "hclk_rkvenc", "aclk_rkvenc", 0x22C, 4) + /* Bit 5-7 unused */ + CRU_GATE(HCLK_VPU_PRE, "hclk_vpu_pre", "aclk_vpu_pre", 0x22C, 8) + /* Bit 9-15 unused */ + + /* CRU_CLKGATE_CON12 */ + /* unused */ + + /* CRU_CLKGATE_CON13 */ + /* Bit 0 aclk_core_niu_en */ + /* Bit 1 aclk_gic400_en */ + /* Bit 2-15 unused */ + + /* CRU_CLKGATE_CON14 */ + CRU_GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0x238, 0) + CRU_GATE(0, "aclk_gpu_niu", "aclk_gpu_pre", 0x238, 1) + /* Bit 2-15 unused */ /* CRU_CLKGATE_CON15*/ + /* Bit 0 aclk_intmem_en Unused */ + /* Bit 1 aclk_dmac_bus_en Unused */ + /* Bit 2 hclk_rom_en Unused */ CRU_GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_bus_pre", 0x23C, 3) CRU_GATE(HCLK_I2S1_8CH, "hclk_i2s1_8ch", "hclk_bus_pre", 0x23C, 4) CRU_GATE(HCLK_I2S2_2CH, "hclk_i2s2_2ch", "hclk_bus_pre", 0x23C, 5) + CRU_GATE(HCLK_SPDIF_8CH, "hclk_spdif_8ch", "hclk_bus_pre", 0x23C, 6) + CRU_GATE(HCLK_CRYPTO_MST, "hclk_crypto_mst", "hclk_bus_pre", 0x23C, 7) + CRU_GATE(HCLK_CRYPTO_SLV, "hclk_crypto_slv", "hclk_bus_pre", 0x23C, 8) + CRU_GATE(0, "pclk_efuse", "pclk_bus", 0x23C, 9) CRU_GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0x23C, 10) + CRU_GATE(ACLK_DCF, "aclk_dcf", "aclk_bus_pre", 0x23C, 11) + CRU_GATE(0, "aclk_bus_niu", "aclk_bus_pre", 0x23C, 12) + CRU_GATE(0, "hclk_bus_niu", "hclk_bus_pre", 0x23C, 13) + CRU_GATE(0, "pclk_bus_niu", "pclk_bus_pre", 0x23C, 14) + CRU_GATE(0, "pclk_phy_niu", "pclk_phy", 0x23C, 14) + /* Bit 15 pclk_phy_niu_en */ /* CRU_CLKGATE_CON16 */ - CRU_GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0x23C, 0) - CRU_GATE(PCLK_I2C2, "pclk_i2c2", "pclk_bus", 0x23C, 1) - CRU_GATE(PCLK_I2C3, "pclk_i2c3", "pclk_bus", 0x23C, 2) - CRU_GATE(PCLK_TSADC, "pclk_tsadc", "pclk_bus", 0x23C, 14) - + CRU_GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0x240, 0) + CRU_GATE(PCLK_I2C2, "pclk_i2c2", "pclk_bus", 0x240, 1) + CRU_GATE(PCLK_I2C3, "pclk_i2c3", "pclk_bus", 0x240, 2) + CRU_GATE(PCLK_TIMER, "pclk_timer0", "pclk_bus", 0x240, 3) + CRU_GATE(0, "pclk_stimer", "pclk_bus", 0x240, 4) + CRU_GATE(PCLK_SPI, "pclk_spi", "pclk_bus", 0x240, 5) + CRU_GATE(PCLK_PWM, "pclk_pwm", "pclk_bus", 0x240, 6) CRU_GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_bus", 0x240, 7) CRU_GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_bus", 0x240, 8) CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0x240, 9) CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0x240, 10) + CRU_GATE(PCLK_UART0, "pclk_uart0", "pclk_bus", 0x240, 11) + CRU_GATE(PCLK_UART1, "pclk_uart1", "pclk_bus", 0x240, 12) + CRU_GATE(PCLK_UART2, "pclk_uart2", "pclk_bus", 0x240, 13) + CRU_GATE(PCLK_TSADC, "pclk_tsadc", "pclk_bus", 0x240, 14) + CRU_GATE(PCLK_DCF, "pclk_dcf", "pclk_bus", 0x240, 15) /* CRU_CLKGATE_CON17 */ - CRU_GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", 0x244, 2) - CRU_GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy_pre", 0x244, 5) + CRU_GATE(PCLK_GRF, "pclk_grf", "pclk_bus", 0x244, 0) + /* Bit 1 unused */ + CRU_GATE(PCLK_USB3_GRF, "pclk_usb3grf", "pclk_phy", 0x244, 2) + CRU_GATE(0, "pclk_ddrphy", "pclk_phy", 0x244, 3) + CRU_GATE(0, "pclk_cru", "pclk_bus", 0x244, 4) + CRU_GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy", 0x244, 5) + CRU_GATE(0, "pclk_sgrf", "pclk_bus", 0x244, 6) + CRU_GATE(PCLK_HDMIPHY, "pclk_hdmiphy", "pclk_phy", 0x244, 7) + CRU_GATE(0, "pclk_vdacphy", "pclk_bus", 0x244, 8) + /* Bit 9 unused */ + CRU_GATE(0, "pclk_sim", "pclk_bus", 0x244, 10) + CRU_GATE(HCLK_TSP, "hclk_tsp", "hclk_bus_pre", 0x244, 11) + CRU_GATE(ACLK_TSP, "aclk_tsp", "aclk_bus_pre", 0x244, 12) + /* Bit 13 clk_hsadc_0_tsp_en Depend on a gpio clock ? */ + CRU_GATE(PCLK_USB2_GRF, "pclk_usb2grf", "pclk_phy", 0x244, 14) + CRU_GATE(PCLK_SARADC, "pclk_saradc", "pclk_bus", 0x244, 15) + + /* CRU_CLKGATE_CON18 */ + /* Bit 0 unused */ + /* Bit 1 pclk_ddr_upctl_en */ + /* Bit 2 pclk_ddr_msch_en */ + /* Bit 3 pclk_ddr_mon_en */ + /* Bit 4 aclk_ddr_upctl_en */ + /* Bit 5 clk_ddr_upctl_en */ + /* Bit 6 clk_ddr_msch_en */ + /* Bit 7 pclk_ddrstdby_en */ + /* Bit 8-15 unused */ /* CRU_CLKGATE_CON19 */ CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0x24C, 0) CRU_GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0x24C, 1) CRU_GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0x24C, 2) + /* Bit 3-5 unused */ + CRU_GATE(HCLK_HOST0, "hclk_host0", "hclk_peri", 0x24C, 6) + CRU_GATE(HCLK_HOST0_ARB, "hclk_host0_arg", "hclk_peri", 0x24C, 7) + CRU_GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0x24C, 8) + CRU_GATE(HCLK_OTG_PMU, "hclk_otg_pmu", "hclk_peri", 0x24C, 9) + /* Bit 10 unused */ + CRU_GATE(0, "aclk_peri_niu", "aclk_peri", 0x24C, 11) CRU_GATE(0, "hclk_peri_niu", "hclk_peri", 0x24C, 12) CRU_GATE(0, "pclk_peri_niu", "hclk_peri", 0x24C, 13) CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14) CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15) + /* CRU_CLKGATE_CON20 */ + /* unused */ + + /* CRU_CLKGATE_CON21 */ + /* Bit 0-1 unused */ + CRU_GATE(ACLK_VOP, "aclk_vop", "aclk_vop_pre", 0x254, 2) + CRU_GATE(HCLK_VOP, "hclk_vop", "hclk_vio_pre", 0x254, 3) + CRU_GATE(0, "aclk_vop_niu", "aclk_vop_pre", 0x254, 4) + CRU_GATE(0, "hclk_vop_niu", "hclk_vio_pre", 0x254, 5) + CRU_GATE(ACLK_IEP, "aclk_iep", "aclk_vio_pre", 0x254, 6) + CRU_GATE(HCLK_IEP, "hclk_iep", "hclk_vio_pre", 0x254, 7) + CRU_GATE(ACLK_CIF, "aclk_cif", "aclk_vio_pre", 0x254, 8) + CRU_GATE(HCLK_CIF, "hclk_cif", "hclk_vio_pre", 0x254, 9) + CRU_GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0x254, 10) + CRU_GATE(HCLK_RGA, "hclk_rga", "hclk_vio_pre", 0x254, 11) + CRU_GATE(0, "hclk_ahb1tom", "hclk_vio_pre", 0x254, 12) + CRU_GATE(0, "pclk_vio_h2p", "hclk_vio_pre", 0x254, 13) + CRU_GATE(0, "hclk_vio_h2p", "hclk_vio_pre", 0x254, 14) + CRU_GATE(ACLK_HDCP, "aclk_hdcp", "aclk_vio_pre", 0x254, 15) + + /* CRU_CLKGATE_CON22 */ + CRU_GATE(HCLK_HDCP, "hclk_hdcp", "hclk_vio_pre", 0x258, 0) + CRU_GATE(0, "hclk_vio_niu", "hclk_vio_pre", 0x258, 1) + CRU_GATE(0, "aclk_vio_niu", "aclk_vio_pre", 0x258, 2) + CRU_GATE(0, "aclk_rga_niu", "aclk_rga_pre", 0x258, 3) + CRU_GATE(PCLK_HDMI, "pclk_hdmi", "hclk_vio_pre", 0x258, 4) + CRU_GATE(PCLK_HDCP, "pclk_hdcp", "hclk_vio_pre", 0x258, 5) + /* Bit 6-15 unused */ + + /* CRU_CLKGATE_CON23 */ + CRU_GATE(ACLK_VPU, "aclk_vpu", "aclk_vpu_pre", 0x25C, 0) + CRU_GATE(HCLK_VPU, "hclk_vpu", "hclk_vpu_pre", 0x25C, 1) + CRU_GATE(0, "aclk_vpu_niu", "aclk_vpu_pre", 0x25C, 2) + CRU_GATE(0, "hclk_vpu_niu", "hclk_vpu_pre", 0x25C, 3) + /* Bit 4-15 unused */ + + /* CRU_CLKGATE_CON24 */ + CRU_GATE(ACLK_RKVDEC, "aclk_rkvdec", "aclk_rkvdec_pre", 0x260, 0) + CRU_GATE(HCLK_RKVDEC, "hclk_rkvdec", "hclk_rkvdec_pre", 0x260, 1) + CRU_GATE(0, "aclk_rkvdec_niu", "aclk_rkvdec_pre", 0x260, 2) + CRU_GATE(0, "hclk_rkvdec_niu", "hclk_rkvdec_pre", 0x260, 3) + /* Bit 4-15 unused */ + + /* CRU_CLKGATE_CON25 */ + CRU_GATE(0, "aclk_rkvenc_niu", "aclk_rkvenc", 0x264, 0) + CRU_GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", 0x264, 1) + CRU_GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0x264, 2) + CRU_GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0x264, 3) + CRU_GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0x264, 4) + CRU_GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0x264, 5) + CRU_GATE(0, "aclk_axisram", "hclk_rkvenc", 0x264, 6) + /* Bit 7-15 unused */ + /* CRU_CLKGATE_CON26 */ - CRU_GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0x268, 0) - CRU_GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0x268, 1) - CRU_GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0x268, 2) - CRU_GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0x268, 3) + CRU_GATE(ACLK_MAC2PHY, "aclk_gmac2phy", "aclk_gmac", 0x268, 0) + CRU_GATE(PCLK_MAC2PHY, "pclk_gmac2phy", "pclk_gmac", 0x268, 1) + CRU_GATE(ACLK_MAC2IO, "aclk_gmac2io", "aclk_gmac", 0x268, 2) + CRU_GATE(PCLK_MAC2IO, "pclk_gmac2io", "pclk_gmac", 0x268, 3) + CRU_GATE(0, "aclk_gmac_niu", "aclk_gmac", 0x268, 4) + CRU_GATE(0, "pclk_gmac_niu", "pclk_gmac", 0x268, 5) + /* Bit 6-15 unused */ + + /* CRU_CLKGATE_CON27 */ + /* Bit 0 clk_ddrphy_en */ + /* Bit 1 clk4x_ddrphy_en */ /* CRU_CLKGATE_CON28 */ - CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1) - CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 2) + CRU_GATE(HCLK_PDM, "hclk_pdm", "hclk_bus_pre", 0x270, 0) + CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy", 0x270, 1) + CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy", 0x270, 2) + CRU_GATE(0, "pclk_pmu", "pclk_bus", 0x270, 3) + CRU_GATE(0, "pclk_otp", "pclk_bus", 0x270, 4) + /* Bit 5-15 unused */ }; /* * PLLs */ -#define PLL_APLL 1 -#define PLL_DPLL 2 -#define PLL_CPLL 3 -#define PLL_GPLL 4 -#define PLL_NPLL 5 +#define PLL_RATE(_hz, _ref, _fb, _post1, _post2, _dspd, _frac) \ +{ \ + .freq = _hz, \ + .refdiv = _ref, \ + .fbdiv = _fb, \ + .postdiv1 = _post1, \ + .postdiv2 = _post2, \ + .dsmpd = _dspd, \ + .frac = _frac, \ +} static struct rk_clk_pll_rate rk3328_pll_rates[] = { - { - .freq = 1608000000, - .refdiv = 1, - .fbdiv = 67, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1584000000, - .refdiv = 1, - .fbdiv = 66, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1560000000, - .refdiv = 1, - .fbdiv = 65, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1536000000, - .refdiv = 1, - .fbdiv = 64, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1512000000, - .refdiv = 1, - .fbdiv = 63, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1488000000, - .refdiv = 1, - .fbdiv = 62, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1464000000, - .refdiv = 1, - .fbdiv = 61, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1440000000, - .refdiv = 1, - .fbdiv = 60, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1416000000, - .refdiv = 1, - .fbdiv = 59, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1392000000, - .refdiv = 1, - .fbdiv = 58, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1368000000, - .refdiv = 1, - .fbdiv = 57, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1344000000, - .refdiv = 1, - .fbdiv = 56, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1320000000, - .refdiv = 1, - .fbdiv = 55, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1296000000, - .refdiv = 1, - .fbdiv = 54, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1272000000, - .refdiv = 1, - .fbdiv = 53, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1248000000, - .refdiv = 1, - .fbdiv = 52, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1200000000, - .refdiv = 1, - .fbdiv = 50, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1188000000, - .refdiv = 2, - .fbdiv = 99, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1104000000, - .refdiv = 1, - .fbdiv = 46, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1100000000, - .refdiv = 12, - .fbdiv = 550, - .postdiv1 = 1, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1008000000, - .refdiv = 1, - .fbdiv = 84, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 1000000000, - .refdiv = 6, - .fbdiv = 500, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 984000000, - .refdiv = 1, - .fbdiv = 82, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 960000000, - .refdiv = 1, - .fbdiv = 80, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 936000000, - .refdiv = 1, - .fbdiv = 78, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 912000000, - .refdiv = 1, - .fbdiv = 76, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 900000000, - .refdiv = 4, - .fbdiv = 300, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 888000000, - .refdiv = 1, - .fbdiv = 74, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 864000000, - .refdiv = 1, - .fbdiv = 72, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 840000000, - .refdiv = 1, - .fbdiv = 70, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 816000000, - .refdiv = 1, - .fbdiv = 68, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 800000000, - .refdiv = 6, - .fbdiv = 400, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 700000000, - .refdiv = 6, - .fbdiv = 350, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 696000000, - .refdiv = 1, - .fbdiv = 58, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 600000000, - .refdiv = 1, - .fbdiv = 75, - .postdiv1 = 3, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 594000000, - .refdiv = 2, - .fbdiv = 99, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 504000000, - .refdiv = 1, - .fbdiv = 63, - .postdiv1 = 3, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 500000000, - .refdiv = 6, - .fbdiv = 250, - .postdiv1 = 2, - .postdiv2 = 1, - .dsmpd = 1, - }, - { - .freq = 408000000, - .refdiv = 1, - .fbdiv = 68, - .postdiv1 = 2, - .postdiv2 = 2, - .dsmpd = 1, - }, - { - .freq = 312000000, - .refdiv = 1, - .fbdiv = 52, - .postdiv1 = 2, - .postdiv2 = 2, - .dsmpd = 1, - }, - { - .freq = 216000000, - .refdiv = 1, - .fbdiv = 72, - .postdiv1 = 4, - .postdiv2 = 2, - .dsmpd = 1, - }, - { - .freq = 96000000, - .refdiv = 1, - .fbdiv = 64, - .postdiv1 = 4, - .postdiv2 = 4, - .dsmpd = 1, - }, + /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ + PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0), + PLL_RATE(1584000000, 1, 66, 1, 1, 1, 0), + PLL_RATE(1560000000, 1, 65, 1, 1, 1, 0), + PLL_RATE(1536000000, 1, 64, 1, 1, 1, 0), + PLL_RATE(1512000000, 1, 63, 1, 1, 1, 0), + PLL_RATE(1488000000, 1, 62, 1, 1, 1, 0), + PLL_RATE(1464000000, 1, 61, 1, 1, 1, 0), + PLL_RATE(1440000000, 1, 60, 1, 1, 1, 0), + PLL_RATE(1416000000, 1, 59, 1, 1, 1, 0), + PLL_RATE(1392000000, 1, 58, 1, 1, 1, 0), + PLL_RATE(1368000000, 1, 57, 1, 1, 1, 0), + PLL_RATE(1344000000, 1, 56, 1, 1, 1, 0), + PLL_RATE(1320000000, 1, 55, 1, 1, 1, 0), + PLL_RATE(1296000000, 1, 54, 1, 1, 1, 0), + PLL_RATE(1272000000, 1, 53, 1, 1, 1, 0), + PLL_RATE(1248000000, 1, 52, 1, 1, 1, 0), + PLL_RATE(1200000000, 1, 50, 1, 1, 1, 0), + PLL_RATE(1188000000, 2, 99, 1, 1, 1, 0), + PLL_RATE(1104000000, 1, 46, 1, 1, 1, 0), + PLL_RATE(1100000000, 12, 550, 1, 1, 1, 0), + PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0), + PLL_RATE(1000000000, 6, 500, 2, 1, 1, 0), + PLL_RATE(984000000, 1, 82, 2, 1, 1, 0), + PLL_RATE(960000000, 1, 80, 2, 1, 1, 0), + PLL_RATE(936000000, 1, 78, 2, 1, 1, 0), + PLL_RATE(912000000, 1, 76, 2, 1, 1, 0), + PLL_RATE(900000000, 4, 300, 2, 1, 1, 0), + PLL_RATE(888000000, 1, 74, 2, 1, 1, 0), + PLL_RATE(864000000, 1, 72, 2, 1, 1, 0), + PLL_RATE(840000000, 1, 70, 2, 1, 1, 0), + PLL_RATE(816000000, 1, 68, 2, 1, 1, 0), + PLL_RATE(800000000, 6, 400, 2, 1, 1, 0), + PLL_RATE(700000000, 6, 350, 2, 1, 1, 0), + PLL_RATE(696000000, 1, 58, 2, 1, 1, 0), + PLL_RATE(600000000, 1, 75, 3, 1, 1, 0), + PLL_RATE(594000000, 2, 99, 2, 1, 1, 0), *** 1373 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Sep 15 17:11:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5795266AD9B; Wed, 15 Sep 2021 17:11:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8mvb1xNQz3q5R; Wed, 15 Sep 2021 17:11:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 230B511E42; Wed, 15 Sep 2021 17:11:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FHB77Q075915; Wed, 15 Sep 2021 17:11:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FHB7Mo075914; Wed, 15 Sep 2021 17:11:07 GMT (envelope-from git) Date: Wed, 15 Sep 2021 17:11:07 GMT Message-Id: <202109151711.18FHB7Mo075914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 548a706608d7 - main - arm64: rockchip: rk3328: Add watchdog clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 548a706608d7291a72ed37e6c400654ee1ceadef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 17:11:07 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=548a706608d7291a72ed37e6c400654ee1ceadef commit 548a706608d7291a72ed37e6c400654ee1ceadef Author: Emmanuel Vadot AuthorDate: 2021-09-15 17:09:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-15 17:09:56 +0000 arm64: rockchip: rk3328: Add watchdog clock The watchdog clock is controlled by the secure world but we need a clock to sastify the driver so add a fixed clock for it. Reported by: avg --- sys/arm64/rockchip/clk/rk3328_cru.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/arm64/rockchip/clk/rk3328_cru.c b/sys/arm64/rockchip/clk/rk3328_cru.c index 344bf3bcd7aa..63c8797f6b44 100644 --- a/sys/arm64/rockchip/clk/rk3328_cru.c +++ b/sys/arm64/rockchip/clk/rk3328_cru.c @@ -1064,6 +1064,11 @@ static struct rk_clk rk3328_clks[] = { /* GRF_MAC_CON2 */ MUXGRF(SCLK_MAC2PHY, "clk_mac2phy", mux_mac2phy_p, 0, RK3328_GRF_MAC_CON2, 10, 1), + + /* + * This clock is controlled in the secure world + */ + FFACT(PCLK_WDT, "pclk_wdt", "pclk_bus", 1, 1), }; static int From owner-dev-commits-src-main@freebsd.org Wed Sep 15 17:32:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63D0266AEA6; Wed, 15 Sep 2021 17:32:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8nN92MLJz4Qy1; Wed, 15 Sep 2021 17:32:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 96E0826970; Wed, 15 Sep 2021 17:32:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: Alan Somers Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> From: John Baldwin Message-ID: <0cec1c04-0b42-6297-37c5-43d1dcb0f8d5@FreeBSD.org> Date: Wed, 15 Sep 2021 10:32:23 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 17:32:25 -0000 On 9/15/21 8:47 AM, Alan Somers wrote: > On Wed, Sep 15, 2021 at 9:21 AM John Baldwin wrote: > >> On 9/14/21 1:53 PM, Alan Somers wrote: >>> On Tue, Sep 14, 2021 at 2:46 PM John Baldwin wrote: >>> >>>> The branch main has been updated by jhb: >>>> >>>> URL: >>>> >> https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e >>>> >>>> commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e >>>> Author: John Baldwin >>>> AuthorDate: 2021-09-14 20:46:14 +0000 >>>> Commit: John Baldwin >>>> CommitDate: 2021-09-14 20:46:14 +0000 >>>> >>>> cxgbe tom: Don't queue AIO requests on listen sockets. >>>> >>>> This is similar to the fixes in 141fe2dceeae. One difference is >> that >>>> TOE sockets do not change states (listen vs non-listen) once >> created, >>>> so no lock is needed for SOLISTENING(). >>>> >>>> Sponsored by: Chelsio Communications >>>> >>> >>> I've always wondered: what's the point to using AIO with sockets? Can't >>> everything socket-related be done better with non-blocking read/write and >>> kqueue? >> >> Zero-copy operation with TOE is why TOE uses AIO. Zero-copy of user >> buffers >> can't really work with the non-AIO APIs because the user buffer is free to >> be reused immediately after write(2) (and on the read side you don't know >> the buffer in advance to allow the NIC to write directly into the use >> buffer). >> >> In theory we could support zero-copy using mb_ext_pgs for aio_write() for >> the non-TOE case similar to what sendfile() does. >> >> -- >> John Baldwin >> > > Interesting. Do you know of any common applications that include this > optimization? I've been working on the AIO ecosystem for Rust. It would > be good to ensure that this use case works, especially if zero-copy ever > works for non-TOE. I do not, and I rely on patches I merged upstream to netperf (-a and -A flags) to test it. I believe there might be some proprietary bits in some FreeBSD downstreams that might make use of this. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Wed Sep 15 18:05:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C011066B8E8; Wed, 15 Sep 2021 18:05:37 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8p6T4tDVz4Zlc; Wed, 15 Sep 2021 18:05:37 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f46.google.com with SMTP id c19-20020a9d6153000000b0051829acbfc7so4695370otk.9; Wed, 15 Sep 2021 11:05:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Rhv3BGY+iQs7Qdr6kHU4pe9RrH2U5GQzNe4ywNrGZeA=; b=xIe6Vaf11N6Tpd6ck4dAlrGHHVfUD5Bcryoy+wW8vR266ka+unfXXzY2n+fFmIUsbJ g2Mm7Ot1b3YQmvjiBwaLdQKKQFThQMpcSF07IKA7TSEA2bGnCEpkxOLf8khQpK5didPB rP7TdDQ5OPK05LSLCcrJ7FiSc2znk2a1quuVfD4Zh37wI9uJfQIaKzV3/ErsQtkoZqS1 IbY3V4yet+Iw24qbv8+in1wYGYUv0jC1/HKl1z2Ub3p55RmqigXbZtibM0/tYozbVCQH SBEioEkxH0JBJRznjvB3UF+iNnzq8h8wSRlN48vaEorEG6Rj2pnuw1vBsw/zcm2tJ4LK vZ/A== X-Gm-Message-State: AOAM532ZDWTlKLda2n1MiG2zBYHPfa3GlEjtYe4pu6mx1lR4XeC0QhFB T6Rdimz/nOQcNUSyxvAbw4ghQbaL1nHmWlwC9FIHKLy9k5Q= X-Google-Smtp-Source: ABdhPJxbl642Pxm4oeR/MJkGybc5ZoyI1DuO3xtzbdHoLq7DgvnefwJAQDNwFZ9MR7s1DYmmj2FhXdGLPWaSzca3dps= X-Received: by 2002:a9d:7159:: with SMTP id y25mr1100127otj.371.1631729130789; Wed, 15 Sep 2021 11:05:30 -0700 (PDT) MIME-Version: 1.0 References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> <0cec1c04-0b42-6297-37c5-43d1dcb0f8d5@FreeBSD.org> In-Reply-To: <0cec1c04-0b42-6297-37c5-43d1dcb0f8d5@FreeBSD.org> From: Alan Somers Date: Wed, 15 Sep 2021 12:05:19 -0600 Message-ID: Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: John Baldwin Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4H8p6T4tDVz4Zlc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 18:05:37 -0000 On Wed, Sep 15, 2021 at 11:32 AM John Baldwin wrote: > On 9/15/21 8:47 AM, Alan Somers wrote: > > On Wed, Sep 15, 2021 at 9:21 AM John Baldwin wrote: > > > >> On 9/14/21 1:53 PM, Alan Somers wrote: > >>> On Tue, Sep 14, 2021 at 2:46 PM John Baldwin wrote: > >>> > >>>> The branch main has been updated by jhb: > >>>> > >>>> URL: > >>>> > >> > https://cgit.FreeBSD.org/src/commit/?id=1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > >>>> > >>>> commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > >>>> Author: John Baldwin > >>>> AuthorDate: 2021-09-14 20:46:14 +0000 > >>>> Commit: John Baldwin > >>>> CommitDate: 2021-09-14 20:46:14 +0000 > >>>> > >>>> cxgbe tom: Don't queue AIO requests on listen sockets. > >>>> > >>>> This is similar to the fixes in 141fe2dceeae. One difference is > >> that > >>>> TOE sockets do not change states (listen vs non-listen) once > >> created, > >>>> so no lock is needed for SOLISTENING(). > >>>> > >>>> Sponsored by: Chelsio Communications > >>>> > >>> > >>> I've always wondered: what's the point to using AIO with sockets? > Can't > >>> everything socket-related be done better with non-blocking read/write > and > >>> kqueue? > >> > >> Zero-copy operation with TOE is why TOE uses AIO. Zero-copy of user > >> buffers > >> can't really work with the non-AIO APIs because the user buffer is free > to > >> be reused immediately after write(2) (and on the read side you don't > know > >> the buffer in advance to allow the NIC to write directly into the use > >> buffer). > >> > >> In theory we could support zero-copy using mb_ext_pgs for aio_write() > for > >> the non-TOE case similar to what sendfile() does. > >> > >> -- > >> John Baldwin > >> > > > > Interesting. Do you know of any common applications that include this > > optimization? I've been working on the AIO ecosystem for Rust. It would > > be good to ensure that this use case works, especially if zero-copy ever > > works for non-TOE. > > I do not, and I rely on patches I merged upstream to netperf (-a and -A > flags) > to test it. I believe there might be some proprietary bits in some FreeBSD > downstreams that might make use of this. > > -- > John Baldwin > Do you mean these -a and -A flags, or am I looking in the wrong place? -a sizespec Alter the send and receive buffer alignments on the local system. This defaults to 8 bytes. -A sizespec As -a, but for the remote system. From owner-dev-commits-src-main@freebsd.org Wed Sep 15 18:11:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD37A66B922; Wed, 15 Sep 2021 18:11:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8pF65TY9z4c0q; Wed, 15 Sep 2021 18:11:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CBED12D0B; Wed, 15 Sep 2021 18:11:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FIBMqe058303; Wed, 15 Sep 2021 18:11:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FIBMps058298; Wed, 15 Sep 2021 18:11:22 GMT (envelope-from git) Date: Wed, 15 Sep 2021 18:11:22 GMT Message-Id: <202109151811.18FIBMps058298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 78bf40e10c5a - main - arm: rockchip: rk3288: Use the macros that already exists in rk_cru.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78bf40e10c5a1504ba364abc068893de431263d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 18:11:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=78bf40e10c5a1504ba364abc068893de431263d4 commit 78bf40e10c5a1504ba364abc068893de431263d4 Author: Emmanuel Vadot AuthorDate: 2021-09-15 18:10:42 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-15 18:10:42 +0000 arm: rockchip: rk3288: Use the macros that already exists in rk_cru.h --- sys/arm64/rockchip/clk/rk3288_cru.c | 103 +----------------------------------- 1 file changed, 2 insertions(+), 101 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk3288_cru.c b/sys/arm64/rockchip/clk/rk3288_cru.c index 6a8c63137df7..3f4a59864545 100644 --- a/sys/arm64/rockchip/clk/rk3288_cru.c +++ b/sys/arm64/rockchip/clk/rk3288_cru.c @@ -491,36 +491,6 @@ static struct rk_clk_armclk_rates rk3288_armclk_rates[] = { { 126000000, 1}, }; - -/* Fixed rate clock. */ -#define FRATE(_id, _name, _freq) \ -{ \ - .type = RK_CLK_FIXED, \ - .clk.fixed = &(struct clk_fixed_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = NULL, \ - .clkdef.parent_cnt = 0, \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .freq = _freq, \ - }, \ -} - -/* Fixed rate multipier/divider. */ -#define FACT(_id, _name, _pname, _mult, _div) \ -{ \ - .type = RK_CLK_FIXED, \ - .clk.fixed = &(struct clk_fixed_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = (const char *[]){_pname}, \ - .clkdef.parent_cnt = 1, \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .mult = _mult, \ - .div = _div, \ - }, \ -} - /* Standard PLL. */ #define PLL(_id, _name, _base, _shift) \ { \ @@ -538,23 +508,6 @@ static struct rk_clk_armclk_rates rk3288_armclk_rates[] = { }, \ } -/* Multiplexer. */ -#define MUX(_id, _name, _pn, _f, _mo, _ms, _mw) \ -{ \ - .type = RK_CLK_MUX, \ - .clk.mux = &(struct rk_clk_mux_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = _pn, \ - .clkdef.parent_cnt = nitems(_pn), \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .offset = CRU_CLKSEL_CON(_mo), \ - .shift = _ms, \ - .width = _mw, \ - .mux_flags = _f, \ - }, \ -} - #define ARMDIV(_id, _name, _pn, _r, _o, _ds, _dw, _ms, _mw, _mp, _ap) \ { \ .type = RK_CLK_ARMCLK, \ @@ -576,58 +529,6 @@ static struct rk_clk_armclk_rates rk3288_armclk_rates[] = { }, \ } -/* Fixed rate multipier/divider. */ -#define FRACT(_id, _name, _pname, _f, _o) \ -{ \ - .type = RK_CLK_FRACT, \ - .clk.fract = &(struct rk_clk_fract_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = (const char *[]){_pname}, \ - .clkdef.parent_cnt = 1, \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .offset = CRU_CLKSEL_CON(_o), \ - .flags = _f, \ - }, \ -} - -/* Full composite clock. */ -#define COMP(_id, _name, _pnames, _f, _o, _ds, _dw, _ms, _mw) \ -{ \ - .type = RK_CLK_COMPOSITE, \ - .clk.composite = &(struct rk_clk_composite_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = _pnames, \ - .clkdef.parent_cnt = nitems(_pnames), \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .muxdiv_offset = CRU_CLKSEL_CON(_o), \ - .mux_shift = _ms, \ - .mux_width = _mw, \ - .div_shift = _ds, \ - .div_width = _dw, \ - .flags = RK_CLK_COMPOSITE_HAVE_MUX | _f, \ - }, \ -} - -/* Composite clock without mux (divider olnly). */ -#define CDIV(_id, _name, _pname, _f, _o, _ds, _dw) \ -{ \ - .type = RK_CLK_COMPOSITE, \ - .clk.composite = &(struct rk_clk_composite_def) { \ - .clkdef.id = _id, \ - .clkdef.name = _name, \ - .clkdef.parent_names = (const char *[]){_pname}, \ - .clkdef.parent_cnt = 1, \ - .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ - .muxdiv_offset = CRU_CLKSEL_CON(_o), \ - .div_shift = _ds, \ - .div_width = _dw, \ - .flags = _f, \ - }, \ -} - - #define PLIST(_name) static const char *_name[] PLIST(pll_src_p) = {"xin24m", "xin24m", "xin32k"}; PLIST(armclk_p)= {"apll_core", "gpll_core"}; @@ -680,8 +581,8 @@ static struct rk_clk rk3288_clks[] = { FRATE(0, "aclk_vcodec_pre", 0), /* Fixed dividers */ - FACT(0, "xin12m", "xin24m", 1, 2), - FACT(0, "hclk_vcodec_pre_s", "aclk_vcodec_pre", 1, 4), + FFACT(0, "xin12m", "xin24m", 1, 2), + FFACT(0, "hclk_vcodec_pre_s", "aclk_vcodec_pre", 1, 4), PLL(PLL_APLL, "apll", CRU_APLL_CON(0), 0), PLL(PLL_DPLL, "dpll", CRU_DPLL_CON(0), 4), From owner-dev-commits-src-main@freebsd.org Wed Sep 15 18:25:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77E8766BA26; Wed, 15 Sep 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8pYT1vr0z4gJF; Wed, 15 Sep 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 221C712BB9; Wed, 15 Sep 2021 18:25:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FIPXgd072944; Wed, 15 Sep 2021 18:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FIPXNd072943; Wed, 15 Sep 2021 18:25:33 GMT (envelope-from git) Date: Wed, 15 Sep 2021 18:25:33 GMT Message-Id: <202109151825.18FIPXNd072943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: a58abcde2c83 - main - powerpc64: change CAS to support Radix MMU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a58abcde2c83b71e5bf19575750564f7bff78833 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 18:25:33 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=a58abcde2c83b71e5bf19575750564f7bff78833 commit a58abcde2c83b71e5bf19575750564f7bff78833 Author: Leandro Lupori AuthorDate: 2021-09-15 18:12:37 +0000 Commit: Leandro Lupori CommitDate: 2021-09-15 18:24:40 +0000 powerpc64: change CAS to support Radix MMU Use radix_mmu environment variable to select between Hash or Radix MMU, when performing the CAS method call. This matches kernel's behavior, by selecting Hash MMU by default and Radix if radix_mmu is not zero, to make sure that both loader and kernel always select the same MMU. The device tree is queried to detect Radix/GTSE support and to find out if CAS is supported, making the old CPU version and HV bit checks unnecessary now. Reviewed by: jhibbits MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31951 --- stand/powerpc/ofw/cas.c | 120 +++++++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c index 96d276386b71..4f36a147f36d 100644 --- a/stand/powerpc/ofw/cas.c +++ b/stand/powerpc/ofw/cas.c @@ -29,6 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include +/* #define CAS_DEBUG */ +#ifdef CAS_DEBUG +#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) do { ; } while (0) +#endif + /* PVR */ #define PVR_CPU_P8E 0x004b0000 #define PVR_CPU_P8NVL 0x004c0000 @@ -83,13 +90,19 @@ __FBSDID("$FreeBSD$"); #define OV5_INTC_XICS 0 /* byte 24: MMU */ +#define OV5_MMU_INDEX 24 #define OV5_MMU_HPT 0 +#define OV5_MMU_RADIX 0x40 +#define OV5_MMU_EITHER 0x80 +#define OV5_MMU_DYNAMIC 0xc0 /* byte 25: HPT MMU Extensions */ -#define OV5_HPT_EXT_NONE 0 +#define OV5_HPT_EXT_INDEX 25 +#define OV5_HPT_GTSE 0x40 /* byte 26: Radix MMU Extensions */ -#define OV5_RPT_EXT_NONE 0 +#define OV5_RADIX_EXT_INDEX 26 +#define OV5_RADIX_GTSE 0x40 struct pvr { @@ -163,69 +176,84 @@ static struct ibm_arch_vec { 0, /* DRMEM_V2 */ OV5_INTC_XICS, OV5_MMU_HPT, - OV5_HPT_EXT_NONE, - OV5_RPT_EXT_NONE + 0, + 0 } }; -static __inline register_t -mfpvr(void) -{ - register_t value; - - __asm __volatile ("mfpvr %0" : "=r"(value)); - - return (value); -} - -static __inline int -ppc64_hv(void) -{ - int hv; - - /* PSL_HV is bit 3 of 64-bit MSR */ - __asm __volatile ("mfmsr %0\n\t" - "rldicl %0,%0,4,63" : "=r"(hv)); - - return (hv); -} - int ppc64_cas(void) { - int rc; - ihandle_t ihandle; + phandle_t pkg; + ihandle_t inst; cell_t err; + uint8_t buf[16], idx, val; + int i, len, rc, radix_mmu; + const char *var; + char *ov5; + + pkg = OF_finddevice("/chosen"); + if (pkg == -1) { + printf("cas: couldn't find /chosen\n"); + return (-1); + } + + len = OF_getprop(pkg, "ibm,arch-vec-5-platform-support", buf, + sizeof(buf)); + if (len == -1) + /* CAS not supported */ + return (0); - /* Perform CAS only for POWER8 and later cores */ - switch (mfpvr() & PVR_CPU_MASK) { - case PVR_CPU_P8: - case PVR_CPU_P8E: - case PVR_CPU_P8NVL: - case PVR_CPU_P9: + radix_mmu = 0; + ov5 = ibm_arch_vec.vec5.data; + for (i = 0; i < len; i += 2) { + idx = buf[i]; + val = buf[i + 1]; + DPRINTF("idx 0x%02x val 0x%02x\n", idx, val); + + switch (idx) { + case OV5_MMU_INDEX: + /* + * Note that testing for OV5_MMU_RADIX/OV5_MMU_EITHER + * also covers OV5_MMU_DYNAMIC. + */ + if ((val & OV5_MMU_RADIX) || (val & OV5_MMU_EITHER)) + radix_mmu = 1; break; + + case OV5_RADIX_EXT_INDEX: + if (val & OV5_RADIX_GTSE) + ov5[idx] = OV5_RADIX_GTSE; + break; + + case OV5_HPT_EXT_INDEX: default: - return (0); + break; + } } - /* Skip CAS when running on PowerNV */ - if (ppc64_hv()) - return (0); + if (radix_mmu && (var = getenv("radix_mmu")) != NULL && var[0] != '0') + ov5[OV5_MMU_INDEX] = OV5_MMU_RADIX; + else + radix_mmu = 0; - ihandle = OF_open("/"); - if (ihandle == -1) { + inst = OF_open("/"); + if (inst == -1) { printf("cas: failed to open / node\n"); return (-1); } - if (rc = OF_call_method("ibm,client-architecture-support", - ihandle, 1, 1, &ibm_arch_vec, &err)) - printf("cas: failed to call CAS method\n"); - else if (err) { - printf("cas: error: 0x%08lX\n", err); + DPRINTF("MMU 0x%02x RADIX_EXT 0x%02x\n", + ov5[OV5_MMU_INDEX], ov5[OV5_RADIX_EXT_INDEX]); + rc = OF_call_method("ibm,client-architecture-support", + inst, 1, 1, &ibm_arch_vec, &err); + if (rc != 0 || err) { + printf("cas: CAS method returned an error: rc %d err %jd\n", + rc, (intmax_t)err); rc = -1; } - OF_close(ihandle); + OF_close(inst); + printf("cas: selected %s MMU\n", radix_mmu ? "radix" : "hash"); return (rc); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 19:00:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3F8E66C6A9; Wed, 15 Sep 2021 19:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8qKX47Zfz4qGS; Wed, 15 Sep 2021 19:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E56C135D8; Wed, 15 Sep 2021 19:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FJ0G99019651; Wed, 15 Sep 2021 19:00:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FJ0Ghl019644; Wed, 15 Sep 2021 19:00:16 GMT (envelope-from git) Date: Wed, 15 Sep 2021 19:00:16 GMT Message-Id: <202109151900.18FJ0Ghl019644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: ff33e5c83fa8 - main - stress2: replace fuse.ko with fusefs.ko MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff33e5c83fa8448aa9a594783f20f501942087f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 19:00:16 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=ff33e5c83fa8448aa9a594783f20f501942087f0 commit ff33e5c83fa8448aa9a594783f20f501942087f0 Author: Alan Somers AuthorDate: 2021-09-14 22:00:53 +0000 Commit: Alan Somers CommitDate: 2021-09-15 18:59:21 +0000 stress2: replace fuse.ko with fusefs.ko It got renamed in FreeBSD 13 Reviewed by: pho MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D31963 --- tools/test/stress2/misc/fuse.sh | 2 +- tools/test/stress2/misc/fuse2.sh | 4 ++-- tools/test/stress2/misc/fuse3.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/test/stress2/misc/fuse.sh b/tools/test/stress2/misc/fuse.sh index 682fdb122845..08c63996a81b 100755 --- a/tools/test/stress2/misc/fuse.sh +++ b/tools/test/stress2/misc/fuse.sh @@ -33,7 +33,7 @@ . ../default.cfg [ -z "`type mkntfs 2>/dev/null`" ] && exit 0 -[ -c /dev/fuse ] || kldload fuse.ko +[ -c /dev/fuse ] || kldload fusefs.ko MOUNT=/usr/local/bin/ntfs-3g diff --git a/tools/test/stress2/misc/fuse2.sh b/tools/test/stress2/misc/fuse2.sh index 3bd54fa080f5..d155386972c1 100755 --- a/tools/test/stress2/misc/fuse2.sh +++ b/tools/test/stress2/misc/fuse2.sh @@ -32,11 +32,11 @@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 [ -z "`type mkntfs 2>/dev/null`" ] && exit 0 -[ -c /dev/fuse ] || kldload fuse.ko +[ -c /dev/fuse ] || kldload fusefs.ko . ../default.cfg -[ -c /dev/fuse ] || kldload fuse.ko +[ -c /dev/fuse ] || kldload fusefs.ko MOUNT=/usr/local/bin/ntfs-3g mounts=15 # Number of parallel scripts mdstart=$mdstart # Use md unit numbers from this point diff --git a/tools/test/stress2/misc/fuse3.sh b/tools/test/stress2/misc/fuse3.sh index d11e9f4140f7..9da6f92b175f 100755 --- a/tools/test/stress2/misc/fuse3.sh +++ b/tools/test/stress2/misc/fuse3.sh @@ -36,7 +36,7 @@ sleep 10 while pgrep -q swap; do - kldload fuse.ko - kldunload fuse.ko + kldload fusefs.ko + kldunload fusefs.ko done wait From owner-dev-commits-src-main@freebsd.org Wed Sep 15 19:20:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 530BF66CC09; Wed, 15 Sep 2021 19:20:53 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8qnK11XSz3C6r; Wed, 15 Sep 2021 19:20:53 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-pl1-x62f.google.com with SMTP id d18so2230384pll.11; Wed, 15 Sep 2021 12:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=NRaYvUmtdIz9Cg5c1vWT0Sj1Hh9plnsyXaItoGi+kXA=; b=dtduJffXb9IBko8BuCejD3aQm8xV+9WMXECYtFpruHQxLpHIVv/6Y1GhxOeBwzPx/m Tvn3otepGUl2/8jYuT4x+dVrDBjISBmdfkye8+kZsnBnh5G+zkP03407JdVfvG2jUhT/ lV03BX1Qw1JbhqhnkovRPOu4omdI57jqGHj23CFByqzeeSpRf0TGG9/I1z/dS6NDHAvo KqldvsCLwnUvm6zxfPK6HL9M08YXfYhAFJW9Lki82KSqwuExMqIPk3MiG+o3xqezUHin r2voh+CsSD3GVRheTMHFVXfYziamqwECiwVogI6yc6uXsOaZVXDRUWQSJ4iTdETxv6TJ MdUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=NRaYvUmtdIz9Cg5c1vWT0Sj1Hh9plnsyXaItoGi+kXA=; b=7BUDmKoTnUUUt40PGV7nSxvzpuIl/OJLQ7mv1sVWwM0L5CuQmbILXFNKJEaqe5Emej 6/Qdco3C9loIG3KYR8+O/0bC36I1WQ/DZfi/4QDSwwNumRq1vXoqtBSYYg+7felDtBg6 D2U67r9Q9L3c/gAljOUUyqlyW4yZzU7ocgfrP0zPZk4Vt6uLZrMVzIuP1Q9bCv7q/hMs 9W8KptflV7KVrmxBsiZj3j2pGLu5ZtuIqDPQlCFDnkrWMybMqUK38XjbOEKwePw2Dw5Y rwtCLxmcN4mUtyfFdk67HCNAwAgplnX+vqeaAPztMIf6MHX+WEAkxN1Kg9NutzYhENu3 GaJw== X-Gm-Message-State: AOAM533d2IZKt5c9TUAfXz07BDJawKuaQKytXkYgrC1MddNSiNOmPtkO UK4xPbexdI/VA+XWQuBVyDNL2vRQGyM= X-Google-Smtp-Source: ABdhPJyfqlvrimhuON4TVP7VY6iIZCiHwtLTkTVpXh7A3UChMLE+E/2+v667daKF8bgpL0yetURyLQ== X-Received: by 2002:a17:90b:80a:: with SMTP id bk10mr1415805pjb.127.1631733651792; Wed, 15 Sep 2021 12:20:51 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id c23sm645447pgb.74.2021.09.15.12.20.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Sep 2021 12:20:51 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: git: 1ecbc1d8e9d3 - main - cxgbe tom: Don't queue AIO requests on listen sockets. To: Alan Somers , John Baldwin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109142046.18EKkfEN043871@gitrepo.freebsd.org> <0cec1c04-0b42-6297-37c5-43d1dcb0f8d5@FreeBSD.org> From: Navdeep Parhar Message-ID: Date: Wed, 15 Sep 2021 12:20:45 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4H8qnK11XSz3C6r X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 19:20:53 -0000 On 9/15/21 11:05 AM, Alan Somers wrote: > On Wed, Sep 15, 2021 at 11:32 AM John Baldwin > wrote: >=20 > On 9/15/21 8:47 AM, Alan Somers wrote: > > On Wed, Sep 15, 2021 at 9:21 AM John Baldwin > wrote: > > > >> On 9/14/21 1:53 PM, Alan Somers wrote: > >>> On Tue, Sep 14, 2021 at 2:46 PM John Baldwin > wrote: > >>> > >>>> The branch main has been updated by jhb: > >>>> > >>>> URL: > >>>> > >> > https://cgit.FreeBSD.org/src/commit/?id=3D1ecbc1d8e9d3fbcd8e68fc68f= 0a32944a12ddb1e > > >>>> > >>>> commit 1ecbc1d8e9d3fbcd8e68fc68f0a32944a12ddb1e > >>>> Author:=C2=A0 =C2=A0 =C2=A0John Baldwin > >>>> AuthorDate: 2021-09-14 20:46:14 +0000 > >>>> Commit:=C2=A0 =C2=A0 =C2=A0John Baldwin > >>>> CommitDate: 2021-09-14 20:46:14 +0000 > >>>> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0cxgbe tom: Don't queue AIO requests= on listen sockets. > >>>> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0This is similar to the fixes in 141= fe2dceeae.=C2=A0 One > difference is > >> that > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0TOE sockets do not change states (l= isten vs non-listen) once > >> created, > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0so no lock is needed for SOLISTENIN= G(). > >>>> > >>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0Chelsio C= ommunications > >>>> > >>> > >>> I've always wondered: what's the point to using AIO with > sockets?=C2=A0 Can't > >>> everything socket-related be done better with non-blocking > read/write and > >>> kqueue? > >> > >> Zero-copy operation with TOE is why TOE uses AIO.=C2=A0 Zero-co= py of user > >> buffers > >> can't really work with the non-AIO APIs because the user buffer= > is free to > >> be reused immediately after write(2) (and on the read side you > don't know > >> the buffer in advance to allow the NIC to write directly into > the use > >> buffer). > >> > >> In theory we could support zero-copy using mb_ext_pgs for > aio_write() for > >> the non-TOE case similar to what sendfile() does. > >> > >> -- > >> John Baldwin > >> > > > > Interesting.=C2=A0 Do you know of any common applications that i= nclude > this > > optimization?=C2=A0 I've been working on the AIO ecosystem for R= ust.=20 > It would > > be good to ensure that this use case works, especially if > zero-copy ever > > works for non-TOE. >=20 > I do not, and I rely on patches I merged upstream to netperf (-a an= d > -A flags) > to test it.=C2=A0 I believe there might be some proprietary bits in= some > FreeBSD > downstreams that might make use of this. >=20 > --=20 > John Baldwin >=20 >=20 > Do you mean these -a and -A flags, or am I looking in the wrong place? > =C2=A0 =C2=A0 =C2=A0=C2=A0 -a sizespec > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Alter the send and re= ceive buffer alignments on the local > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 system.=C2=A0 This de= faults to 8 bytes. >=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0-A sizespec > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 As -a, but for the re= mote system. The aio options are available for the TCP tests but you might have to=20 build netperf with a non-default option (that's what I had to do a long=20 time back and I haven't checked if it's still needed). # netperf -t TCP_STREAM -- -h =2E.. TCP/UDP BSD Sockets Test Options: -a Use aio_write(2) -A Use aio_read(2) =2E.. # pkg options netperf netperf - EXAMPLES: off netperf - EXS: on netperf - HISTOGRAM: on netperf - INFO: off netperf - OMNI: off netperf - SCTP: on netperf - SOCKETS: on Regards, Navdeep From owner-dev-commits-src-main@freebsd.org Wed Sep 15 20:29:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E29D166D70E; Wed, 15 Sep 2021 20:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8sJJ5jnVz3m13; Wed, 15 Sep 2021 20:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C1AF14570; Wed, 15 Sep 2021 20:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FKTKZ3033174; Wed, 15 Sep 2021 20:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FKTKF4033173; Wed, 15 Sep 2021 20:29:20 GMT (envelope-from git) Date: Wed, 15 Sep 2021 20:29:20 GMT Message-Id: <202109152029.18FKTKF4033173@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 529364b032d7 - main - iscsi: Add a helper routine to abort a data-out task. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 529364b032d774bff4dc818ff23d20be482f9d99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 20:29:21 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=529364b032d774bff4dc818ff23d20be482f9d99 commit 529364b032d774bff4dc818ff23d20be482f9d99 Author: John Baldwin AuthorDate: 2021-09-15 20:25:04 +0000 Commit: John Baldwin CommitDate: 2021-09-15 20:25:04 +0000 iscsi: Add a helper routine to abort a data-out task. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31891 --- sys/cam/ctl/ctl_frontend_iscsi.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 0cbe3bcefc73..ac94a786a701 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -1108,11 +1108,30 @@ cfiscsi_data_wait_free(struct cfiscsi_session *cs, uma_zfree(cfiscsi_data_wait_zone, cdw); } +static void +cfiscsi_data_wait_abort(struct cfiscsi_session *cs, + struct cfiscsi_data_wait *cdw, int status) +{ + union ctl_io *cdw_io; + + /* + * Set nonzero port status; this prevents backends from + * assuming that the data transfer actually succeeded + * and writing uninitialized data to disk. + */ + MPASS(status != 0); + cdw_io = cdw->cdw_ctl_io; + cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; + cdw_io->scsiio.io_hdr.port_status = status; + cfiscsi_data_wait_free(cs, cdw); + ctl_datamove_done(cdw_io, false); +} + static void cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) { struct cfiscsi_data_wait *cdw; - union ctl_io *io, *cdw_io; + union ctl_io *io; int error, last, wait; if (cs->cs_target == NULL) @@ -1139,16 +1158,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) while ((cdw = TAILQ_FIRST(&cs->cs_waiting_for_data_out)) != NULL) { TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); - /* - * Set nonzero port status; this prevents backends from - * assuming that the data transfer actually succeeded - * and writing uninitialized data to disk. - */ - cdw_io = cdw->cdw_ctl_io; - cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw_io->scsiio.io_hdr.port_status = 42; - cfiscsi_data_wait_free(cs, cdw); - ctl_datamove_done(cdw_io, false); + cfiscsi_data_wait_abort(cs, cdw, 42); CFISCSI_SESSION_LOCK(cs); } CFISCSI_SESSION_UNLOCK(cs); @@ -2931,7 +2941,6 @@ cfiscsi_task_management_done(union ctl_io *io) struct cfiscsi_data_wait *cdw, *tmpcdw; struct cfiscsi_session *cs, *tcs; struct cfiscsi_softc *softc; - union ctl_io *cdw_io; int cold_reset = 0; request = PRIV_REQUEST(io); @@ -2965,11 +2974,7 @@ cfiscsi_task_management_done(union ctl_io *io) #endif TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); - cdw_io = cdw->cdw_ctl_io; - cdw_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - cdw_io->scsiio.io_hdr.port_status = 43; - cfiscsi_data_wait_free(cs, cdw); - ctl_datamove_done(cdw_io, false); + cfiscsi_data_wait_abort(cs, cdw, 43); } CFISCSI_SESSION_UNLOCK(cs); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 20:29:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50F9A66DA33; Wed, 15 Sep 2021 20:29:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8sJK6kd0z3lnG; Wed, 15 Sep 2021 20:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B176714A8A; Wed, 15 Sep 2021 20:29:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FKTLBx033198; Wed, 15 Sep 2021 20:29:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FKTL5M033197; Wed, 15 Sep 2021 20:29:21 GMT (envelope-from git) Date: Wed, 15 Sep 2021 20:29:21 GMT Message-Id: <202109152029.18FKTL5M033197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 0cd6e85e242b - main - iscsi: Abort data-out tasks queued on a terminating session. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cd6e85e242bb07a33df9a6314e90bcb0ba99576 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 20:29:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0cd6e85e242bb07a33df9a6314e90bcb0ba99576 commit 0cd6e85e242bb07a33df9a6314e90bcb0ba99576 Author: John Baldwin AuthorDate: 2021-09-15 20:25:30 +0000 Commit: John Baldwin CommitDate: 2021-09-15 20:25:30 +0000 iscsi: Abort data-out tasks queued on a terminating session. cfiscsi_datamove_out() can race with cfiscsi_session_terminate_tasks() and enqueue a new task after the latter function has aborted existing tasks. This could result in a deadlock as cfiscsi_session_terminate_tasks() waited forever for this task to complete. Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D31892 --- sys/cam/ctl/ctl_frontend_iscsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index ac94a786a701..b8ab25e89eb9 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2783,6 +2783,11 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; CFISCSI_SESSION_LOCK(cs); + if (cs->cs_terminating) { + CFISCSI_SESSION_UNLOCK(cs); + cfiscsi_data_wait_abort(cs, cdw, 44); + return; + } TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 20:50:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB1E366DD34; Wed, 15 Sep 2021 20:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8smK4NHTz3rNC; Wed, 15 Sep 2021 20:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7668B14BEB; Wed, 15 Sep 2021 20:50:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FKo9ZH062155; Wed, 15 Sep 2021 20:50:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FKo9Xq062152; Wed, 15 Sep 2021 20:50:09 GMT (envelope-from git) Date: Wed, 15 Sep 2021 20:50:09 GMT Message-Id: <202109152050.18FKo9Xq062152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: 442c8a245ee3 - main - [fib algo][dxr] Fix undefined behavior. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 442c8a245ee3c6640fc9321e18e8316edf469805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 20:50:09 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=442c8a245ee3c6640fc9321e18e8316edf469805 commit 442c8a245ee3c6640fc9321e18e8316edf469805 Author: Marko Zec AuthorDate: 2021-09-15 20:23:17 +0000 Commit: Marko Zec CommitDate: 2021-09-15 20:42:48 +0000 [fib algo][dxr] Fix undefined behavior. The result of shifting uint32_t by 32 (or more) is undefined: fix it. --- sys/netinet/in_fib_dxr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index ec32819a5a6d..7afe2a3da024 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -1150,7 +1150,10 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q, #endif plen = q->entries[ui].plen; ip = ntohl(q->entries[ui].addr4.s_addr); - hmask = 0xffffffffU >> plen; + if (plen < 32) + hmask = 0xffffffffU >> plen; + else + hmask = 0; start = (ip & ~hmask) >> DXR_RANGE_SHIFT; end = (ip | hmask) >> DXR_RANGE_SHIFT; From owner-dev-commits-src-main@freebsd.org Wed Sep 15 20:50:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF5C066D16C; Wed, 15 Sep 2021 20:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8smL50Gwz3r4c; Wed, 15 Sep 2021 20:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 899CB14A6C; Wed, 15 Sep 2021 20:50:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FKoAV1062371; Wed, 15 Sep 2021 20:50:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FKoAb5062368; Wed, 15 Sep 2021 20:50:10 GMT (envelope-from git) Date: Wed, 15 Sep 2021 20:50:10 GMT Message-Id: <202109152050.18FKoAb5062368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: b51f8bae570b - main - [fib algo][dxr] Optimize trie updating. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b51f8bae570b4e908191a1dae9da38aacf8c0fab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 20:50:11 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=b51f8bae570b4e908191a1dae9da38aacf8c0fab commit b51f8bae570b4e908191a1dae9da38aacf8c0fab Author: Marko Zec AuthorDate: 2021-09-15 20:36:59 +0000 Commit: Marko Zec CommitDate: 2021-09-15 20:42:49 +0000 [fib algo][dxr] Optimize trie updating. Don't rebuild in vain trie parts unaffected by accumulated incremental RIB updates. PR: 257965 Tested by: Konrad Kreciwilk MFC after: 3 days --- sys/netinet/in_fib_dxr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 7afe2a3da024..3c4e5700cd6c 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -915,7 +915,14 @@ dxr2_try_squeeze: for (i = da->updates_low >> dxr_x; i <= da->updates_high >> dxr_x; i++) { - trie_unref(da, i); + if (!trie_rebuild) { + m = 0; + for (int j = 0; j < (1 << dxr_x); j += 32) + m |= da->updates_mask[((i << dxr_x) + j) >> 5]; + if (m == 0) + continue; + trie_unref(da, i); + } ti = trie_ref(da, i); if (ti < 0) return; From owner-dev-commits-src-main@freebsd.org Wed Sep 15 22:33:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2D5866F88C; Wed, 15 Sep 2021 22:33:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8w3257Ttz4ntk; Wed, 15 Sep 2021 22:33:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FC04163CE; Wed, 15 Sep 2021 22:33:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FMX2mL004741; Wed, 15 Sep 2021 22:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FMX2qw004740; Wed, 15 Sep 2021 22:33:02 GMT (envelope-from git) Date: Wed, 15 Sep 2021 22:33:02 GMT Message-Id: <202109152233.18FMX2qw004740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 2796f7cab107 - main - e1000: Fix up HW vlan ops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2796f7cab10785ef40efbba97ef67ab319c96e9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 22:33:02 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2796f7cab10785ef40efbba97ef67ab319c96e9c commit 2796f7cab10785ef40efbba97ef67ab319c96e9c Author: Kevin Bowling AuthorDate: 2021-09-15 14:47:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-15 15:03:01 +0000 e1000: Fix up HW vlan ops * Don't reset the entire adapter for vlan changes, fix up the problems * Add some functions for vlan filter (vfta) manipulation * Don't muck with the vfta if we aren't doing HW vlan filtering * Disable interrupts when manipulating vfta on lem(4)-class NICs * On the I350 there is a specification update (2.4.20) in which the suggested workaround is to write to the vfta 10 times (if at first you don't succeed, try, try again). Our shared code has the goods, use it * Increase a VF's frame receive size in the case of vlans From the referenced PR, this reduced vlan configuration from minutes to seconds with hundreds or thousands of vlans and prevents wedging the adapter with needless adapter reinitialization for each vlan ID. PR: 230996 Reviewed by: markj Tested by: Ozkan KIRIK MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30002 --- sys/dev/e1000/if_em.c | 166 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 126 insertions(+), 40 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 6e3a8f73190f..7900e550c55f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -297,6 +297,11 @@ static void em_if_debug(if_ctx_t ctx); static void em_update_stats_counters(struct adapter *); static void em_add_hw_stats(struct adapter *adapter); static int em_if_set_promisc(if_ctx_t ctx, int flags); +static bool em_if_vlan_filter_capable(struct adapter *); +static bool em_if_vlan_filter_used(struct adapter *); +static void em_if_vlan_filter_enable(struct adapter *); +static void em_if_vlan_filter_disable(struct adapter *); +static void em_if_vlan_filter_write(struct adapter *); static void em_setup_vlan_hw_support(struct adapter *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); @@ -906,6 +911,9 @@ em_if_attach_pre(if_ctx_t ctx) scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; if (hw->mac.type < e1000_82543) scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); + /* 82541ER doesn't do HW tagging */ + if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) + scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; /* INTx only */ scctx->isc_msix_bar = 0; } @@ -1335,23 +1343,8 @@ em_if_init(if_ctx_t ctx) adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); - /* Use real VLAN Filter support? */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - em_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } - } else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl &= ~E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } + /* Set up VLAN support and filter */ + em_setup_vlan_hw_support(adapter); /* Don't lose promiscuous settings */ em_if_set_promisc(ctx, if_getflags(ifp)); @@ -1670,14 +1663,19 @@ em_if_set_promisc(if_ctx_t ctx, int flags) if (flags & IFF_PROMISC) { reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); + em_if_vlan_filter_disable(adapter); /* Turn this on if you want to see bad packets */ if (em_debug_sbp) reg_rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); - } else if (flags & IFF_ALLMULTI) { - reg_rctl |= E1000_RCTL_MPE; - reg_rctl &= ~E1000_RCTL_UPE; - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } else { + if (flags & IFF_ALLMULTI) { + reg_rctl |= E1000_RCTL_MPE; + reg_rctl &= ~E1000_RCTL_UPE; + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); + } + if (em_if_vlan_filter_used(adapter)) + em_if_vlan_filter_enable(adapter); } return (0); } @@ -3323,7 +3321,11 @@ em_initialize_receive_unit(if_ctx_t ctx) /* are we on a vlan? */ if (ifp->if_vlantrunk != NULL) psize += VLAN_TAG_SIZE; - E1000_WRITE_REG(hw, E1000_RLPML, psize); + + if (adapter->vf_ifp) + e1000_rlpml_set_vf(hw, pszie); + else + E1000_WRITE_REG(hw, E1000_RLPML, psize); } /* Set maximum packet buffer len */ @@ -3420,6 +3422,7 @@ em_if_vlan_register(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; + em_if_vlan_filter_write(adapter); } static void @@ -3432,41 +3435,121 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; + em_if_vlan_filter_write(adapter); +} + +static bool +em_if_vlan_filter_capable(struct adapter *adapter) +{ + if_softc_ctx_t scctx = adapter->shared; + + if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && + !em_disable_crc_stripping) + return (true); + + return (false); +} + +static bool +em_if_vlan_filter_used(struct adapter *adapter) +{ + if (!em_if_vlan_filter_capable(adapter)) + return (false); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) + return (true); + + return (false); +} + +static void +em_if_vlan_filter_enable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~E1000_RCTL_CFIEN; + reg |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_disable(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + u32 reg; + + reg = E1000_READ_REG(hw, E1000_RCTL); + reg &= ~(E1000_RCTL_VFE | E1000_RCTL_CFIEN); + E1000_WRITE_REG(hw, E1000_RCTL, reg); +} + +static void +em_if_vlan_filter_write(struct adapter *adapter) +{ + struct e1000_hw *hw = &adapter->hw; + + if (adapter->vf_ifp) + return; + + /* Disable interrupts for lem-class devices during the filter change */ + if (hw->mac.type < em_mac_min) + em_if_intr_disable(adapter->ctx); + + for (int i = 0; i < EM_VFTA_SIZE; i++) + if (adapter->shadow_vfta[i] != 0) { + /* XXXKB: incomplete VF support, we return early above */ + if (adapter->vf_ifp) + e1000_vfta_set_vf(hw, adapter->shadow_vfta[i], TRUE); + else + e1000_write_vfta(hw, i, adapter->shadow_vfta[i]); + } + + /* Re-enable interrupts for lem-class devices */ + if (hw->mac.type < em_mac_min) + em_if_intr_enable(adapter->ctx); } static void em_setup_vlan_hw_support(struct adapter *adapter) { + if_softc_ctx_t scctx = adapter->shared; struct e1000_hw *hw = &adapter->hw; u32 reg; - /* - * We get here thru init_locked, meaning - * a soft reset, this has already cleared - * the VFTA and other state, so if there - * have been no vlan's registered do nothing. + /* XXXKB: Return early if we are a VF until VF decap and filter management + * is ready and tested. */ - if (adapter->num_vlans == 0) + if (adapter->vf_ifp) + return; + + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && + !em_disable_crc_stripping) { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg |= E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } else { + reg = E1000_READ_REG(hw, E1000_CTRL); + reg &= ~E1000_CTRL_VME; + E1000_WRITE_REG(hw, E1000_CTRL, reg); + } + + /* If we aren't doing HW filtering, we're done */ + if (!em_if_vlan_filter_capable(adapter)) { + em_if_vlan_filter_disable(adapter); return; + } /* * A soft reset zero's out the VFTA, so * we need to repopulate it now. */ - for (int i = 0; i < EM_VFTA_SIZE; i++) - if (adapter->shadow_vfta[i] != 0) - E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, adapter->shadow_vfta[i]); - - reg = E1000_READ_REG(hw, E1000_CTRL); - reg |= E1000_CTRL_VME; - E1000_WRITE_REG(hw, E1000_CTRL, reg); + em_if_vlan_filter_write(adapter); /* Enable the Filter Table */ - reg = E1000_READ_REG(hw, E1000_RCTL); - reg &= ~E1000_RCTL_CFIEN; - reg |= E1000_RCTL_VFE; - E1000_WRITE_REG(hw, E1000_RCTL, reg); + em_if_vlan_filter_enable(adapter); } static void @@ -3481,6 +3564,7 @@ em_if_intr_enable(if_ctx_t ctx) ims_mask |= adapter->ims; } E1000_WRITE_REG(hw, E1000_IMS, ims_mask); + E1000_WRITE_FLUSH(hw); } static void @@ -3492,6 +3576,7 @@ em_if_intr_disable(if_ctx_t ctx) if (adapter->intr_type == IFLIB_INTR_MSIX) E1000_WRITE_REG(hw, EM_EIAC, 0); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); + E1000_WRITE_FLUSH(hw); } static void @@ -4101,6 +4186,7 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) { switch (event) { case IFLIB_RESTART_VLAN_CONFIG: + return (false); default: return (true); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:23:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9A3767059F; Wed, 15 Sep 2021 23:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8x8l52vQz3Lsq; Wed, 15 Sep 2021 23:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D1471712E; Wed, 15 Sep 2021 23:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNN3Q5071006; Wed, 15 Sep 2021 23:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNN3Nv071005; Wed, 15 Sep 2021 23:23:03 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:23:03 GMT Message-Id: <202109152323.18FNN3Nv071005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 22b20b45c911 - main - e1000: Fix variable typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22b20b45c9118bf6ef313c074cdb107a1eaca78e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:23:03 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=22b20b45c9118bf6ef313c074cdb107a1eaca78e commit 22b20b45c9118bf6ef313c074cdb107a1eaca78e Author: Kevin Bowling AuthorDate: 2021-09-15 16:18:59 +0000 Commit: Kevin Bowling CommitDate: 2021-09-15 16:18:59 +0000 e1000: Fix variable typo Forgot to git add this in last commit Reported by: jenkins Fixes: 2796f7cab107 MFC after: 2 week --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 7900e550c55f..b533ee3962c2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -3323,7 +3323,7 @@ em_initialize_receive_unit(if_ctx_t ctx) psize += VLAN_TAG_SIZE; if (adapter->vf_ifp) - e1000_rlpml_set_vf(hw, pszie); + e1000_rlpml_set_vf(hw, psize); else E1000_WRITE_REG(hw, E1000_RLPML, psize); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 155D3670B07; Wed, 15 Sep 2021 23:59:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xz86wDwz3mwH; Wed, 15 Sep 2021 23:59:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C98CB172EE; Wed, 15 Sep 2021 23:59:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxmL8011070; Wed, 15 Sep 2021 23:59:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxmYR011069; Wed, 15 Sep 2021 23:59:48 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:48 GMT Message-Id: <202109152359.18FNxmYR011069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 03582021117f - main - diff: improve code style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03582021117f05fa562a2a43028b931ec21c5237 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:49 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=03582021117f05fa562a2a43028b931ec21c5237 commit 03582021117f05fa562a2a43028b931ec21c5237 Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-29 09:15:45 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:36:41 +0000 diff: improve code style Reflow comments, strip trailing space, improve wrapping of lines. --- usr.bin/diff/diff.c | 18 ++-- usr.bin/diff/diff.h | 4 +- usr.bin/diff/diffreg.c | 251 ++++++++++++++++++++++--------------------------- 3 files changed, 123 insertions(+), 150 deletions(-) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 1bad6226f49d..bfd391a4e3dd 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -362,9 +362,9 @@ main(int argc, char **argv) } if (dflags & D_EMPTY1 && dflags & D_EMPTY2){ - warn("%s", argv[0]); + warn("%s", argv[0]); warn("%s", argv[1]); - exit(2); + exit(2); } if (stb1.st_mode == 0) @@ -477,8 +477,10 @@ print_only(const char *path, size_t dirlen, const char *entry) void print_status(int val, char *path1, char *path2, const char *entry) { - if (label[0] != NULL) path1 = label[0]; - if (label[1] != NULL) path2 = label[1]; + if (label[0] != NULL) + path1 = label[0]; + if (label[1] != NULL) + path2 = label[1]; switch (val) { case D_BINARY: @@ -535,10 +537,10 @@ usage(void) " [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]\n" " [-S name] [-X file] [-x pattern] dir1 dir2\n" " diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]\n" - " [--ignore-blank-lines] [--ignore-case] [--minimal]\n" - " [--no-ignore-file-name-case] [--strip-trailing-cr]\n" - " [--suppress-common-lines] [--tabsize] [--text] [--width]\n" - " -y | --side-by-side file1 file2\n"); + " [--ignore-blank-lines] [--ignore-case] [--minimal]\n" + " [--no-ignore-file-name-case] [--strip-trailing-cr]\n" + " [--suppress-common-lines] [--tabsize] [--text] [--width]\n" + " -y | --side-by-side file1 file2\n"); exit(2); } diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index b5536bd7bf77..28d08288e1e9 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -1,6 +1,6 @@ +/* $OpenBSD: diff.h,v 1.34 2020/11/01 18:16:08 jcs Exp $ */ - -/*ROR +/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index e728441c2cb2..94026007a1bf 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -95,66 +95,54 @@ __FBSDID("$FreeBSD$"); */ /* - * Uses an algorithm due to Harold Stone, which finds - * a pair of longest identical subsequences in the two - * files. + * Uses an algorithm due to Harold Stone, which finds a pair of longest + * identical subsequences in the two files. * - * The major goal is to generate the match vector J. - * J[i] is the index of the line in file1 corresponding - * to line i file0. J[i] = 0 if there is no + * The major goal is to generate the match vector J. J[i] is the index of + * the line in file1 corresponding to line i file0. J[i] = 0 if there is no * such line in file1. * - * Lines are hashed so as to work in core. All potential - * matches are located by sorting the lines of each file - * on the hash (called ``value''). In particular, this - * collects the equivalence classes in file1 together. - * Subroutine equiv replaces the value of each line in - * file0 by the index of the first element of its - * matching equivalence in (the reordered) file1. - * To save space equiv squeezes file1 into a single - * array member in which the equivalence classes - * are simply concatenated, except that their first - * members are flagged by changing sign. + * Lines are hashed so as to work in core. All potential matches are + * located by sorting the lines of each file on the hash (called + * ``value''). In particular, this collects the equivalence classes in + * file1 together. Subroutine equiv replaces the value of each line in + * file0 by the index of the first element of its matching equivalence in + * (the reordered) file1. To save space equiv squeezes file1 into a single + * array member in which the equivalence classes are simply concatenated, + * except that their first members are flagged by changing sign. * - * Next the indices that point into member are unsorted into - * array class according to the original order of file0. + * Next the indices that point into member are unsorted into array class + * according to the original order of file0. * - * The cleverness lies in routine stone. This marches - * through the lines of file0, developing a vector klist - * of "k-candidates". At step i a k-candidate is a matched - * pair of lines x,y (x in file0 y in file1) such that - * there is a common subsequence of length k - * between the first i lines of file0 and the first y - * lines of file1, but there is no such subsequence for - * any smaller y. x is the earliest possible mate to y - * that occurs in such a subsequence. + * The cleverness lies in routine stone. This marches through the lines of + * file0, developing a vector klist of "k-candidates". At step i + * a k-candidate is a matched pair of lines x,y (x in file0 y in file1) + * such that there is a common subsequence of length k between the first + * i lines of file0 and the first y lines of file1, but there is no such + * subsequence for any smaller y. x is the earliest possible mate to y that + * occurs in such a subsequence. * - * Whenever any of the members of the equivalence class of - * lines in file1 matable to a line in file0 has serial number - * less than the y of some k-candidate, that k-candidate - * with the smallest such y is replaced. The new - * k-candidate is chained (via pred) to the current - * k-1 candidate so that the actual subsequence can - * be recovered. When a member has serial number greater - * that the y of all k-candidates, the klist is extended. - * At the end, the longest subsequence is pulled out - * and placed in the array J by unravel + * Whenever any of the members of the equivalence class of lines in file1 + * matable to a line in file0 has serial number less than the y of some + * k-candidate, that k-candidate with the smallest such y is replaced. The + * new k-candidate is chained (via pred) to the current k-1 candidate so + * that the actual subsequence can be recovered. When a member has serial + * number greater that the y of all k-candidates, the klist is extended. At + * the end, the longest subsequence is pulled out and placed in the array J + * by unravel. * - * With J in hand, the matches there recorded are - * check'ed against reality to assure that no spurious - * matches have crept in due to hashing. If they have, - * they are broken, and "jackpot" is recorded--a harmless - * matter except that a true match for a spuriously - * mated line may now be unnecessarily reported as a change. + * With J in hand, the matches there recorded are check'ed against reality + * to assure that no spurious matches have crept in due to hashing. If they + * have, they are broken, and "jackpot" is recorded -- a harmless matter + * except that a true match for a spuriously mated line may now be + * unnecessarily reported as a change. * - * Much of the complexity of the program comes simply - * from trying to minimize core utilization and - * maximize the range of doable problems by dynamically - * allocating what is needed and reusing what is not. - * The core requirements for problems larger than somewhat - * are (in words) 2*length(file0) + length(file1) + - * 3*(number of k-candidates installed), typically about - * 6n words for files of length n. + * Much of the complexity of the program comes simply from trying to + * minimize core utilization and maximize the range of doable problems by + * dynamically allocating what is needed and reusing what is not. The core + * requirements for problems larger than somewhat are (in words) + * 2*length(file0) + length(file1) + 3*(number of k-candidates installed), + * typically about 6n words for files of length n. */ struct cand { @@ -213,24 +201,24 @@ static int files_differ(FILE *, FILE *, int); static char *match_function(const long *, int, FILE *); static char *preadline(int, size_t, off_t); -static int *J; /* will be overlaid on class */ -static int *class; /* will be overlaid on file[0] */ -static int *klist; /* will be overlaid on file[0] after class */ -static int *member; /* will be overlaid on file[1] */ -static int clen; -static int inifdef; /* whether or not we are in a #ifdef block */ -static int len[2]; -static int pref, suff; /* length of prefix and suffix */ -static int slen[2]; -static int anychange; -static int hw, padding; /* half width and padding */ -static int edoffset; -static long *ixnew; /* will be overlaid on file[1] */ -static long *ixold; /* will be overlaid on klist */ +static int *J; /* will be overlaid on class */ +static int *class; /* will be overlaid on file[0] */ +static int *klist; /* will be overlaid on file[0] after class */ +static int *member; /* will be overlaid on file[1] */ +static int clen; +static int inifdef; /* whether or not we are in a #ifdef block */ +static int len[2]; +static int pref, suff; /* length of prefix and suffix */ +static int slen[2]; +static int anychange; +static int hw, padding; /* half width and padding */ +static int edoffset; +static long *ixnew; /* will be overlaid on file[1] */ +static long *ixold; /* will be overlaid on klist */ static struct cand *clist; /* merely a free storage pot for candidates */ -static int clistlen; /* the length of clist */ +static int clistlen; /* the length of clist */ static struct line *sfile[2]; /* shortened by pruning common prefix/suffix */ -static int (*chrtran)(int); /* translation table for case-folding */ +static int (*chrtran)(int); /* translation table for case-folding */ static struct context_vec *context_vec_start; static struct context_vec *context_vec_end; static struct context_vec *context_vec_ptr; @@ -251,7 +239,7 @@ static int cup2low(int c) { - return tolower(c); + return (tolower(c)); } int @@ -278,11 +266,11 @@ diffreg(char *file1, char *file2, int flags, int capsicum) padding = tabsize - (hw % tabsize); if ((flags & D_EXPANDTABS) != 0 || (padding % tabsize == 0)) padding = MIN_PAD; - + hw = (width >> 1) - ((padding == MIN_PAD) ? (padding << 1) : padding) - 1; } - + if (flags & D_IGNORECASE) chrtran = cup2low; @@ -622,7 +610,7 @@ stone(int *a, int n, int *b, int *c, int flags) { int i, k, y, j, l; int oldc, tc, oldl, sq; - u_int numtries, bound; + unsigned numtries, bound; if (flags & D_MINIMAL) bound = UINT_MAX; @@ -720,9 +708,9 @@ unravel(int p) /* * Check does double duty: - * 1. ferret out any fortuitous correspondences due - * to confounding by hashing (which result in "jackpot") - * 2. collect random access indexes to the two files + * 1. ferret out any fortuitous correspondences due to confounding by + * hashing (which result in "jackpot") + * 2. collect random access indexes to the two files */ static void check(FILE *f1, FILE *f2, int flags) @@ -745,7 +733,7 @@ check(FILE *f1, FILE *f2, int flags) ixnew[j] = ctnew += skipline(f2); j++; } - if (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE|D_STRIPCR)) { + if (flags & (D_FOLDBLANKS | D_IGNOREBLANKS | D_IGNORECASE | D_STRIPCR)) { for (;;) { c = getc(f1); d = getc(f2); @@ -753,7 +741,7 @@ check(FILE *f1, FILE *f2, int flags) * GNU diff ignores a missing newline * in one file for -b or -w. */ - if (flags & (D_FOLDBLANKS|D_IGNOREBLANKS)) { + if (flags & (D_FOLDBLANKS | D_IGNOREBLANKS)) { if (c == EOF && d == '\n') { ctnew++; break; @@ -793,7 +781,7 @@ check(FILE *f1, FILE *f2, int flags) break; ctnew++; } while (isspace(d = getc(f2))); - } else if ((flags & D_IGNOREBLANKS)) { + } else if (flags & D_IGNOREBLANKS) { while (isspace(c) && c != '\n') { c = getc(f1); ctold++; @@ -913,16 +901,11 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) J[m + 1] = len[1] + 1; if (diff_format != D_EDIT) { for (i0 = 1; i0 <= m; i0 = i1 + 1) { - while (i0 <= m && J[i0] == J[i0 - 1] + 1){ - if (diff_format == D_SIDEBYSIDE && - suppress_common != 1) { - nc = fetch(ixold, i0, i0, f1, '\0', - 1, flags); - print_space(nc, - (hw - nc) + (padding << 1) + 1, - flags); - fetch(ixnew, J[i0], J[i0], f2, '\0', - 0, flags); + while (i0 <= m && J[i0] == J[i0 - 1] + 1) { + if (diff_format == D_SIDEBYSIDE && suppress_common != 1) { + nc = fetch(ixold, i0, i0, f1, '\0', 1, flags); + print_space(nc, (hw - nc) + (padding << 1) + 1, flags); + fetch(ixnew, J[i0], J[i0], f2, '\0', 0, flags); printf("\n"); } i0++; @@ -935,33 +918,28 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) J[i1] = j1; /* - * When using side-by-side, lines from both of the - * files are printed. The algorithm used by diff(1) - * identifies the ranges in which two files differ. + * When using side-by-side, lines from both of the files are + * printed. The algorithm used by diff(1) identifies the ranges + * in which two files differ. * See the change() function below. - * The for loop below consumes the shorter range, - * whereas one of the while loops deals with the - * longer one. + * The for loop below consumes the shorter range, whereas one of + * the while loops deals with the longer one. */ if (diff_format == D_SIDEBYSIDE) { - for (i=i0, j=j0; i<=i1 && j<=j1; i++, j++) - change(file1, f1, file2, f2, i, i, - j, j, &flags); + for (i = i0, j = j0; i <= i1 && j <= j1; i++, j++) + change(file1, f1, file2, f2, i, i, j, j, &flags); while (i <= i1) { - change(file1, f1, file2, f2, - i, i, j+1, j, &flags); + change(file1, f1, file2, f2, i, i, j + 1, j, &flags); i++; } while (j <= j1) { - change(file1, f1, file2, f2, - i+1, i, j, j, &flags); + change(file1, f1, file2, f2, i + 1, i, j, j, &flags); j++; } } else - change(file1, f1, file2, f2, i0, i1, j0, - j1, &flags); + change(file1, f1, file2, f2, i0, i1, j0, j1, &flags); } } else { for (i0 = m; i0 >= 1; i0 = i1 - 1) { @@ -1078,9 +1056,8 @@ restart: if (ignore_pats != NULL || skip_blanks) { char *line; /* - * All lines in the change, insert, or delete must - * match an ignore pattern for the change to be - * ignored. + * All lines in the change, insert, or delete must match an ignore + * pattern for the change to be ignored. */ if (a <= b) { /* Changes and deletes. */ for (i = a; i <= b; i++) { @@ -1202,7 +1179,7 @@ proceed: nc = fetch(ixold, a, b, f1, '\0', 1, *pflags); print_space(nc, hw - nc + padding, *pflags); } - printf("%c", (a>b)? '>' : ((c>d)? '<' : '|')); + printf("%c", (a > b) ? '>' : ((c > d) ? '<' : '|')); print_space(hw + padding + 1 , padding, *pflags); fetch(ixnew, c, d, f2, '\0', 0, *pflags); printf("\n"); @@ -1216,11 +1193,11 @@ proceed: fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); if (edoffset != 0 && diff_format == D_EDIT) { /* - * A non-zero edoffset value for D_EDIT indicates that the - * last line printed was a bare dot (".") that has been - * escaped as ".." to prevent ed(1) from misinterpreting - * it. We have to add a substitute command to change this - * back and restart where we left off. + * A non-zero edoffset value for D_EDIT indicates that the last line + * printed was a bare dot (".") that has been escaped as ".." to + * prevent ed(1) from misinterpreting it. We have to add a + * substitute command to change this back and restart where we left + * off. */ printf(".\n"); printf("%ds/.//\n", a + edoffset - 1); @@ -1271,10 +1248,10 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } for (i = a; i <= b; i++) { fseek(lb, f[i - 1], SEEK_SET); - nc = (f[i] - f[i - 1]); + nc = f[i] - f[i - 1]; if (diff_format == D_SIDEBYSIDE && hw < nc) nc = hw; - if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && + if (diff_format != D_IFDEF && diff_format != D_GFORMAT && ch != '\0') { printf("%c", ch); if (Tflag && (diff_format == D_NORMAL || @@ -1301,9 +1278,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) diff_format == D_NREVERSE) warnx("No newline at end of file"); else - printf("\n\\ No newline at end of " - "file\n"); - return col; + printf("\n\\ No newline at end of file\n"); + return (col); } /* * when using --side-by-side, col needs to be increased @@ -1311,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) */ if (c == '\t') { if (flags & D_EXPANDTABS) { - newcol = ((col/tabsize)+1)*tabsize; - do { + newcol = ((col / tabsize) + 1) * tabsize; + do { if (diff_format == D_SIDEBYSIDE) j++; printf(" "); @@ -1320,8 +1296,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } else { if (diff_format == D_SIDEBYSIDE) { if ((j + tabsize) > nc) { - printf("%*s", - nc - j,""); + printf("%*s", nc - j, ""); j = col = nc; } else { printf("\t"); @@ -1334,20 +1309,17 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } } } else { - if (diff_format == D_EDIT && j == 1 && c == '\n' - && lastc == '.') { + if (diff_format == D_EDIT && j == 1 && c == '\n' && + lastc == '.') { /* - * Don't print a bare "." line - * since that will confuse ed(1). - * Print ".." instead and set the, - * global variable edoffset to an - * offset from which to restart. - * The caller must check the value - * of edoffset + * Don't print a bare "." line since that will confuse + * ed(1). Print ".." instead and set the, global variable + * edoffset to an offset from which to restart. The + * caller must check the value of edoffset */ printf(".\n"); edoffset = i - a + 1; - return edoffset; + return (edoffset); } /* when side-by-side, do not print a newline */ if (diff_format != D_SIDEBYSIDE || c != '\n') { @@ -1357,7 +1329,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } } } - return col; + return (col); } /* @@ -1428,7 +1400,7 @@ asciifile(FILE *f) return (memchr(buf, '\0', cnt) == NULL); } -#define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0) +#define begins_with(s, pre) (strncmp(s, pre, sizeof(pre) - 1) == 0) static char * match_function(const long *f, int pos, FILE *fp) @@ -1459,18 +1431,17 @@ match_function(const long *f, int pos, FILE *fp) if (!state) state = " (public)"; } else { - strlcpy(lastbuf, buf, sizeof lastbuf); + strlcpy(lastbuf, buf, sizeof(lastbuf)); if (state) - strlcat(lastbuf, state, - sizeof lastbuf); + strlcat(lastbuf, state, sizeof(lastbuf)); lastmatchline = pos; - return lastbuf; + return (lastbuf); } } } pos--; } - return lastmatchline > 0 ? lastbuf : NULL; + return (lastmatchline > 0 ? lastbuf : NULL); } /* dump accumulated "context" diff changes */ @@ -1493,7 +1464,7 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) printf("***************"); if ((flags & D_PROTOTYPE)) { - f = match_function(ixold, lowa-1, f1); + f = match_function(ixold, lowa - 1, f1); if (f != NULL) printf(" %s", f); } @@ -1600,7 +1571,7 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) uni_range(lowc, upd); printf(" @@"); if ((flags & D_PROTOTYPE)) { - f = match_function(ixold, lowa-1, f1); + f = match_function(ixold, lowa - 1, f1); if (f != NULL) printf(" %s", f); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2383B670C1D; Wed, 15 Sep 2021 23:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzB0RYFz3mnG; Wed, 15 Sep 2021 23:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2AC117468; Wed, 15 Sep 2021 23:59:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxnHw011094; Wed, 15 Sep 2021 23:59:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxnij011093; Wed, 15 Sep 2021 23:59:49 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:49 GMT Message-Id: <202109152359.18FNxnij011093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: b5541f456d64 - main - diff: convert boolean flag variables to bool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5541f456d641d23e0c46874daff0b62552bf3cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:50 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=b5541f456d641d23e0c46874daff0b62552bf3cb commit b5541f456d641d23e0c46874daff0b62552bf3cb Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-04 23:44:26 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:36:41 +0000 diff: convert boolean flag variables to bool There will be more boolean flags added in upcoming commits and they would have to be stored in ints in order to be consistent with existing code. Change the existing code to use the bool type. --- usr.bin/diff/diff.c | 23 +++++++++++------------ usr.bin/diff/diff.h | 8 +++++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index bfd391a4e3dd..03eb16211e86 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -38,8 +38,9 @@ __FBSDID("$FreeBSD$"); #include "diff.h" #include "xmalloc.h" -int lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag, Wflag; -int diff_format, diff_context, status, ignore_file_case, suppress_common; +bool lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; +bool ignore_file_case, suppress_common; +int diff_format, diff_context, status; int tabsize = 8, width = 130; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; char *group_format = NULL; @@ -147,7 +148,6 @@ main(int argc, char **argv) case 'c': if (FORMAT_MISMATCHED(D_CONTEXT)) conflicting_format(); - cflag = 1; diff_format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); @@ -199,10 +199,10 @@ main(int argc, char **argv) usage(); break; case 'l': - lflag = 1; + lflag = true; break; case 'N': - Nflag = 1; + Nflag = true; break; case 'n': if (FORMAT_MISMATCHED(D_NREVERSE)) @@ -213,10 +213,10 @@ main(int argc, char **argv) dflags |= D_PROTOTYPE; break; case 'P': - Pflag = 1; + Pflag = true; break; case 'r': - rflag = 1; + rflag = true; break; case 'q': if (FORMAT_MISMATCHED(D_BRIEF)) @@ -227,10 +227,10 @@ main(int argc, char **argv) start = optarg; break; case 's': - sflag = 1; + sflag = true; break; case 'T': - Tflag = 1; + Tflag = true; break; case 't': dflags |= D_EXPANDTABS; @@ -251,7 +251,6 @@ main(int argc, char **argv) dflags |= D_IGNOREBLANKS; break; case 'W': - Wflag = 1; width = (int) strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) { warnx("Invalid argument for width"); @@ -278,10 +277,10 @@ main(int argc, char **argv) case OPT_HORIZON_LINES: break; /* XXX TODO for compatibility with GNU diff3 */ case OPT_IGN_FN_CASE: - ignore_file_case = 1; + ignore_file_case = true; break; case OPT_NO_IGN_FN_CASE: - ignore_file_case = 0; + ignore_file_case = false; break; case OPT_NORMAL: if (FORMAT_MISMATCHED(D_NORMAL)) diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 28d08288e1e9..04e75e631954 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -33,6 +33,8 @@ */ #include + +#include #include /* @@ -90,9 +92,9 @@ struct excludes { struct excludes *next; }; -extern int lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag, Wflag; -extern int diff_format, diff_context, status, ignore_file_case; -extern int suppress_common; +extern bool lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; +extern bool ignore_file_case, suppress_common; +extern int diff_format, diff_context, status; extern int tabsize, width; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; extern char *group_format; From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C024670B9D; Wed, 15 Sep 2021 23:59:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzD2hmgz3mwN; Wed, 15 Sep 2021 23:59:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 323C8175AB; Wed, 15 Sep 2021 23:59:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxqc1011145; Wed, 15 Sep 2021 23:59:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxqpg011144; Wed, 15 Sep 2021 23:59:52 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:52 GMT Message-Id: <202109152359.18FNxqpg011144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: bcf2e78dc483 - main - diff: replace isqrt() with sqrt() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcf2e78dc48378456798191f1c15cb76d6221a65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:52 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=bcf2e78dc48378456798191f1c15cb76d6221a65 commit bcf2e78dc48378456798191f1c15cb76d6221a65 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-05 00:42:56 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:46:43 +0000 diff: replace isqrt() with sqrt() Remove cruft and use a system-provided and maintained function instead. --- usr.bin/diff/diffreg.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 45821ad96e8c..c743c862f2d6 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -194,7 +195,6 @@ static int fetch(long *, int, int, FILE *, int, int, int); static int newcand(int, int, int); static int search(int *, int, int); static int skipline(FILE *); -static int isqrt(int); static int stone(int *, int, int *, int *, int); static enum readhash readhash(FILE *, int, unsigned *); static int files_differ(FILE *, FILE *, int); @@ -569,25 +569,6 @@ equiv(struct line *a, int n, struct line *b, int m, int *c) c[j] = -1; } -/* Code taken from ping.c */ -static int -isqrt(int n) -{ - int y, x = 1; - - if (n == 0) - return (0); - - do { /* newton was a stinker */ - y = x; - x = n / x; - x += y; - x /= 2; - } while ((x - y) > 1 || (x - y) < -1); - - return (x); -} - static int stone(int *a, int n, int *b, int *c, int flags) { @@ -598,7 +579,7 @@ stone(int *a, int n, int *b, int *c, int flags) if (flags & D_MINIMAL) bound = UINT_MAX; else { - sq = isqrt(n); + sq = sqrt(n); bound = MAX(256, sq); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DE896706DA; Wed, 15 Sep 2021 23:59:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzC2S3nz3mm3; Wed, 15 Sep 2021 23:59:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BFA4177A6; Wed, 15 Sep 2021 23:59:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxoxD011118; Wed, 15 Sep 2021 23:59:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxof1011117; Wed, 15 Sep 2021 23:59:50 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:50 GMT Message-Id: <202109152359.18FNxof1011117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: e43df07e3725 - main - diff: move functions around and reduce their visibility MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e43df07e3725ef6d14a2ca635598c18295b1b481 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:51 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=e43df07e3725ef6d14a2ca635598c18295b1b481 commit e43df07e3725ef6d14a2ca635598c18295b1b481 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-04 23:50:58 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:36:41 +0000 diff: move functions around and reduce their visibility Most of them become static. There will be more such functions added in upcoming commits, so they would be inconsistent with existing code. Improve the existing code instead of reinforcing the unwanted pattern. --- usr.bin/diff/diff.c | 50 ++++++++++++++++++++++++++++++-------------------- usr.bin/diff/diff.h | 2 -- usr.bin/diff/diffdir.c | 9 +++++++++ usr.bin/diff/diffreg.c | 17 ----------------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 03eb16211e86..a5966e74dbcc 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -101,12 +101,13 @@ static struct option longopts[] = { { NULL, 0, 0, '\0'} }; -void usage(void) __dead2; -void conflicting_format(void) __dead2; -void push_excludes(char *); -void push_ignore_pats(char *); -void read_excludes_file(char *file); -void set_argstr(char **, char **); +static void usage(void) __dead2; +static void conflicting_format(void) __dead2; +static void push_excludes(char *); +static void push_ignore_pats(char *); +static void read_excludes_file(char *file); +static void set_argstr(char **, char **); +static char *splice(char *, char *); int main(int argc, char **argv) @@ -393,7 +394,7 @@ main(int argc, char **argv) exit(status); } -void +static void set_argstr(char **av, char **ave) { size_t argsize; @@ -413,7 +414,7 @@ set_argstr(char **av, char **ave) /* * Read in an excludes file and push each line. */ -void +static void read_excludes_file(char *file) { FILE *fp; @@ -438,7 +439,7 @@ read_excludes_file(char *file) /* * Push a pattern onto the excludes list. */ -void +static void push_excludes(char *pattern) { struct excludes *entry; @@ -449,7 +450,7 @@ push_excludes(char *pattern) excludes_list = entry; } -void +static void push_ignore_pats(char *pattern) { size_t len; @@ -465,14 +466,6 @@ push_ignore_pats(char *pattern) } } -void -print_only(const char *path, size_t dirlen, const char *entry) -{ - if (dirlen > 1) - dirlen--; - printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -} - void print_status(int val, char *path1, char *path2, const char *entry) { @@ -517,7 +510,7 @@ print_status(int val, char *path1, char *path2, const char *entry) } } -void +static void usage(void) { (void)fprintf(stderr, @@ -544,10 +537,27 @@ usage(void) exit(2); } -void +static void conflicting_format(void) { fprintf(stderr, "error: conflicting output format options.\n"); usage(); } + +static char * +splice(char *dir, char *path) +{ + char *tail, *buf; + size_t dirlen; + + dirlen = strlen(dir); + while (dirlen != 0 && dir[dirlen - 1] == '/') + dirlen--; + if ((tail = strrchr(path, '/')) == NULL) + tail = path; + else + tail++; + xasprintf(&buf, "%.*s/%s", (int)dirlen, dir, tail); + return (buf); +} diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 04e75e631954..7ae700810fc6 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -102,8 +102,6 @@ extern struct stat stb1, stb2; extern struct excludes *excludes_list; extern regex_t ignore_re; -char *splice(char *, char *); int diffreg(char *, char *, int, int); void diffdir(char *, char *, int); -void print_only(const char *, size_t, const char *); void print_status(int, char *, char *, const char *); diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c index 2b6e5f366454..ecb7c4a6c4ee 100644 --- a/usr.bin/diff/diffdir.c +++ b/usr.bin/diff/diffdir.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); static int selectfile(const struct dirent *); static void diffit(struct dirent *, char *, size_t, char *, size_t, int); +static void print_only(const char *, size_t, const char *); #define d_status d_type /* we need to store status for -l */ @@ -237,3 +238,11 @@ selectfile(const struct dirent *dp) return (1); } + +void +print_only(const char *path, size_t dirlen, const char *entry) +{ + if (dirlen > 1) + dirlen--; + printf("Only in %.*s: %s\n", (int)dirlen, path, entry); +} diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 94026007a1bf..45821ad96e8c 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -486,23 +486,6 @@ opentemp(const char *f) return (fdopen(ofd, "r")); } -char * -splice(char *dir, char *path) -{ - char *tail, *buf; - size_t dirlen; - - dirlen = strlen(dir); - while (dirlen != 0 && dir[dirlen - 1] == '/') - dirlen--; - if ((tail = strrchr(path, '/')) == NULL) - tail = path; - else - tail++; - xasprintf(&buf, "%.*s/%s", (int)dirlen, dir, tail); - return (buf); -} - static bool prepare(int i, FILE *fd, size_t filesize, int flags) { From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6297670B18; Wed, 15 Sep 2021 23:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzF3LYWz3mtZ; Wed, 15 Sep 2021 23:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CC5C172EF; Wed, 15 Sep 2021 23:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxrLO011173; Wed, 15 Sep 2021 23:59:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxr2N011172; Wed, 15 Sep 2021 23:59:53 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:53 GMT Message-Id: <202109152359.18FNxr2N011172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 2171b2cbe084 - main - diff: avoid applying offsets to null pointer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2171b2cbe084118e0e8f7de658f0302d0feb8827 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:54 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=2171b2cbe084118e0e8f7de658f0302d0feb8827 commit 2171b2cbe084118e0e8f7de658f0302d0feb8827 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-05 16:59:08 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:46:44 +0000 diff: avoid applying offsets to null pointer This was the only instance of undefined behavior I could find so far. --- usr.bin/diff/diffreg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index c743c862f2d6..4a00aff9243b 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -255,7 +255,6 @@ diffreg(char *file1, char *file2, int flags, int capsicum) anychange = 0; lastline = 0; lastmatchline = 0; - context_vec_ptr = context_vec_start - 1; /* * hw excludes padding and make sure when -t is not used, @@ -1050,8 +1049,12 @@ proceed: /* * Allocate change records as needed. */ - if (context_vec_ptr == context_vec_end - 1) { - ptrdiff_t offset = context_vec_ptr - context_vec_start; + if (context_vec_start == NULL || + context_vec_ptr == context_vec_end - 1) { + ptrdiff_t offset = -1; + + if (context_vec_start != NULL) + offset = context_vec_ptr - context_vec_start; max_context <<= 1; context_vec_start = xreallocarray(context_vec_start, max_context, sizeof(*context_vec_start)); From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8C98670674; Wed, 15 Sep 2021 23:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzG4RfPz3mwW; Wed, 15 Sep 2021 23:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E44F17337; Wed, 15 Sep 2021 23:59:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxshd011197; Wed, 15 Sep 2021 23:59:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxskV011196; Wed, 15 Sep 2021 23:59:54 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:54 GMT Message-Id: <202109152359.18FNxskV011196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 7760b8541418 - main - diff: decrease indent level MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7760b85414189789c792c92c66bb3ddb877deae1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:54 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=7760b85414189789c792c92c66bb3ddb877deae1 commit 7760b85414189789c792c92c66bb3ddb877deae1 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-05 14:26:23 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:46:44 +0000 diff: decrease indent level An upcoming change will add more code in the loop. --- usr.bin/diff/diffreg.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 4a00aff9243b..c9095ec46e88 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1378,35 +1378,34 @@ match_function(const long *f, int pos, FILE *fp) const char *state = NULL; lastline = pos; - while (pos > last) { + for (; pos > last; pos--) { fseek(fp, f[pos - 1], SEEK_SET); nc = f[pos] - f[pos - 1]; if (nc >= sizeof(buf)) nc = sizeof(buf) - 1; nc = fread(buf, 1, nc, fp); - if (nc > 0) { - buf[nc] = '\0'; - buf[strcspn(buf, "\n")] = '\0'; - if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { - if (begins_with(buf, "private:")) { - if (!state) - state = " (private)"; - } else if (begins_with(buf, "protected:")) { - if (!state) - state = " (protected)"; - } else if (begins_with(buf, "public:")) { - if (!state) - state = " (public)"; - } else { - strlcpy(lastbuf, buf, sizeof(lastbuf)); - if (state) - strlcat(lastbuf, state, sizeof(lastbuf)); - lastmatchline = pos; - return (lastbuf); - } + if (nc == 0) + continue; + buf[nc] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; + if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { + if (begins_with(buf, "private:")) { + if (!state) + state = " (private)"; + } else if (begins_with(buf, "protected:")) { + if (!state) + state = " (protected)"; + } else if (begins_with(buf, "public:")) { + if (!state) + state = " (public)"; + } else { + strlcpy(lastbuf, buf, sizeof(lastbuf)); + if (state) + strlcat(lastbuf, state, sizeof(lastbuf)); + lastmatchline = pos; + return (lastbuf); } } - pos--; } return (lastmatchline > 0 ? lastbuf : NULL); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E81FC6709C0; Wed, 15 Sep 2021 23:59:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzH5965z3mtl; Wed, 15 Sep 2021 23:59:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85E8A17469; Wed, 15 Sep 2021 23:59:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxtFi011221; Wed, 15 Sep 2021 23:59:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxtbP011220; Wed, 15 Sep 2021 23:59:55 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:55 GMT Message-Id: <202109152359.18FNxtbP011220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: f38702e5a52e - main - diff(1): Add --color support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f38702e5a52e1350b9349bc297ccd0b50b1941c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:56 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=f38702e5a52e1350b9349bc297ccd0b50b1941c3 commit f38702e5a52e1350b9349bc297ccd0b50b1941c3 Author: Cameron Katri AuthorDate: 2021-09-05 00:10:41 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:46:44 +0000 diff(1): Add --color support Adds a --color flag to diff(1) that supports the same options as GNU's diff(1). The colors are customizable with the env var DIFFCOLORS in a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41 for additions to be underlined light blue, and deletions have a red background. Differential Revision: https://reviews.freebsd.org/D30545 --- usr.bin/diff/diff.1 | 35 ++++++++++++++++++++++++++++++++ usr.bin/diff/diff.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++- usr.bin/diff/diff.h | 10 ++++++++- usr.bin/diff/diffreg.c | 21 ++++++++++++++++++- 4 files changed, 118 insertions(+), 3 deletions(-) diff --git a/usr.bin/diff/diff.1 b/usr.bin/diff/diff.1 index e0a790f6efb6..6056ddd3ac76 100644 --- a/usr.bin/diff/diff.1 +++ b/usr.bin/diff/diff.1 @@ -44,6 +44,7 @@ .Fl n | q | u | y .Oc .Op Fl -brief +.Op Fl -color Ns = Ns Ar when .Op Fl -changed-group-format Ar GFMT .Op Fl -ed .Op Fl -expand-tabs @@ -71,6 +72,7 @@ .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern .Op Fl L Ar label | Fl -label Ar label .Op Fl -brief +.Op Fl -color Ns = Ns Ar when .Op Fl -changed-group-format Ar GFMT .Op Fl -ed .Op Fl -expand-tabs @@ -96,6 +98,7 @@ .Op Fl aBbdiltw .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern .Op Fl -brief +.Op Fl -color Ns = Ns Ar when .Op Fl -changed-group-format Ar GFMT .Op Fl -ed .Op Fl -expand-tabs @@ -122,6 +125,7 @@ .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern .Op Fl L Ar label | Fl -label Ar label .Op Fl -brief +.Op Fl -color Ns = Ns Ar when .Op Fl -changed-group-format Ar GFMT .Op Fl -ed .Op Fl -expand-tabs @@ -150,6 +154,7 @@ .Fl n | q | u .Oc .Op Fl -brief +.Op Fl -color Ns = Ns Ar when .Op Fl -changed-group-format Ar GFMT .Op Fl -context .Op Fl -ed @@ -184,6 +189,7 @@ .Ar dir1 dir2 .Nm diff .Op Fl aBbditwW +.Op Fl -color Ns = Ns Ar when .Op Fl -expand-tabs .Op Fl -ignore-all-blanks .Op Fl -ignore-blank-lines @@ -332,6 +338,21 @@ Causes chunks that include only blank lines to be ignored. .It Fl b -ignore-space-change Causes trailing blanks (spaces and tabs) to be ignored, and other strings of blanks to compare equal. +.It Fl -color= Ns Oo Ar when Oc +Color the additions green, and removals red, or the value in the +.Ev DIFFCOLORS +environment variable. +The possible values of +.Ar when +are +.Dq Cm never , +.Dq Cm always +and +.Dq Cm auto . +.Cm auto +will use color if the output is a tty and the +.Ev COLORTERM +environment variable is set to a non-empty string. .It Fl d -minimal Try very hard to produce a diff as small as possible. This may consume a lot of processing power and memory when processing @@ -592,6 +613,20 @@ As in identical pairs (where num1 = num2) are abbreviated as a single number. +.Sh ENVIRONMENT +.Bl -tag -width DIFFCOLORS +.It Ev DIFFCOLORS +The value of this variable is the form +.Ar add Ns : Ns Ar rm , +where +.Ar add +is the ASCII escape sequence for additions and +.Ar rm +is the ASCII escape sequence for deletions. +If this is unset, +.Nm +uses green for additions and red for removals. +.El .Sh FILES .Bl -tag -width /tmp/diff.XXXXXXXX -compact .It Pa /tmp/diff.XXXXXXXX diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index a5966e74dbcc..4fc3094035d9 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -39,11 +39,13 @@ __FBSDID("$FreeBSD$"); #include "xmalloc.h" bool lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; -bool ignore_file_case, suppress_common; +bool ignore_file_case, suppress_common, color; int diff_format, diff_context, status; int tabsize = 8, width = 130; +static int colorflag = COLORFLAG_NEVER; char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; char *group_format = NULL; +const char *add_code, *del_code; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; @@ -58,6 +60,7 @@ enum { OPT_HORIZON_LINES, OPT_CHANGED_GROUP_FORMAT, OPT_SUPPRESS_COMMON, + OPT_COLOR, }; static struct option longopts[] = { @@ -98,6 +101,7 @@ static struct option longopts[] = { { "tabsize", required_argument, NULL, OPT_TSIZE }, { "changed-group-format", required_argument, NULL, OPT_CHANGED_GROUP_FORMAT}, { "suppress-common-lines", no_argument, NULL, OPT_SUPPRESS_COMMON }, + { "color", optional_argument, NULL, OPT_COLOR }, { NULL, 0, 0, '\0'} }; @@ -108,6 +112,7 @@ static void push_ignore_pats(char *); static void read_excludes_file(char *file); static void set_argstr(char **, char **); static char *splice(char *, char *); +static bool do_color(void); int main(int argc, char **argv) @@ -301,6 +306,17 @@ main(int argc, char **argv) case OPT_SUPPRESS_COMMON: suppress_common = 1; break; + case OPT_COLOR: + if (optarg == NULL || strncmp(optarg, "auto", 4) == 0) + colorflag = COLORFLAG_AUTO; + else if (strncmp(optarg, "always", 6) == 0) + colorflag = COLORFLAG_ALWAYS; + else if (strncmp(optarg, "never", 5) == 0) + colorflag = COLORFLAG_NEVER; + else + errx(2, "unsupported --color value '%s' (must be always, auto, or never)", + optarg); + break; default: usage(); break; @@ -316,6 +332,22 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (do_color()) { + char *p; + const char *env; + + color = true; + add_code = "32"; + del_code = "31"; + env = getenv("DIFFCOLORS"); + if (env != NULL && *env != '\0' && (p = strdup(env))) { + add_code = p; + strsep(&p, ":"); + if (p != NULL) + del_code = p; + } + } + #ifdef __OpenBSD__ if (pledge("stdio rpath tmppath", NULL) == -1) err(2, "pledge"); @@ -545,6 +577,27 @@ conflicting_format(void) usage(); } +static bool +do_color(void) +{ + const char *p, *p2; + + switch (colorflag) { + case COLORFLAG_AUTO: + p = getenv("CLICOLOR"); + p2 = getenv("COLORTERM"); + if ((p != NULL && *p != '\0') || (p2 != NULL && *p2 != '\0')) + return isatty(STDOUT_FILENO); + break; + case COLORFLAG_ALWAYS: + return (true); + case COLORFLAG_NEVER: + return (false); + } + + return (false); +} + static char * splice(char *dir, char *path) { diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 7ae700810fc6..5164fe22ace4 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -87,17 +87,25 @@ #define D_SKIPPED2 6 /* path2 was a special file */ #define D_ERROR 7 /* A file access error occurred */ +/* + * Color options + */ +#define COLORFLAG_NEVER 0 +#define COLORFLAG_AUTO 1 +#define COLORFLAG_ALWAYS 2 + struct excludes { char *pattern; struct excludes *next; }; extern bool lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; -extern bool ignore_file_case, suppress_common; +extern bool ignore_file_case, suppress_common, color; extern int diff_format, diff_context, status; extern int tabsize, width; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; extern char *group_format; +extern const char *add_code, *del_code; extern struct stat stb1, stb2; extern struct excludes *excludes_list; extern regex_t ignore_re; diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index c9095ec46e88..47c1934a6a65 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1140,13 +1140,23 @@ proceed: } } if (diff_format == D_SIDEBYSIDE) { + if (color && a > b) + printf("\033[%sm", add_code); + else if (color && c > d) + printf("\033[%sm", del_code); if (a > b) { print_space(0, hw + padding , *pflags); } else { nc = fetch(ixold, a, b, f1, '\0', 1, *pflags); print_space(nc, hw - nc + padding, *pflags); } + if (color && a > b) + printf("\033[%sm", add_code); + else if (color && c > d) + printf("\033[%sm", del_code); printf("%c", (a > b) ? '>' : ((c > d) ? '<' : '|')); + if (color && c > d) + printf("\033[m"); print_space(hw + padding + 1 , padding, *pflags); fetch(ixnew, c, d, f2, '\0', 0, *pflags); printf("\n"); @@ -1220,6 +1230,10 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) nc = hw; if (diff_format != D_IFDEF && diff_format != D_GFORMAT && ch != '\0') { + if (color && (ch == '>' || ch == '+')) + printf("\033[%sm", add_code); + else if (color && (ch == '<' || ch == '-')) + printf("\033[%sm", del_code); printf("%c", ch); if (Tflag && (diff_format == D_NORMAL || diff_format == D_CONTEXT || @@ -1290,12 +1304,17 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) } /* when side-by-side, do not print a newline */ if (diff_format != D_SIDEBYSIDE || c != '\n') { - printf("%c", c); + if (color && c == '\n') + printf("\033[m%c", c); + else + printf("%c", c); col++; } } } } + if (color && diff_format == D_SIDEBYSIDE) + printf("\033[m"); return (col); } From owner-dev-commits-src-main@freebsd.org Wed Sep 15 23:59:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C153670BAA; Wed, 15 Sep 2021 23:59:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8xzK0sqfz3n2P; Wed, 15 Sep 2021 23:59:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFCB8173C1; Wed, 15 Sep 2021 23:59:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18FNxu08011245; Wed, 15 Sep 2021 23:59:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18FNxuAB011244; Wed, 15 Sep 2021 23:59:56 GMT (envelope-from git) Date: Wed, 15 Sep 2021 23:59:56 GMT Message-Id: <202109152359.18FNxuAB011244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: e51aabf8cbb9 - main - diff: implement option -F (--show-function-line) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e51aabf8cbb9b412c725c4c9c727ca6faa0630c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 23:59:57 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=e51aabf8cbb9b412c725c4c9c727ca6faa0630c6 commit e51aabf8cbb9b412c725c4c9c727ca6faa0630c6 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-05 14:54:07 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-15 23:46:44 +0000 diff: implement option -F (--show-function-line) With unified and context diffs, show the last line that matches the provided pattern before the context. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D31714 --- usr.bin/diff/diff.1 | 8 +++++++ usr.bin/diff/diff.c | 59 +++++++++++++++++++++++++++++++++----------------- usr.bin/diff/diff.h | 6 +++-- usr.bin/diff/diffreg.c | 14 +++++++++--- 4 files changed, 62 insertions(+), 25 deletions(-) diff --git a/usr.bin/diff/diff.1 b/usr.bin/diff/diff.1 index 6056ddd3ac76..dea01bf918f4 100644 --- a/usr.bin/diff/diff.1 +++ b/usr.bin/diff/diff.1 @@ -65,11 +65,13 @@ .Op Fl -text .Op Fl -unified .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl F Ar pattern | Fl -show-function-line Ar pattern .Op Fl L Ar label | Fl -label Ar label .Ar file1 file2 .Nm diff .Op Fl aBbdilpTtw .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl F Ar pattern | Fl -show-function-line Ar pattern .Op Fl L Ar label | Fl -label Ar label .Op Fl -brief .Op Fl -color Ns = Ns Ar when @@ -123,6 +125,7 @@ .Nm diff .Op Fl aBbdilpTtw .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl F Ar pattern | Fl -show-function-line Ar pattern .Op Fl L Ar label | Fl -label Ar label .Op Fl -brief .Op Fl -color Ns = Ns Ar when @@ -180,6 +183,7 @@ .Op Fl -unidirectional-new-file .Op Fl -unified .Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern +.Op Fl F Ar pattern | Fl -show-function-line Ar pattern .Bk -words .Op Fl L Ar label | Fl -label Ar label .Op Fl S Ar name | Fl -starting-file Ar name @@ -357,6 +361,10 @@ environment variable is set to a non-empty string. Try very hard to produce a diff as small as possible. This may consume a lot of processing power and memory when processing large files with many changes. +.It Fl F Ar pattern, Fl -show-function-line Ar pattern +Like +.Fl p, +but display the last line that matches provided pattern. .It Fl I Ar pattern Fl -ignore-matching-lines Ar pattern Ignores changes, insertions, and deletions whose lines match the extended regular expression diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 4fc3094035d9..8074261742ae 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -43,14 +43,15 @@ bool ignore_file_case, suppress_common, color; int diff_format, diff_context, status; int tabsize = 8, width = 130; static int colorflag = COLORFLAG_NEVER; -char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +char *start, *ifdefname, *diffargs, *label[2]; +char *ignore_pats, *most_recent_pat; char *group_format = NULL; const char *add_code, *del_code; struct stat stb1, stb2; struct excludes *excludes_list; -regex_t ignore_re; +regex_t ignore_re, most_recent_re; -#define OPTIONS "0123456789aBbC:cdD:efHhI:iL:lnNPpqrS:sTtU:uwW:X:x:y" +#define OPTIONS "0123456789aBbC:cdD:efF:HhI:iL:lnNPpqrS:sTtU:uwW:X:x:y" enum { OPT_TSIZE = CHAR_MAX + 1, OPT_STRIPCR, @@ -71,6 +72,7 @@ static struct option longopts[] = { { "minimal", no_argument, 0, 'd' }, { "ed", no_argument, 0, 'e' }, { "forward-ed", no_argument, 0, 'f' }, + { "show-function-line", required_argument, 0, 'F' }, { "speed-large-files", no_argument, NULL, 'H' }, { "ignore-blank-lines", no_argument, 0, 'B' }, { "ignore-matching-lines", required_argument, 0, 'I' }, @@ -105,6 +107,7 @@ static struct option longopts[] = { { NULL, 0, 0, '\0'} }; +static void checked_regcomp(char const *, regex_t *); static void usage(void) __dead2; static void conflicting_format(void) __dead2; static void push_excludes(char *); @@ -190,6 +193,12 @@ main(int argc, char **argv) case 'B': dflags |= D_SKIPBLANKLINES; break; + case 'F': + if (dflags & D_PROTOTYPE) + conflicting_format(); + dflags |= D_MATCHLAST; + most_recent_pat = xstrdup(optarg); + break; case 'I': push_ignore_pats(optarg); break; @@ -216,6 +225,8 @@ main(int argc, char **argv) diff_format = D_NREVERSE; break; case 'p': + if (dflags & D_MATCHLAST) + conflicting_format(); dflags |= D_PROTOTYPE; break; case 'P': @@ -359,19 +370,8 @@ main(int argc, char **argv) */ if (argc != 2) usage(); - if (ignore_pats != NULL) { - char buf[BUFSIZ]; - int error; - - if ((error = regcomp(&ignore_re, ignore_pats, - REG_NEWLINE | REG_EXTENDED)) != 0) { - regerror(error, &ignore_re, buf, sizeof(buf)); - if (*ignore_pats != '\0') - errx(2, "%s: %s", ignore_pats, buf); - else - errx(2, "%s", buf); - } - } + checked_regcomp(ignore_pats, &ignore_re); + checked_regcomp(most_recent_pat, &most_recent_re); if (strcmp(argv[0], "-") == 0) { fstat(STDIN_FILENO, &stb1); gotstdin = 1; @@ -426,6 +426,25 @@ main(int argc, char **argv) exit(status); } +static void +checked_regcomp(char const *pattern, regex_t *comp) +{ + char buf[BUFSIZ]; + int error; + + if (pattern == NULL) + return; + + error = regcomp(comp, pattern, REG_NEWLINE | REG_EXTENDED); + if (error != 0) { + regerror(error, comp, buf, sizeof(buf)); + if (*pattern != '\0') + errx(2, "%s: %s", pattern, buf); + else + errx(2, "%s", buf); + } +} + static void set_argstr(char **av, char **ave) { @@ -548,18 +567,18 @@ usage(void) (void)fprintf(stderr, "usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]\n" " [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]\n" - " [-I pattern] [-L label] file1 file2\n" + " [-I pattern] [-F pattern] [-L label] file1 file2\n" " diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]\n" " [--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]\n" - " -C number file1 file2\n" + " [-F pattern] -C number file1 file2\n" " diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]\n" " [--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2\n" " diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]\n" " [--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]\n" - " -U number file1 file2\n" + " [-F pattern] -U number file1 file2\n" " diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]\n" " [--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]\n" - " [-S name] [-X file] [-x pattern] dir1 dir2\n" + " [-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2\n" " diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]\n" " [--ignore-blank-lines] [--ignore-case] [--minimal]\n" " [--no-ignore-file-name-case] [--strip-trailing-cr]\n" diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 5164fe22ace4..4a7d19ee8982 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -74,6 +74,7 @@ #define D_IGNOREBLANKS 0x200 /* Ignore white space changes */ #define D_STRIPCR 0x400 /* Strip trailing cr */ #define D_SKIPBLANKLINES 0x800 /* Skip blank lines */ +#define D_MATCHLAST 0x1000 /* Display last line matching provided regex */ /* * Status values for print_status() and diffreg() return values @@ -103,12 +104,13 @@ extern bool lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; extern bool ignore_file_case, suppress_common, color; extern int diff_format, diff_context, status; extern int tabsize, width; -extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +extern char *start, *ifdefname, *diffargs, *label[2]; +extern char *ignore_pats, *most_recent_pat; extern char *group_format; extern const char *add_code, *del_code; extern struct stat stb1, stb2; extern struct excludes *excludes_list; -extern regex_t ignore_re; +extern regex_t ignore_re, most_recent_re; int diffreg(char *, char *, int, int); void diffdir(char *, char *, int); diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 47c1934a6a65..fc3c3406a073 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1407,7 +1407,15 @@ match_function(const long *f, int pos, FILE *fp) continue; buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; - if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { + if (most_recent_pat != NULL) { + int ret = regexec(&most_recent_re, buf, 0, NULL, 0); + + if (ret != 0) + continue; + strlcpy(lastbuf, buf, sizeof(lastbuf)); + lastmatchline = pos; + return (lastbuf); + } else if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) state = " (private)"; @@ -1448,7 +1456,7 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) upd = MIN(len[1], context_vec_ptr->d + diff_context); printf("***************"); - if ((flags & D_PROTOTYPE)) { + if (flags & (D_PROTOTYPE | D_MATCHLAST)) { f = match_function(ixold, lowa - 1, f1); if (f != NULL) printf(" %s", f); @@ -1555,7 +1563,7 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) printf(" +"); uni_range(lowc, upd); printf(" @@"); - if ((flags & D_PROTOTYPE)) { + if (flags & (D_PROTOTYPE | D_MATCHLAST)) { f = match_function(ixold, lowa - 1, f1); if (f != NULL) printf(" %s", f); From owner-dev-commits-src-main@freebsd.org Thu Sep 16 00:32:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59C7767126B; Thu, 16 Sep 2021 00:32:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8yjR24DNz4QlV; Thu, 16 Sep 2021 00:32:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2787717A6E; Thu, 16 Sep 2021 00:32:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18G0WxFn063884; Thu, 16 Sep 2021 00:32:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18G0Wxbc063883; Thu, 16 Sep 2021 00:32:59 GMT (envelope-from git) Date: Thu, 16 Sep 2021 00:32:59 GMT Message-Id: <202109160032.18G0Wxbc063883@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 9ebe4b8c67bf - main - nfscl: Add vfs.nfs.maxalloclen to limit Allocate/Deallocate RPC RTT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ebe4b8c67bf823e62617ba9fbd3c9c1768c8b3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 00:32:59 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9ebe4b8c67bf823e62617ba9fbd3c9c1768c8b3b commit 9ebe4b8c67bf823e62617ba9fbd3c9c1768c8b3b Author: Rick Macklem AuthorDate: 2021-09-16 00:29:45 +0000 Commit: Rick Macklem CommitDate: 2021-09-16 00:29:45 +0000 nfscl: Add vfs.nfs.maxalloclen to limit Allocate/Deallocate RPC RTT Unlike Copy, the NFSv4.2 Allocate and Deallocate operations do not allow a reply with partial completion. As such, the only way to limit the time the operation takes to provide a reasonable RPC RTT is to limit the size of the allocation/deallocation in the NFSv4.2 client. This patch adds a sysctl called vfs.nfs.maxalloclen to set the limit on the size of the Allocate operation. There is no way to know how long a server will take to do an allocate operation, but 64Mbytes results in a reasonable RPC RTT for the slow hardware I test on, so that is what the default value for vfs.nfs.maxalloclen is set to. For an 8Gbyte allocation, the elapsed time for doing it in 64Mbyte chunks was the same as the elapsed time taken for a single large allocation operation for a FreeBSD server with a UFS file system. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clvnops.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index bfd77d50bc91..85b5dd9cfbb1 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -301,6 +301,10 @@ int newnfs_directio_allow_mmap = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW, &newnfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens"); +static uint64_t nfs_maxalloclen = 64 * 1024 * 1024; +SYSCTL_U64(_vfs_nfs, OID_AUTO, maxalloclen, CTLFLAG_RW, + &nfs_maxalloclen, 0, "NFS max allocate/deallocate length"); + #define NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY \ | NFSACCESS_EXTEND | NFSACCESS_EXECUTE \ | NFSACCESS_DELETE | NFSACCESS_LOOKUP) @@ -3639,6 +3643,7 @@ nfs_allocate(struct vop_allocate_args *ap) struct thread *td = curthread; struct nfsvattr nfsva; struct nfsmount *nmp; + off_t alen; int attrflag, error, ret; attrflag = 0; @@ -3652,12 +3657,16 @@ nfs_allocate(struct vop_allocate_args *ap) * file's allocation on the server. */ error = ncl_flush(vp, MNT_WAIT, td, 1, 0); - if (error == 0) - error = nfsrpc_allocate(vp, *ap->a_offset, *ap->a_len, + if (error == 0) { + alen = *ap->a_len; + if ((uint64_t)alen > nfs_maxalloclen) + alen = nfs_maxalloclen; + error = nfsrpc_allocate(vp, *ap->a_offset, alen, &nfsva, &attrflag, td->td_ucred, td, NULL); + } if (error == 0) { - *ap->a_offset += *ap->a_len; - *ap->a_len = 0; + *ap->a_offset += alen; + *ap->a_len -= alen; } else if (error == NFSERR_NOTSUPP) { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NOALLOCATE; From owner-dev-commits-src-main@freebsd.org Thu Sep 16 06:29:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7167867537E; Thu, 16 Sep 2021 06:29:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H96cs1Txlz50ML; Thu, 16 Sep 2021 06:29:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14C341C8C4; Thu, 16 Sep 2021 06:29:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18G6TWuH030946; Thu, 16 Sep 2021 06:29:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18G6TWMV030945; Thu, 16 Sep 2021 06:29:32 GMT (envelope-from git) Date: Thu, 16 Sep 2021 06:29:32 GMT Message-Id: <202109160629.18G6TWMV030945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: bab406830ab6 - main - stress2: Added more unionfs tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bab406830ab6e9ea777df84991dbae628223422c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 06:29:33 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=bab406830ab6e9ea777df84991dbae628223422c commit bab406830ab6e9ea777df84991dbae628223422c Author: Peter Holm AuthorDate: 2021-09-16 06:29:07 +0000 Commit: Peter Holm CommitDate: 2021-09-16 06:29:07 +0000 stress2: Added more unionfs tests --- tools/test/stress2/misc/all.exclude | 2 + tools/test/stress2/misc/unionfs4.sh | 77 ++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/unionfs5.sh | 83 +++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index d4a57af4d559..5106478ff2d0 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -73,6 +73,8 @@ truss3.sh WiP 20200915 unionfs.sh insmntque: non-locked vp: xx is not exclusive locked... 20130909 unionfs2.sh insmntque: mp-safe fs and non-locked vp is not ... 20111219 unionfs3.sh insmntque: mp-safe fs and non-locked vp is not ... 20111216 +unionfs4.sh WiP 20210916 +unionfs5.sh WiP 20210916 # Test not to run for other reasons: diff --git a/tools/test/stress2/misc/unionfs4.sh b/tools/test/stress2/misc/unionfs4.sh new file mode 100755 index 000000000000..557cead66389 --- /dev/null +++ b/tools/test/stress2/misc/unionfs4.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# 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. +# + +# "mkdir: mkdir(d2), level 2. mkdir.c:96: No such file or directory" seen +# with a non debug kernel. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +# unionfs usage example from the man page: +# mount -t cd9660 -o ro /dev/cd0 /usr/src +# mount -t unionfs -o noatime /var/obj /usr/src + +md1=$mdstart +md2=$((md1 + 1)) +mp1=/mnt$md1 +mp2=/mnt$md2 +mkdir -p $mp1 $mp2 +set -e +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done +for i in $md1 $md2; do + mdconfig -l | grep -q md$i && mdconfig -d -u $i +done + +mdconfig -a -t swap -s 2g -u $md1 +mdconfig -a -t swap -s 2g -u $md2 +newfs $newfs_flags -n md$md1 > /dev/null +newfs $newfs_flags -n md$md2 > /dev/null +mount /dev/md$md1 $mp1 +mount /dev/md$md2 $mp2 + +mount -t unionfs -o noatime $mp1 $mp2 +set +e +mount | grep -E "$mp1|$mp2" + +export RUNDIR=$mp2/stressX +export runRUNTIME=2m + +(cd ..; ./run.sh marcus.cfg) + +../tools/killall.sh +umount $mp2 # The unionfs mount +umount $mp2 +n=`find $mp1/stressX | wc -l` +[ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; } +umount $mp1 +mdconfig -d -u $md2 +mdconfig -d -u $md1 +exit $s diff --git a/tools/test/stress2/misc/unionfs5.sh b/tools/test/stress2/misc/unionfs5.sh new file mode 100755 index 000000000000..ba00fa2b5258 --- /dev/null +++ b/tools/test/stress2/misc/unionfs5.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# 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. +# + +# "mkdir: mkdir(d2), level 2. mkdir.c:96: No such file or directory" seen +# with a non debug kernel. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +# unionfs usage example from the man page: +# mount -t cd9660 -o ro /dev/cd0 /usr/src +# mount -t unionfs -o noatime /var/obj /usr/src + +md1=$mdstart +md2=$((md1 + 1)) +mp1=/mnt$md1 +mp2=/mnt$md2 +mkdir -p $mp1 $mp2 +set -e +for i in $mp1 $mp2; do + mount | grep -q "on $i " && umount -f $i +done +for i in $md1 $md2; do + mdconfig -l | grep -q md$i && mdconfig -d -u $i +done + +mdconfig -a -t swap -s 2g -u $md1 +mdconfig -a -t swap -s 2g -u $md2 +newfs $newfs_flags -n md$md1 > /dev/null +newfs $newfs_flags -n md$md2 > /dev/null +mount /dev/md$md1 $mp1 +mount /dev/md$md2 $mp2 + +mount -t unionfs -o noatime $mp1 $mp2 +set +e +mount | grep -E "$mp1|$mp2" + +if [ $# -eq 0 ]; then + echo "Using unionfs" + export RUNDIR=$mp2/stressX +else + echo "Using FFS" + export RUNDIR=$mp1/stressX +fi +export runRUNTIME=2m + +(cd ../testcases/mkdir; ./mkdir -t 2m -i 20) + +find $RUNDIR -ls +umount $mp2 # The unionfs mount +umount $mp2 +n=`find $mp1/stressX | wc -l` +[ $n -eq 1 ] && s=0 || s=1 +umount $mp1 +mdconfig -d -u $md2 +mdconfig -d -u $md1 +exit $s From owner-dev-commits-src-main@freebsd.org Thu Sep 16 07:32:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F7A1676688; Thu, 16 Sep 2021 07:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H981g2v5Sz3JKw; Thu, 16 Sep 2021 07:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F8C1D456; Thu, 16 Sep 2021 07:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18G7Wdmv023267; Thu, 16 Sep 2021 07:32:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18G7Wdi9023266; Thu, 16 Sep 2021 07:32:39 GMT (envelope-from git) Date: Thu, 16 Sep 2021 07:32:39 GMT Message-Id: <202109160732.18G7Wdi9023266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 12061d2626e0 - main - diff: link with libm for sqrt() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12061d2626e095cd5a5cbadeb567916e7d74db5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 07:32:39 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=12061d2626e095cd5a5cbadeb567916e7d74db5a commit 12061d2626e095cd5a5cbadeb567916e7d74db5a Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-16 07:27:29 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-16 07:31:44 +0000 diff: link with libm for sqrt() Reported by: Jenkins Fixes: bcf2e78dc48378456798191f1c15cb76d6221a65 --- usr.bin/diff/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/diff/Makefile b/usr.bin/diff/Makefile index a9f79d3d81e1..4879570306ba 100644 --- a/usr.bin/diff/Makefile +++ b/usr.bin/diff/Makefile @@ -4,6 +4,7 @@ PROG= diff SRCS= diff.c diffdir.c diffreg.c xmalloc.c pr.c +LIBADD= m HAS_TESTS= SUBDIR.${MK_TESTS}+= tests From owner-dev-commits-src-main@freebsd.org Thu Sep 16 14:42:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B96F567BCCC for ; Thu, 16 Sep 2021 14:42:59 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9KZC0vypz3Msd for ; Thu, 16 Sep 2021 14:42:59 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-wm1-x32d.google.com with SMTP id n7-20020a05600c3b8700b002f8ca941d89so4695337wms.2 for ; Thu, 16 Sep 2021 07:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=i7mBcaDkSn94e8RP7FCI1AZ1+h9Wj6YJO4UatMLd9gA=; b=XVxibuxFx0+P/uadulasGk46jM5jPLv8033zKJun26WUhLmLA9P4AFJcw7gXle7w1i dDPl4CIE9+sl6q/9bTyMIjFD8KVSHL54ju8yGxDh0i9MchLVNLib8IvcKLsxEDqklEWh nJffUlSPIYFHPWF+icc+2OWLwX5rbQEQube8pchjraz4Kf9++GHCKYowFWGECiki/H0v 530MhjbD2VrtZRN+ICQEQArYdcdzGAwiOVVOjjPZxUI6iBDihzyIyUb/Bn3c1eLOkE6n aPsbwlAI05uZSWYo07E+wp/zD5pdFsGPN8/q1C0tZ2R61cL7HwiXA1Avy+hmDtw7lTln Pv4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=i7mBcaDkSn94e8RP7FCI1AZ1+h9Wj6YJO4UatMLd9gA=; b=lXsq4Zbybszj04IrDZ/q4oSq7UaVeWBxRnEAYFmziXfYskaODRw9TsSkA7wyR0lbNW LxlKCz8P7/rk1q/+lSptynLOAQW5hrhM3vKRiKmYw2Mr0GP9JhfpqIbXKPSvSuTbTu7V 7XhhC4n9PfRB7rMK7bo0fASHZ0dAphmMZX+JsGam8Emr1vrzyu6RHsSlOakervpULqtb OUegK5pRD80Ao2LfFdWAV25Q/KhwVpcYEBrgDR5Ae1ZsI4EAMEIyD6taw1i3lyt1XmDl NlglgJSE8exvACEqFjoxnzzdgZOxm0CLQ+gq8JOOcmvU0rDT0R+aUWEqn13fCHHLDrx2 U68A== X-Gm-Message-State: AOAM530hsgJSOR97/RnjUMfaHTMYDPs1i6ePLrELJYzOwDIE+dkgn2td EeUXoqMdyEEoUvS7adulhrUZMA8Xqf4FiaEEvMSufg== X-Google-Smtp-Source: ABdhPJwPVnNs/MXRlhMME3LSpZzaULVaRvdAmiF2BiyLu+vDuMTIsgulT8YRo8ioDH3eI6OqW4d5/jeHGOSph5NlFRA= X-Received: by 2002:a05:600c:3656:: with SMTP id y22mr10425673wmq.58.1631803377766; Thu, 16 Sep 2021 07:42:57 -0700 (PDT) MIME-Version: 1.0 References: <202109151318.18FDIppM059878@gitrepo.freebsd.org> In-Reply-To: From: Marcin Wojtas Date: Thu, 16 Sep 2021 16:42:45 +0200 Message-ID: Subject: Re: git: 2de4c7f6d087 - main - pci_host_generic: Add Synopsys Designware PCIe controller quirk To: Jessica Clarke Cc: Marcin Wojtas , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4H9KZC0vypz3Msd X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20210112.gappssmtp.com header.s=20210112 header.b=XVxibuxF; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2a00:1450:4864:20::32d) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-3.28 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20210112.gappssmtp.com:s=20210112]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20210112.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.98)[-0.977]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::32d:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 14:42:59 -0000 =C5=9Br., 15 wrz 2021 o 15:21 Jessica Clarke napisa=C5= =82(a): > > On 15 Sep 2021, at 14:18, Marcin Wojtas wrote: > > > > The branch main has been updated by mw: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D2de4c7f6d08798fb62695829= 07155703d1ab5ef4 > > > > commit 2de4c7f6d08798fb6269582907155703d1ab5ef4 > > Author: Pawel Anikiel > > AuthorDate: 2021-09-13 14:59:40 +0000 > > Commit: Marcin Wojtas > > CommitDate: 2021-09-15 13:17:40 +0000 > > > > pci_host_generic: Add Synopsys Designware PCIe controller quirk > > > > Due to the quirky nature of the Synopsys Designware PCIe IP, > > the type 0 configuration is broadcast and whatever device > > is plugged into slot, will appear at each 32 device > > positions of bus0. Mitigate the issue by filtering out > > duplicated devices on this bus for both DT and ACPI cases. > > > > Reviewed by: mw > > Sponsored by: Semihalf > > MFC: after 3 weeks > > Differential revision: https://reviews.freebsd.org/D31887 > > --- > > sys/dev/pci/pci_host_generic.c | 2 ++ > > sys/dev/pci/pci_host_generic.h | 4 ++++ > > sys/dev/pci/pci_host_generic_acpi.c | 33 ++++++++++++++++++++++++++++++= +++ > > sys/dev/pci/pci_host_generic_fdt.c | 7 +++++++ > > 4 files changed, 46 insertions(+) > > > > diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_gene= ric.c > > index 0c45f5d316ed..22b3ccdc17b1 100644 > > --- a/sys/dev/pci/pci_host_generic.c > > +++ b/sys/dev/pci/pci_host_generic.c > > @@ -185,6 +185,8 @@ generic_pcie_read_config(device_t dev, u_int bus, u= _int slot, > > if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || > > (reg > PCIE_REGMAX)) > > return (~0U); > > + if ((sc->quirks & PCIE_ECAM_DESIGNWARE_QUIRK) && bus =3D=3D 0 && = slot > 0) > > + return (~0U); > > > > offset =3D PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg)= ; > > t =3D sc->bst; > > diff --git a/sys/dev/pci/pci_host_generic.h b/sys/dev/pci/pci_host_gene= ric.h > > index 36a12b9559ba..20117cbe32e3 100644 > > --- a/sys/dev/pci/pci_host_generic.h > > +++ b/sys/dev/pci/pci_host_generic.h > > @@ -85,8 +85,12 @@ struct generic_pcie_core_softc { > > device_t dev; > > bus_space_handle_t ioh; > > bus_dma_tag_t dmat; > > + uint32_t quirks; > > }; > > > > +/* Quirks */ > > +#define PCIE_ECAM_DESIGNWARE_QUIRK (1 << 0) > > + > > DECLARE_CLASS(generic_pcie_core_driver); > > > > int pci_host_generic_core_attach(device_t); > > diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host= _generic_acpi.c > > index 763a84d2fd53..3c32abc5007a 100644 > > --- a/sys/dev/pci/pci_host_generic_acpi.c > > +++ b/sys/dev/pci/pci_host_generic_acpi.c > > @@ -89,6 +89,21 @@ __FBSDID("$FreeBSD$"); > > #define PROPS_CELL_SIZE 1 > > #define PCI_ADDR_CELL_SIZE 2 > > > > +static struct { > > + char oem_id[ACPI_OEM_ID_SIZE + 1]; > > + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1]; > > + uint32_t quirks; > > +} pci_acpi_quirks[] =3D { > > + { "MRVL ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MRVL ", "CN913X ", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MVEBU ", "ARMADA7K", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MVEBU ", "ARMADA8K", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MVEBU ", "CN9130 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MVEBU ", "CN9131 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { "MVEBU ", "CN9132 ", PCIE_ECAM_DESIGNWARE_QUIRK }, > > + { 0 }, > > +}; > > + > > /* Forward prototypes */ > > > > static int generic_pcie_acpi_probe(device_t dev); > > @@ -170,6 +185,23 @@ pci_host_generic_acpi_parse_resource(ACPI_RESOURCE= *res, void *arg) > > return (AE_OK); > > } > > > > +static void > > +pci_host_acpi_get_oem_quirks(struct generic_pcie_acpi_softc *sc, > > + ACPI_TABLE_HEADER *hdr) > > +{ > > + int i; > > + > > + for (i =3D 0; pci_acpi_quirks[i].quirks; i++) { > > + if (memcmp(hdr->OemId, pci_acpi_quirks[i].oem_id, > > + ACPI_OEM_ID_SIZE) !=3D 0) > > + continue; > > + if (memcmp(hdr->OemTableId, pci_acpi_quirks[i].oem_table_= id, > > + ACPI_OEM_TABLE_ID_SIZE) !=3D 0) > > + continue; > > + sc->base.quirks |=3D pci_acpi_quirks[i].quirks; > > + } > > +} > > + > > static int > > pci_host_acpi_get_ecam_resource(device_t dev) > > { > > @@ -209,6 +241,7 @@ pci_host_acpi_get_ecam_resource(device_t dev) > > sc->base.bus_start, sc->base.bus_end); > > return (ENXIO); > > } > > + pci_host_acpi_get_oem_quirks(sc, hdr); > > } else { > > status =3D acpi_GetInteger(handle, "_CBA", &val); > > if (ACPI_SUCCESS(status)) > > diff --git a/sys/dev/pci/pci_host_generic_fdt.c b/sys/dev/pci/pci_host_= generic_fdt.c > > index 91ffaf7357b9..249637019137 100644 > > --- a/sys/dev/pci/pci_host_generic_fdt.c > > +++ b/sys/dev/pci/pci_host_generic_fdt.c > > @@ -151,6 +151,13 @@ pci_host_generic_setup_fdt(device_t dev) > > if (error !=3D 0) > > return (error); > > > > + if (ofw_bus_is_compatible(dev, "marvell,armada8k-pcie-ecam") || > > + ofw_bus_is_compatible(dev, "socionext,synquacer-pcie-ecam") |= | > > + ofw_bus_is_compatible(dev, "snps,dw-pcie-ecam")) { > > + device_set_desc(dev, "Synopsys DesignWare PCIe Controller= "); > > It seems inconsistent to set this for _fdt but not _acpi? > Indeed, thanks for noticing. I'll commit an update right away. Thanks, Marcin From owner-dev-commits-src-main@freebsd.org Thu Sep 16 14:43:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DD5A67BF7C; Thu, 16 Sep 2021 14:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9KbH1HRZz3N4j; Thu, 16 Sep 2021 14:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C61D232E5; Thu, 16 Sep 2021 14:43:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GEhs8o093676; Thu, 16 Sep 2021 14:43:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GEhs3I093675; Thu, 16 Sep 2021 14:43:54 GMT (envelope-from git) Date: Thu, 16 Sep 2021 14:43:54 GMT Message-Id: <202109161443.18GEhs3I093675@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marko Zec Subject: git: eb3148cc4d25 - main - [fib algo][dxr] Fix division by zero. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zec X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb3148cc4d256c20b5c7c9052539139b6f57f58b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 14:43:55 -0000 The branch main has been updated by zec: URL: https://cgit.FreeBSD.org/src/commit/?id=eb3148cc4d256c20b5c7c9052539139b6f57f58b commit eb3148cc4d256c20b5c7c9052539139b6f57f58b Author: Marko Zec AuthorDate: 2021-09-16 14:34:05 +0000 Commit: Marko Zec CommitDate: 2021-09-16 14:34:05 +0000 [fib algo][dxr] Fix division by zero. A division by zero would occur if DXR would be activated on a vnet with no IP addresses configured on any interfaces. PR: 257965 MFC after: 3 days Reported by: Raul Munoz --- sys/netinet/in_fib_dxr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c index 3c4e5700cd6c..3aa357cadedc 100644 --- a/sys/netinet/in_fib_dxr.c +++ b/sys/netinet/in_fib_dxr.c @@ -982,7 +982,9 @@ dxr2_try_squeeze: FIB_PRINTF(LOG_INFO, da->fd, "D%dR, %d prefixes, %d nhops (max)", DXR_D, rinfo.num_prefixes, rinfo.num_nhops); #endif - i = dxr_tot_size * 100 / rinfo.num_prefixes; + i = dxr_tot_size * 100; + if (rinfo.num_prefixes) + i /= rinfo.num_prefixes; FIB_PRINTF(LOG_INFO, da->fd, "%d.%02d KBytes, %d.%02d Bytes/prefix", dxr_tot_size / 1024, dxr_tot_size * 100 / 1024 % 100, i / 100, i % 100); From owner-dev-commits-src-main@freebsd.org Thu Sep 16 14:53:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32A6E67C020; Thu, 16 Sep 2021 14:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9KpF0kjJz3hBK; Thu, 16 Sep 2021 14:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDD9023831; Thu, 16 Sep 2021 14:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GErObC006780; Thu, 16 Sep 2021 14:53:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GErOJC006779; Thu, 16 Sep 2021 14:53:24 GMT (envelope-from git) Date: Thu, 16 Sep 2021 14:53:24 GMT Message-Id: <202109161453.18GErOJC006779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: a3f0d18237bd - main - ena: fix building in-kernel driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3f0d18237bdcf272461d3b4b682de384c572144 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 14:53:25 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=a3f0d18237bdcf272461d3b4b682de384c572144 commit a3f0d18237bdcf272461d3b4b682de384c572144 Author: Artur Rojek AuthorDate: 2021-09-16 12:14:54 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-16 14:47:45 +0000 ena: fix building in-kernel driver When building ENA as compiled into the kernel, the driver would fail to build. Resolve the problem by introducing the following changes: 1. Add missing `ena_rss.c` entry in `sys/conf/files`. 2. Prevent SYSCTL_ADD_INT from throwing an assert due to an extra CTLTYPE_INT flag. Fixes: 986e7b92276 ("ena: Move RSS logic into its own source files") Fixes: 6d1ef2abd33 ("ena: Implement full RSS reconfiguration") Obtained from: Semihalf Sponsored by: Amazon, Inc. MFC after: 1 week --- sys/conf/files | 2 ++ sys/dev/ena/ena_sysctl.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index eb0c489b7833..4dd0151945bb 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1695,6 +1695,8 @@ dev/ena/ena_datapath.c optional ena \ compile-with "${NORMAL_C} -I$S/contrib" dev/ena/ena_netmap.c optional ena \ compile-with "${NORMAL_C} -I$S/contrib" +dev/ena/ena_rss.c optional ena \ + compile-with "${NORMAL_C} -I$S/contrib" dev/ena/ena_sysctl.c optional ena \ compile-with "${NORMAL_C} -I$S/contrib" contrib/ena-com/ena_com.c optional ena diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c index db3eb69cd369..7337f6578e68 100644 --- a/sys/dev/ena/ena_sysctl.c +++ b/sys/dev/ena/ena_sysctl.c @@ -456,7 +456,7 @@ ena_sysctl_add_rss(struct ena_adapter *adapter) /* RSS indirection table size */ SYSCTL_ADD_INT(ctx, child, OID_AUTO, "indir_table_size", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &ena_rss_table_size, 0, + CTLFLAG_RD | CTLFLAG_MPSAFE, &ena_rss_table_size, 0, "RSS indirection table size."); } #endif /* RSS */ From owner-dev-commits-src-main@freebsd.org Thu Sep 16 14:53:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88A1467C025; Thu, 16 Sep 2021 14:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9KpG2m6Lz3hGY; Thu, 16 Sep 2021 14:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3026723832; Thu, 16 Sep 2021 14:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GErQpE006804; Thu, 16 Sep 2021 14:53:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GErQVq006803; Thu, 16 Sep 2021 14:53:26 GMT (envelope-from git) Date: Thu, 16 Sep 2021 14:53:26 GMT Message-Id: <202109161453.18GErQVq006803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: e8a872536042 - main - pci_host_generic: update Synopsys device description for ACPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8a872536042970b4dbf14dc75755a352fb14488 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 14:53:26 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=e8a872536042970b4dbf14dc75755a352fb14488 commit e8a872536042970b4dbf14dc75755a352fb14488 Author: Marcin Wojtas AuthorDate: 2021-09-16 14:39:42 +0000 Commit: Marcin Wojtas CommitDate: 2021-09-16 14:53:11 +0000 pci_host_generic: update Synopsys device description for ACPI The recent addition of Synopsys ECAM quirk set the device description only for the DT variant. Do the same in ACPI case. Reported by: jrtc27 --- sys/dev/pci/pci_host_generic_acpi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c index 3c32abc5007a..9628517813a9 100644 --- a/sys/dev/pci/pci_host_generic_acpi.c +++ b/sys/dev/pci/pci_host_generic_acpi.c @@ -242,6 +242,8 @@ pci_host_acpi_get_ecam_resource(device_t dev) return (ENXIO); } pci_host_acpi_get_oem_quirks(sc, hdr); + if (sc->base.quirks & PCIE_ECAM_DESIGNWARE_QUIRK) + device_set_desc(dev, "Synopsys DesignWare PCIe Controller"); } else { status = acpi_GetInteger(handle, "_CBA", &val); if (ACPI_SUCCESS(status)) From owner-dev-commits-src-main@freebsd.org Thu Sep 16 15:32:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8B3C67C6D5 for ; Thu, 16 Sep 2021 15:32:43 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9Lgb4fYDz3tVY for ; Thu, 16 Sep 2021 15:32:43 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2c.google.com with SMTP id y16so13747086ybm.3 for ; Thu, 16 Sep 2021 08:32:43 -0700 (PDT) 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=uwy6Cqv8pJIoup6Q4kenXO/Jmyt3MWnzMTvgAHeGurU=; b=PdkC3CoGO+sbnNXgeqFOcH9eb6HLpSA6JJxrmKxUZJGuvOGnjNMt+3IT/tUAy63igj s+psC72Rg7do1xHlnNW05d7T2ewrfByQs/WJ6YnNeJOd36JxBRCCtkAOrh49Gf4qZ07N LH5uHdPc4G1gXNJZjbueFZxJLOpdlDpzznoT0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uwy6Cqv8pJIoup6Q4kenXO/Jmyt3MWnzMTvgAHeGurU=; b=NmTZIT28xu5nTLYlNc2PrISmn58GDAzL5c9IqT/xNUL5MrF8AEakX3UQMq65G6L9+F kIIh8e8qoi0Vg4Rh1hI1bqGfjIBZmYG2i06sN91E9OYmwFBiJIslAKYh0uzr9LQAz3Yo RICm4tO8EpiyJgni2RtuN2JxF2A7UTIXjBO/Jl8yta/VoqxtHqFyQ7/GmZfsb6iV1R63 ybV6cugw7dUha7IlfAOlOY2maoIw0jtIbdmulSxWM1usY1pinRGJx6Bc3wFTgCsn/epL m92ZZrP9KfuuN8sAmDbH19XqrjAGUxIf45Ap/oRyr8gVJ5rAEvjTQEcYyxvDkFhAnBLj Ex0g== X-Gm-Message-State: AOAM5322sHBNCywEQuA5qS4UenJlvXpdB9B/tdMn+5ln3sUpDqI4Tcut r+cXVVm8Ub5N3UWGlnHMO8whyWP/Hu9hOs/DehOfl2/qRvt8GzEI X-Google-Smtp-Source: ABdhPJzmhwGwTPKNhNNhT81vLfvcDAy0TOJaZ83msno4kkBZmiZU4iRc0gmmwqPIX2EnsN7tbfQNcH2sDhVmdceryrc= X-Received: by 2002:a25:3d84:: with SMTP id k126mr7769971yba.43.1631806362791; Thu, 16 Sep 2021 08:32:42 -0700 (PDT) MIME-Version: 1.0 References: <202109152233.18FMX2qw004740@gitrepo.freebsd.org> In-Reply-To: <202109152233.18FMX2qw004740@gitrepo.freebsd.org> From: Kevin Bowling Date: Thu, 16 Sep 2021 08:32:32 +0000 Message-ID: Subject: Re: git: 2796f7cab107 - main - e1000: Fix up HW vlan ops To: Kevin Bowling Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H9Lgb4fYDz3tVY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 15:32:43 -0000 PR mentioned should have been 258258 with 230996 as a partial On Wed, Sep 15, 2021 at 10:33 PM Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=2796f7cab10785ef40efbba97ef67ab319c96e9c > > commit 2796f7cab10785ef40efbba97ef67ab319c96e9c > Author: Kevin Bowling > AuthorDate: 2021-09-15 14:47:19 +0000 > Commit: Kevin Bowling > CommitDate: 2021-09-15 15:03:01 +0000 > > e1000: Fix up HW vlan ops > > * Don't reset the entire adapter for vlan changes, fix up the problems > * Add some functions for vlan filter (vfta) manipulation > * Don't muck with the vfta if we aren't doing HW vlan filtering > * Disable interrupts when manipulating vfta on lem(4)-class NICs > * On the I350 there is a specification update (2.4.20) in which the > suggested workaround is to write to the vfta 10 times (if at first you > don't succeed, try, try again). Our shared code has the goods, use it > * Increase a VF's frame receive size in the case of vlans > > From the referenced PR, this reduced vlan configuration from minutes > to seconds with hundreds or thousands of vlans and prevents wedging the > adapter with needless adapter reinitialization for each vlan ID. > > PR: 230996 > Reviewed by: markj > Tested by: Ozkan KIRIK > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D30002 > --- > sys/dev/e1000/if_em.c | 166 ++++++++++++++++++++++++++++++++++++++------------ > 1 file changed, 126 insertions(+), 40 deletions(-) > > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > index 6e3a8f73190f..7900e550c55f 100644 > --- a/sys/dev/e1000/if_em.c > +++ b/sys/dev/e1000/if_em.c > @@ -297,6 +297,11 @@ static void em_if_debug(if_ctx_t ctx); > static void em_update_stats_counters(struct adapter *); > static void em_add_hw_stats(struct adapter *adapter); > static int em_if_set_promisc(if_ctx_t ctx, int flags); > +static bool em_if_vlan_filter_capable(struct adapter *); > +static bool em_if_vlan_filter_used(struct adapter *); > +static void em_if_vlan_filter_enable(struct adapter *); > +static void em_if_vlan_filter_disable(struct adapter *); > +static void em_if_vlan_filter_write(struct adapter *); > static void em_setup_vlan_hw_support(struct adapter *); > static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); > static void em_print_nvm_info(struct adapter *); > @@ -906,6 +911,9 @@ em_if_attach_pre(if_ctx_t ctx) > scctx->isc_capabilities = scctx->isc_capenable = LEM_CAPS; > if (hw->mac.type < e1000_82543) > scctx->isc_capenable &= ~(IFCAP_HWCSUM|IFCAP_VLAN_HWCSUM); > + /* 82541ER doesn't do HW tagging */ > + if (hw->device_id == E1000_DEV_ID_82541ER || hw->device_id == E1000_DEV_ID_82541ER_LOM) > + scctx->isc_capenable &= ~IFCAP_VLAN_HWTAGGING; > /* INTx only */ > scctx->isc_msix_bar = 0; > } > @@ -1335,23 +1343,8 @@ em_if_init(if_ctx_t ctx) > adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); > em_initialize_receive_unit(ctx); > > - /* Use real VLAN Filter support? */ > - if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { > - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) > - /* Use real VLAN Filter support */ > - em_setup_vlan_hw_support(adapter); > - else { > - u32 ctrl; > - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); > - ctrl |= E1000_CTRL_VME; > - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); > - } > - } else { > - u32 ctrl; > - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); > - ctrl &= ~E1000_CTRL_VME; > - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); > - } > + /* Set up VLAN support and filter */ > + em_setup_vlan_hw_support(adapter); > > /* Don't lose promiscuous settings */ > em_if_set_promisc(ctx, if_getflags(ifp)); > @@ -1670,14 +1663,19 @@ em_if_set_promisc(if_ctx_t ctx, int flags) > > if (flags & IFF_PROMISC) { > reg_rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); > + em_if_vlan_filter_disable(adapter); > /* Turn this on if you want to see bad packets */ > if (em_debug_sbp) > reg_rctl |= E1000_RCTL_SBP; > E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); > - } else if (flags & IFF_ALLMULTI) { > - reg_rctl |= E1000_RCTL_MPE; > - reg_rctl &= ~E1000_RCTL_UPE; > - E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); > + } else { > + if (flags & IFF_ALLMULTI) { > + reg_rctl |= E1000_RCTL_MPE; > + reg_rctl &= ~E1000_RCTL_UPE; > + E1000_WRITE_REG(&adapter->hw, E1000_RCTL, reg_rctl); > + } > + if (em_if_vlan_filter_used(adapter)) > + em_if_vlan_filter_enable(adapter); > } > return (0); > } > @@ -3323,7 +3321,11 @@ em_initialize_receive_unit(if_ctx_t ctx) > /* are we on a vlan? */ > if (ifp->if_vlantrunk != NULL) > psize += VLAN_TAG_SIZE; > - E1000_WRITE_REG(hw, E1000_RLPML, psize); > + > + if (adapter->vf_ifp) > + e1000_rlpml_set_vf(hw, pszie); > + else > + E1000_WRITE_REG(hw, E1000_RLPML, psize); > } > > /* Set maximum packet buffer len */ > @@ -3420,6 +3422,7 @@ em_if_vlan_register(if_ctx_t ctx, u16 vtag) > bit = vtag & 0x1F; > adapter->shadow_vfta[index] |= (1 << bit); > ++adapter->num_vlans; > + em_if_vlan_filter_write(adapter); > } > > static void > @@ -3432,41 +3435,121 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) > bit = vtag & 0x1F; > adapter->shadow_vfta[index] &= ~(1 << bit); > --adapter->num_vlans; > + em_if_vlan_filter_write(adapter); > +} > + > +static bool > +em_if_vlan_filter_capable(struct adapter *adapter) > +{ > + if_softc_ctx_t scctx = adapter->shared; > + > + if ((scctx->isc_capenable & IFCAP_VLAN_HWFILTER) && > + !em_disable_crc_stripping) > + return (true); > + > + return (false); > +} > + > +static bool > +em_if_vlan_filter_used(struct adapter *adapter) > +{ > + if (!em_if_vlan_filter_capable(adapter)) > + return (false); > + > + for (int i = 0; i < EM_VFTA_SIZE; i++) > + if (adapter->shadow_vfta[i] != 0) > + return (true); > + > + return (false); > +} > + > +static void > +em_if_vlan_filter_enable(struct adapter *adapter) > +{ > + struct e1000_hw *hw = &adapter->hw; > + u32 reg; > + > + reg = E1000_READ_REG(hw, E1000_RCTL); > + reg &= ~E1000_RCTL_CFIEN; > + reg |= E1000_RCTL_VFE; > + E1000_WRITE_REG(hw, E1000_RCTL, reg); > +} > + > +static void > +em_if_vlan_filter_disable(struct adapter *adapter) > +{ > + struct e1000_hw *hw = &adapter->hw; > + u32 reg; > + > + reg = E1000_READ_REG(hw, E1000_RCTL); > + reg &= ~(E1000_RCTL_VFE | E1000_RCTL_CFIEN); > + E1000_WRITE_REG(hw, E1000_RCTL, reg); > +} > + > +static void > +em_if_vlan_filter_write(struct adapter *adapter) > +{ > + struct e1000_hw *hw = &adapter->hw; > + > + if (adapter->vf_ifp) > + return; > + > + /* Disable interrupts for lem-class devices during the filter change */ > + if (hw->mac.type < em_mac_min) > + em_if_intr_disable(adapter->ctx); > + > + for (int i = 0; i < EM_VFTA_SIZE; i++) > + if (adapter->shadow_vfta[i] != 0) { > + /* XXXKB: incomplete VF support, we return early above */ > + if (adapter->vf_ifp) > + e1000_vfta_set_vf(hw, adapter->shadow_vfta[i], TRUE); > + else > + e1000_write_vfta(hw, i, adapter->shadow_vfta[i]); > + } > + > + /* Re-enable interrupts for lem-class devices */ > + if (hw->mac.type < em_mac_min) > + em_if_intr_enable(adapter->ctx); > } > > static void > em_setup_vlan_hw_support(struct adapter *adapter) > { > + if_softc_ctx_t scctx = adapter->shared; > struct e1000_hw *hw = &adapter->hw; > u32 reg; > > - /* > - * We get here thru init_locked, meaning > - * a soft reset, this has already cleared > - * the VFTA and other state, so if there > - * have been no vlan's registered do nothing. > + /* XXXKB: Return early if we are a VF until VF decap and filter management > + * is ready and tested. > */ > - if (adapter->num_vlans == 0) > + if (adapter->vf_ifp) > + return; > + > + if (scctx->isc_capenable & IFCAP_VLAN_HWTAGGING && > + !em_disable_crc_stripping) { > + reg = E1000_READ_REG(hw, E1000_CTRL); > + reg |= E1000_CTRL_VME; > + E1000_WRITE_REG(hw, E1000_CTRL, reg); > + } else { > + reg = E1000_READ_REG(hw, E1000_CTRL); > + reg &= ~E1000_CTRL_VME; > + E1000_WRITE_REG(hw, E1000_CTRL, reg); > + } > + > + /* If we aren't doing HW filtering, we're done */ > + if (!em_if_vlan_filter_capable(adapter)) { > + em_if_vlan_filter_disable(adapter); > return; > + } > > /* > * A soft reset zero's out the VFTA, so > * we need to repopulate it now. > */ > - for (int i = 0; i < EM_VFTA_SIZE; i++) > - if (adapter->shadow_vfta[i] != 0) > - E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, > - i, adapter->shadow_vfta[i]); > - > - reg = E1000_READ_REG(hw, E1000_CTRL); > - reg |= E1000_CTRL_VME; > - E1000_WRITE_REG(hw, E1000_CTRL, reg); > + em_if_vlan_filter_write(adapter); > > /* Enable the Filter Table */ > - reg = E1000_READ_REG(hw, E1000_RCTL); > - reg &= ~E1000_RCTL_CFIEN; > - reg |= E1000_RCTL_VFE; > - E1000_WRITE_REG(hw, E1000_RCTL, reg); > + em_if_vlan_filter_enable(adapter); > } > > static void > @@ -3481,6 +3564,7 @@ em_if_intr_enable(if_ctx_t ctx) > ims_mask |= adapter->ims; > } > E1000_WRITE_REG(hw, E1000_IMS, ims_mask); > + E1000_WRITE_FLUSH(hw); > } > > static void > @@ -3492,6 +3576,7 @@ em_if_intr_disable(if_ctx_t ctx) > if (adapter->intr_type == IFLIB_INTR_MSIX) > E1000_WRITE_REG(hw, EM_EIAC, 0); > E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); > + E1000_WRITE_FLUSH(hw); > } > > static void > @@ -4101,6 +4186,7 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) > { > switch (event) { > case IFLIB_RESTART_VLAN_CONFIG: > + return (false); > default: > return (true); > } > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Thu Sep 16 17:10:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E55FA67D940; Thu, 16 Sep 2021 17:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9NrZ5wmMz4qpw; Thu, 16 Sep 2021 17:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AADF625461; Thu, 16 Sep 2021 17:10:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GHAcrB089874; Thu, 16 Sep 2021 17:10:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GHAcB2089873; Thu, 16 Sep 2021 17:10:38 GMT (envelope-from git) Date: Thu, 16 Sep 2021 17:10:38 GMT Message-Id: <202109161710.18GHAcB2089873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 181bfb42fd01 - main - vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 181bfb42fd01bfa9f4636e803ccb3eeed8ac8ba4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 17:10:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=181bfb42fd01bfa9f4636e803ccb3eeed8ac8ba4 commit 181bfb42fd01bfa9f4636e803ccb3eeed8ac8ba4 Author: Konstantin Belousov AuthorDate: 2021-09-14 12:25:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-16 17:01:19 +0000 vm_phys: do not ignore phys_avail[] segments that do not fit completely into vm_phys segments If phys_avail[] segment only intersect with some vm_phys segment, add pages from it to the free list that belong to the given vm_phys_seg, instead of dropping them. The vm_phys segments are generally result of subdivision of phys_avail segments, for instance DMA32 or LOWMEM boundaries split them. On amd64, after UEFI in-place kernel activation (copy_staging disable) was enabled, we typically have a large phys_avail[] segment below 4G which crosses LOWMEM (1M) boundary. With the current way of requiring phys_avail[] fully fit into vm_phys_seg, this memory was ignored. Reported by: madpilot Reviewed by: markj Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31958 --- sys/vm/vm_page.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 4ecea30e9219..d2e94ced6766 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -552,11 +552,12 @@ vm_offset_t vm_page_startup(vm_offset_t vaddr) { struct vm_phys_seg *seg; + struct vm_domain *vmd; vm_page_t m; char *list, *listend; vm_paddr_t end, high_avail, low_avail, new_end, size; vm_paddr_t page_range __unused; - vm_paddr_t last_pa, pa; + vm_paddr_t last_pa, pa, startp, endp; u_long pagecount; #if MINIDUMP_PAGE_TRACKING u_long vm_page_dump_size; @@ -770,21 +771,20 @@ vm_page_startup(vm_offset_t vaddr) vm_page_init_page(m, pa, segind); /* - * Add the segment to the free lists only if it is covered by - * one of the ranges in phys_avail. Because we've added the - * ranges to the vm_phys_segs array, we can assume that each - * segment is either entirely contained in one of the ranges, - * or doesn't overlap any of them. + * Add the segment's pages that are covered by one of + * phys_avail's ranges to the free lists. */ for (i = 0; phys_avail[i + 1] != 0; i += 2) { - struct vm_domain *vmd; - - if (seg->start < phys_avail[i] || - seg->end > phys_avail[i + 1]) + if (seg->end < phys_avail[i] || + seg->start >= phys_avail[i + 1]) continue; - m = seg->first_page; - pagecount = (u_long)atop(seg->end - seg->start); + startp = MAX(seg->start, phys_avail[i]); + m = seg->first_page + atop(seg->start - startp); + endp = MIN(seg->end, phys_avail[i + 1]); + pagecount = (u_long)atop(endp - startp); + if (pagecount == 0) + continue; vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); @@ -796,7 +796,6 @@ vm_page_startup(vm_offset_t vaddr) vmd = VM_DOMAIN(seg->domain); vmd->vmd_page_count += (u_int)pagecount; vmd->vmd_segs |= 1UL << m->segind; - break; } } From owner-dev-commits-src-main@freebsd.org Thu Sep 16 17:26:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D337167E0CD; Thu, 16 Sep 2021 17:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9PCK5Mjpz4tsX; Thu, 16 Sep 2021 17:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9893025918; Thu, 16 Sep 2021 17:26:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GHQraH006748; Thu, 16 Sep 2021 17:26:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GHQrX4006747; Thu, 16 Sep 2021 17:26:53 GMT (envelope-from git) Date: Thu, 16 Sep 2021 17:26:53 GMT Message-Id: <202109161726.18GHQrX4006747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f575573ca577 - main - Remove PT_GET_SC_ARGS_ALL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f575573ca57716395ad88b962388a55d755cf6a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 17:26:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f575573ca57716395ad88b962388a55d755cf6a7 commit f575573ca57716395ad88b962388a55d755cf6a7 Author: Konstantin Belousov AuthorDate: 2021-09-15 13:24:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-16 17:11:27 +0000 Remove PT_GET_SC_ARGS_ALL Reimplement bdf0f24bb16d556a5b by checking for the caller' ABI in the implementation of PT_GET_SC_ARGS, and copying out everything if it is Linuxolator. Also fix a minor information leak: if PT_GET_SC_ARGS_ALL is done on the thread reused after other process, it allows to read some number of that thread last syscall arguments. Clear td_sa.args in thread_alloc(). Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D31968 --- lib/libsysdecode/mktables | 2 +- sys/amd64/linux/linux_ptrace.c | 18 ++++++++++-------- sys/compat/freebsd32/freebsd32_misc.c | 3 --- sys/kern/kern_thread.c | 1 + sys/kern/sys_process.c | 23 ++++------------------- sys/sys/ptrace.h | 4 ---- 6 files changed, 16 insertions(+), 35 deletions(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 1c263fd3b0b2..3d152a3a2646 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -116,7 +116,7 @@ gen_table "nfssvcflags" "NFSSVC_[A-Z0-9]+[[:space:]]+0x[0-9]+" "nfs/ gen_table "pathconfname" "_PC_[A-Z4_]+[[:space:]]+[0-9]+" "sys/unistd.h" gen_table "prio" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" gen_table "procctlcmd" "PROC_[A-Z_]+[[:space:]]+[0-9]" "sys/procctl.h" "PROC_TRACE_CTL_" -gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" "PT_GET_SC_ARGS_ALL" +gen_table "ptraceop" "PT_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/ptrace.h" gen_table "quotactlcmds" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h" gen_table "rebootopt" "RB_[A-Z]+[[:space:]]+0x[0-9]+" "sys/reboot.h" gen_table "rforkflags" "RF[A-Z]+[[:space:]]+\([0-9]+<<[0-9]+\)" "sys/unistd.h" diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index 70e52c528c72..eb39e3c9ada6 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -544,17 +544,19 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, si.op = LINUX_PTRACE_SYSCALL_INFO_ENTRY; si.entry.nr = lwpinfo.pl_syscall_code; /* - * The reason for using PT_GET_SC_ARGS_ALL instead - * of PT_GET_SC_ARGS is to emulate Linux bug which strace(1) - * depends on: at initialization it tests whether ptrace works - * by calling close(2), or some other single-argument syscall, - * _with six arguments_, and then verifies whether it can - * fetch them all using this API; otherwise it bails out. + * The use of PT_GET_SC_ARGS there is special, + * implementation of PT_GET_SC_ARGS for Linux-ABI + * callers emulates Linux bug which strace(1) depends + * on: at initialization it tests whether ptrace works + * by calling close(2), or some other single-argument + * syscall, _with six arguments_, and then verifies + * whether it can fetch them all using this API; + * otherwise it bails out. */ - error = kern_ptrace(td, PT_GET_SC_ARGS_ALL, pid, + error = kern_ptrace(td, PT_GET_SC_ARGS, pid, &si.entry.args, sizeof(si.entry.args)); if (error != 0) { - linux_msg(td, "PT_GET_SC_ARGS_ALL failed with error %d", + linux_msg(td, "PT_GET_SC_ARGS failed with error %d", error); return (error); } diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 01d772b35ee8..c417a64d286a 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1032,9 +1032,6 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) r.pc.pc_limit = PAIR32TO64(off_t, r32.pc.pc_limit); data = sizeof(r.pc); break; - case PT_GET_SC_ARGS_ALL: - error = EINVAL; - break; default: addr = uap->addr; break; diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index cb35d565974d..65c5cc65c87e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -762,6 +762,7 @@ thread_alloc(int pages) return (NULL); } td->td_tid = tid; + bzero(&td->td_sa.args, sizeof(td->td_sa.args)); kmsan_thread_alloc(td); cpu_thread_alloc(td); EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td); diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index e2d8042744d0..2c212edd0ae7 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -527,9 +527,6 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) else error = copyin(uap->addr, &r.pc, uap->data); break; - case PT_GET_SC_ARGS_ALL: - error = EINVAL; - break; default: addr = uap->addr; break; @@ -711,7 +708,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_SET_EVENT_MASK: case PT_DETACH: case PT_GET_SC_ARGS: - case PT_GET_SC_ARGS_ALL: sx_xlock(&proctree_lock); proctree_locked = true; break; @@ -1011,21 +1007,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) break; } bzero(addr, sizeof(td2->td_sa.args)); - bcopy(td2->td_sa.args, addr, td2->td_sa.callp->sy_narg * - sizeof(register_t)); - break; - - case PT_GET_SC_ARGS_ALL: - CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); - if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 -#ifdef COMPAT_FREEBSD32 - || (wrap32 && !safe) -#endif - ) { - error = EINVAL; - break; - } - bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); + /* See the explanation in linux_ptrace_get_syscall_info(). */ + bcopy(td2->td_sa.args, addr, SV_PROC_ABI(td->td_proc) == + SV_ABI_LINUX ? sizeof(td2->td_sa.args) : + td2->td_sa.callp->sy_narg * sizeof(register_t)); break; case PT_GET_SC_RET: diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 066a54f721c8..1e7c1c71056b 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -86,10 +86,6 @@ #define PT_VM_TIMESTAMP 40 /* Get VM version (timestamp) */ #define PT_VM_ENTRY 41 /* Get VM map (entry) */ -#ifdef _KERNEL -#define PT_GET_SC_ARGS_ALL 42 /* Used by linux(4) */ -#endif - #define PT_FIRSTMACH 64 /* for machine-specific requests */ #include /* machine-specific requests, if any */ From owner-dev-commits-src-main@freebsd.org Thu Sep 16 17:26:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4774667E03B; Thu, 16 Sep 2021 17:26:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9PCM1Lj0z4tdL; Thu, 16 Sep 2021 17:26:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2487259FF; Thu, 16 Sep 2021 17:26:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GHQsiH006772; Thu, 16 Sep 2021 17:26:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GHQsFX006771; Thu, 16 Sep 2021 17:26:54 GMT (envelope-from git) Date: Thu, 16 Sep 2021 17:26:54 GMT Message-Id: <202109161726.18GHQsFX006771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9a8eb5db5596 - main - test/ptrace/scescx.c: fix printing of braces for syscalls without args MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a8eb5db55964c2fc7aca0db5939d8300badc9ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 17:26:55 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9a8eb5db55964c2fc7aca0db5939d8300badc9ab commit 9a8eb5db55964c2fc7aca0db5939d8300badc9ab Author: Konstantin Belousov AuthorDate: 2021-09-16 17:23:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-16 17:26:18 +0000 test/ptrace/scescx.c: fix printing of braces for syscalls without args Also do not print stray closing brace for error condition. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- tools/test/ptrace/scescx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/test/ptrace/scescx.c b/tools/test/ptrace/scescx.c index 782a43d69bf4..582d1734427e 100644 --- a/tools/test/ptrace/scescx.c +++ b/tools/test/ptrace/scescx.c @@ -196,16 +196,17 @@ wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo) (caddr_t)args, lwpinfo->pl_syscall_narg * sizeof(long)); if (error == 0) { + printf("("); for (i = 0; i < (int)lwpinfo->pl_syscall_narg; i++) { - printf("%c%#lx", i == 0 ? '(' : ',', + printf("%s%#lx", i == 0 ? "" : ",", args[i]); } + printf(")"); } else { fprintf(stderr, "PT_GET_SC_ARGS failed: %s", strerror(errno)); } - printf(")"); free(args); } } From owner-dev-commits-src-main@freebsd.org Thu Sep 16 17:59:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE6F367E693; Thu, 16 Sep 2021 17:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9Pwt5Hc1z3KmH; Thu, 16 Sep 2021 17:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95EF026094; Thu, 16 Sep 2021 17:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GHxQGC046519; Thu, 16 Sep 2021 17:59:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GHxQLx046518; Thu, 16 Sep 2021 17:59:26 GMT (envelope-from git) Date: Thu, 16 Sep 2021 17:59:26 GMT Message-Id: <202109161759.18GHxQLx046518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7cf62c68c0f4 - main - nanobsd: Provide empty routines for new embedded scheme MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cf62c68c0f48c44e3fcb098d0406f417c1f488b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 17:59:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7cf62c68c0f48c44e3fcb098d0406f417c1f488b commit 7cf62c68c0f48c44e3fcb098d0406f417c1f488b Author: Warner Losh AuthorDate: 2021-09-16 16:18:32 +0000 Commit: Warner Losh CommitDate: 2021-09-16 17:54:18 +0000 nanobsd: Provide empty routines for new embedded scheme calculate_partitioning and create_code_slice are now required in nanobsd.sh. While things work with the ones provided by legacy.sh, it's fighting embedded/common's other actions. Instead, replace them with stubs. Sponsored by: Netflix --- tools/tools/nanobsd/embedded/common | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common index f3be05ae857a..3b8faff5e252 100644 --- a/tools/tools/nanobsd/embedded/common +++ b/tools/tools/nanobsd/embedded/common @@ -647,6 +647,14 @@ esac NANO_SLICE_DATA= # Not included +# These don't make any sense to this strategy, so stub them out. +calculate_partitioning ( ) ( +) + +# These don't make any sense to this strategy, so stub them out. +create_code_slice ( ) ( +) + # Each major disk scheme has its own routine. Generally # this is for mbr, gpt, etc. These are generally are widely # shared, but some specialized formats won't be shared. From owner-dev-commits-src-main@freebsd.org Thu Sep 16 18:11:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A555D67EC11; Thu, 16 Sep 2021 18:11:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9QBx4H6cz3Nnh; Thu, 16 Sep 2021 18:11:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70DDF26139; Thu, 16 Sep 2021 18:11:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GIBbgR070474; Thu, 16 Sep 2021 18:11:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GIBbRS070473; Thu, 16 Sep 2021 18:11:37 GMT (envelope-from git) Date: Thu, 16 Sep 2021 18:11:37 GMT Message-Id: <202109161811.18GIBbRS070473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: adb56e58e8db - main - openssh: use global state for blacklist in grace_alarm_handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adb56e58e8db84d8087ebe3d3e7def0074cb5a90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 18:11:37 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=adb56e58e8db84d8087ebe3d3e7def0074cb5a90 commit adb56e58e8db84d8087ebe3d3e7def0074cb5a90 Author: Ed Maste AuthorDate: 2021-09-16 18:08:27 +0000 Commit: Ed Maste CommitDate: 2021-09-16 18:10:11 +0000 openssh: use global state for blacklist in grace_alarm_handler Obtained from: security/openssh-portable Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1") Sponsored by: The FreeBSD Foundation --- crypto/openssh/sshd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssh/sshd.c b/crypto/openssh/sshd.c index 864ad09b29fc..25a3769b4823 100644 --- a/crypto/openssh/sshd.c +++ b/crypto/openssh/sshd.c @@ -385,7 +385,7 @@ grace_alarm_handler(int sig) kill(0, SIGTERM); } - BLACKLIST_NOTIFY(NULL, BLACKLIST_AUTH_FAIL, "ssh"); + BLACKLIST_NOTIFY(the_active_state, BLACKLIST_AUTH_FAIL, "ssh"); /* Log error and exit. */ if (use_privsep && pmonitor != NULL && pmonitor->m_pid <= 0) From owner-dev-commits-src-main@freebsd.org Thu Sep 16 19:23:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E85567F82C; Thu, 16 Sep 2021 19:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9RpB2fM1z4S1X; Thu, 16 Sep 2021 19:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AC68271F2; Thu, 16 Sep 2021 19:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GJNkFC067171; Thu, 16 Sep 2021 19:23:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GJNkWt067170; Thu, 16 Sep 2021 19:23:46 GMT (envelope-from git) Date: Thu, 16 Sep 2021 19:23:46 GMT Message-Id: <202109161923.18GJNkWt067170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 0aa2a94ea635 - main - EC2: Allow AMI boot mode to be specified MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0aa2a94ea6359fb2587af81841fbf8eb30ab36b0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 19:23:46 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=0aa2a94ea6359fb2587af81841fbf8eb30ab36b0 commit 0aa2a94ea6359fb2587af81841fbf8eb30ab36b0 Author: Colin Percival AuthorDate: 2021-09-16 02:15:44 +0000 Commit: Colin Percival CommitDate: 2021-09-16 19:23:19 +0000 EC2: Allow AMI boot mode to be specified The default boot method for amd64 AMIs is BIOS, but at AMI creation time a flag can be set to specify that UEFI should be used instead. This commit adds a variable AMIBOOTMETHOD which, if set to "UEFI", causes the appropriate flag to be set during AMI creation. The only boot method supported by EC2 for arm64 is UEFI. The names of AMIs are also amended to include the boot method; they now look like "FreeBSD 14.0-CURRENT-amd64-20210915 UEFI". MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva --- release/Makefile.ec2 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index 5683cb6634b6..ce21d93c37ad 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -24,6 +24,16 @@ SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVI .if ${TARGET_ARCH} != "amd64" EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif +.if !defined(AMIBOOTMETHOD) +.if ${TARGET_ARCH} == "amd64" +AMIBOOTMETHOD= BIOS +.else +AMIBOOTMETHOD= UEFI +.endif +.endif +.if ${AMIBOOTMETHOD} == "UEFI" && ${TARGET_ARCH} == "amd64" +BOOTMODEOPT= --uefi +.endif CLEANFILES+= ec2ami @@ -65,9 +75,9 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @false .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ - ${EC2ARCH} ${SSMOPTS} --sriov --ena \ + ${EC2ARCH} ${SSMOPTS} ${BOOTMODEOPT} --sriov --ena \ ${.OBJDIR}/ec2.raw \ - "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ + "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX} ${AMIBOOTMETHOD}" \ "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \ ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \ ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS} From owner-dev-commits-src-main@freebsd.org Thu Sep 16 19:23:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A1AA67F3CA; Thu, 16 Sep 2021 19:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9RpC3mvrz4Rmq; Thu, 16 Sep 2021 19:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FD6E27588; Thu, 16 Sep 2021 19:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18GJNlUs067195; Thu, 16 Sep 2021 19:23:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18GJNlwp067194; Thu, 16 Sep 2021 19:23:47 GMT (envelope-from git) Date: Thu, 16 Sep 2021 19:23:47 GMT Message-Id: <202109161923.18GJNlwp067194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: b43d7aa09b3c - main - EC2: Default to UEFI booting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b43d7aa09b3c91fb6b652306db2ac13e1459c497 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 19:23:47 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=b43d7aa09b3c91fb6b652306db2ac13e1459c497 commit b43d7aa09b3c91fb6b652306db2ac13e1459c497 Author: Colin Percival AuthorDate: 2021-09-16 16:22:42 +0000 Commit: Colin Percival CommitDate: 2021-09-16 19:23:19 +0000 EC2: Default to UEFI booting This reduces the FreeBSD boot time by approximately 5 seconds, roughly equally divided betwenn two factors: * Disk I/O is faster in the EFI loader since it can perform larger I/Os. (The BIOS loader is limited due to the use of bounce buffers in sub-1M memory.) * The EFI console is much faster than the VGA console. Note however that not all EC2 instance types support UEFI; as a general rule the newer instances (based on Amazon's "Nitro" platform) support UEFI but the older instances (based on Xen) do not. X-MFC: TBD based on tradeoff between performance and compatibility Relnotes: yes Sponsored by: https://www.patreon.com/cperciva --- release/Makefile.ec2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index ce21d93c37ad..b29f54715fb3 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -25,12 +25,8 @@ SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVI EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif .if !defined(AMIBOOTMETHOD) -.if ${TARGET_ARCH} == "amd64" -AMIBOOTMETHOD= BIOS -.else AMIBOOTMETHOD= UEFI .endif -.endif .if ${AMIBOOTMETHOD} == "UEFI" && ${TARGET_ARCH} == "amd64" BOOTMODEOPT= --uefi .endif From owner-dev-commits-src-main@freebsd.org Thu Sep 16 21:28:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62AF16A8CE5; Thu, 16 Sep 2021 21:28:12 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9VYl42zGz3Pr0; Thu, 16 Sep 2021 21:28:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f175.google.com with SMTP id v16so8104717ilg.3; Thu, 16 Sep 2021 14:28:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=op7krweaH0Zdt00wAwpxsQgcePf2ZWjqFPLovd4Ut8U=; b=73eevLW5GHdnFy7HNfsihFoTIsuIVtdLVkHBV16ntuisTBsJsKjzXZIiV5GIWIn4Fy WCcKuwmzWsoPbBdDgv0QaGBtH/bI9Ay8hlWRbKsXKhPitplnmXp4gNmj6GYcr9mXSVdc fVhe4NkSDgSBf6BSl794fbjef0xnc5cLtsN9jusLB3StgyKguDvMdEt/tUwdlvtiQpiJ XKg/Jw80F6e+7F9D+/0+UWrPYQ7iuMdXY1TaiSivWp/Sy3KPfHvp+hRtmUjRuB45tw1P iqAvPBjdcTqjOQCZ/apTVU7J67MixKP2EfU8Kp0yHTPypJlSpxggVQE6j4ycnyAdUWk9 4/Og== X-Gm-Message-State: AOAM5310mQR0ruhopmtTRjEAXpCEkfzqJWVPQCXYNGCOiTWBd8HHmXsx j6+w6lIKz6A558vmUShcCgUHqmPWEwAXf7Es8DnSknR1yOw= X-Google-Smtp-Source: ABdhPJwKDjR956Y5mT7BJVN6QU6lGbsn3AZmOMu0ofW80vEPAUh9LTXTsgjPDnWY44SgxHRSHBclwF6eT08IYhUVTOo= X-Received: by 2002:a92:7302:: with SMTP id o2mr5490994ilc.44.1631827685036; Thu, 16 Sep 2021 14:28:05 -0700 (PDT) MIME-Version: 1.0 References: <202109041534.184FYq6n093346@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Thu, 16 Sep 2021 17:27:10 -0400 Message-ID: Subject: Re: git: b0025f9b7ff0 - main - openssh: update default version addendum in man pages To: Ronald Klop Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H9VYl42zGz3Pr0 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.175 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-2.98 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEFALL_USER(0.00)[carpeddiem]; 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]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.982]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.175:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.175:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 21:28:12 -0000 On Sun, 5 Sept 2021 at 12:26, Ronald Klop wrote: > > I'm wondering why the FreeBSD project adds this information to the banner by default. I learned that not exposing information about the running system is good security practice. > Any thoughts about this? What is the gain of this banner? Like many things it's a tradeoff. Adding the version to sshd's banner provides an easy way for an administrator to confirm that an update has been applied (assuming that the version is updated). Conversely, it's even easier (for an attacker) to connect and just attempt some misbehaviour than it would be to check this version string first. We introduced the VersionAddendum here: commit 933ca70f8f888b7fc1b06213198ba15ca346aeca Author: Brian Feldman Date: Thu May 3 00:29:28 2001 +0000 Add a "VersionAddendum" configuration setting for sshd which allows anyone to easily change the part of the OpenSSH version after the main version number. The FreeBSD-specific version banner could be disabled that way, for example: # Call ourselves plain OpenSSH VersionAddendum Notes: svn path=/head/; revision=76227 Upstream adopted it here: commit 23528816dc10165b3bc009f2ab5fdf1653db418c Author: Damien Miller Date: Sun Apr 22 11:24:43 2012 +1000 - djm@cvs.openbsd.org 2012/04/12 02:42:32 [servconf.c servconf.h sshd.c sshd_config sshd_config.5] VersionAddendum option to allow server operators to append some arbitrary text to the SSH-... banner; ok deraadt@ "don't care" markus@ Now, we support it for both the client and server while upstream supports it for the server only. I suspect there isn't a lot of value in the client-side support, and am considering removing it to reduce the differences between our in-tree ssh and upstream, and ease future OpenSSH updates. From owner-dev-commits-src-main@freebsd.org Fri Sep 17 00:42:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF96D6AADEA; Fri, 17 Sep 2021 00:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9Zt45XVJz3rSL; Fri, 17 Sep 2021 00:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E2D4347F; Fri, 17 Sep 2021 00:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18H0gag9091288; Fri, 17 Sep 2021 00:42:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18H0gadO091287; Fri, 17 Sep 2021 00:42:36 GMT (envelope-from git) Date: Fri, 17 Sep 2021 00:42:36 GMT Message-Id: <202109170042.18H0gadO091287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: fd0765933c3c - main - Change lowest address on subnet (host 0) not to broadcast by default. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd0765933c3ccb059ad7456e657b2e8ed22f58b0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 00:42:36 -0000 The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=fd0765933c3ccb059ad7456e657b2e8ed22f58b0 commit fd0765933c3ccb059ad7456e657b2e8ed22f58b0 Author: Mike Karels AuthorDate: 2021-09-05 18:14:04 +0000 Commit: Mike Karels CommitDate: 2021-09-17 00:42:20 +0000 Change lowest address on subnet (host 0) not to broadcast by default. The address with a host part of all zeros was used as a broadcast long ago, but the default has been all ones since 4.3BSD and RFC1122. Until now, we would broadcast the host zero address as well as the configured address. Change to not broadcasting that address by default, but add a sysctl (net.inet.ip.broadcast_lowest) to re-enable it. Note that the correct way to use the zero address for broadcast would be to configure it as the broadcast address for the network. See https:/datatracker.ietf.org/doc/draft-schoen-intarea-lowest-address/ and the discussion in https://reviews.freebsd.org/D19316. Note, Linux now implements this. Reviewed by: rgrimes, tuexen; melifaro (previous version) MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D31861 --- sys/netinet/in.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index e968a559a13c..b51f1111b88a 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -88,6 +88,12 @@ SYSCTL_INT(_net_inet_ip, OID_AUTO, no_same_prefix, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nosameprefix), 0, "Refuse to create same prefixes on different interfaces"); +VNET_DEFINE_STATIC(bool, broadcast_lowest); +#define V_broadcast_lowest VNET(broadcast_lowest) +SYSCTL_BOOL(_net_inet_ip, OID_AUTO, broadcast_lowest, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(broadcast_lowest), 0, + "Treat lowest address on a subnet (host 0) as broadcast"); + VNET_DECLARE(struct inpcbinfo, ripcbinfo); #define V_ripcbinfo VNET(ripcbinfo) @@ -1170,10 +1176,10 @@ in_ifaddr_broadcast(struct in_addr in, struct in_ifaddr *ia) return ((in.s_addr == ia->ia_broadaddr.sin_addr.s_addr || /* - * Check for old-style (host 0) broadcast, but + * Optionally check for old-style (host 0) broadcast, but * taking into account that RFC 3021 obsoletes it. */ - (ia->ia_subnetmask != IN_RFC3021_MASK && + (V_broadcast_lowest && ia->ia_subnetmask != IN_RFC3021_MASK && ntohl(in.s_addr) == ia->ia_subnet)) && /* * Check for an all one subnetmask. These From owner-dev-commits-src-main@freebsd.org Fri Sep 17 12:59:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D75D26B318F; Fri, 17 Sep 2021 12:59:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9vCw5XlWz3rbw; Fri, 17 Sep 2021 12:59:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E95515546; Fri, 17 Sep 2021 12:59:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HCx8P9060701; Fri, 17 Sep 2021 12:59:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HCx8FN060700; Fri, 17 Sep 2021 12:59:08 GMT (envelope-from git) Date: Fri, 17 Sep 2021 12:59:08 GMT Message-Id: <202109171259.18HCx8FN060700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1349891a0eed - main - Style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1349891a0eed79625faafa5ad354d65ff9ea6012 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 12:59:08 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1349891a0eed79625faafa5ad354d65ff9ea6012 commit 1349891a0eed79625faafa5ad354d65ff9ea6012 Author: Konstantin Belousov AuthorDate: 2021-09-01 23:23:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-17 12:41:54 +0000 Style Reviewed by: brooks, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31779 --- usr.bin/proccontrol/proccontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index 9f185de025c1..8b34ecbb06d4 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -178,7 +178,8 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, &arg); break; case MODE_NO_NEW_PRIVS: - error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, &arg); + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, + &arg); break; #ifdef PROC_KPTI_CTL case MODE_KPTI: @@ -349,7 +350,8 @@ main(int argc, char *argv[]) case MODE_NO_NEW_PRIVS: arg = enable ? PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE; - error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, &arg); + error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, + &arg); break; #ifdef PROC_KPTI_CTL case MODE_KPTI: From owner-dev-commits-src-main@freebsd.org Fri Sep 17 12:59:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 053E26B319B; Fri, 17 Sep 2021 12:59:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9vCx6YT3z3rs8; Fri, 17 Sep 2021 12:59:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2EF915641; Fri, 17 Sep 2021 12:59:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HCx9iL060731; Fri, 17 Sep 2021 12:59:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HCx91f060730; Fri, 17 Sep 2021 12:59:09 GMT (envelope-from git) Date: Fri, 17 Sep 2021 12:59:09 GMT Message-Id: <202109171259.18HCx91f060730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 796a8e1ad1ae - main - procctl(2): Add PROC_WXMAP_CTL/STATUS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 12:59:10 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16 commit 796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16 Author: Konstantin Belousov AuthorDate: 2021-09-02 00:59:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-17 12:42:01 +0000 procctl(2): Add PROC_WXMAP_CTL/STATUS It allows to override kern.elf{32,64}.allow_wx on per-process basis. In particular, it makes it possible to run binaries without PT_GNU_STACK and without elfctl note while allow_wx = 0. Reviewed by: brooks, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31779 --- lib/libc/sys/procctl.2 | 64 ++++++++++++++++++++++++++++- sys/compat/freebsd32/freebsd32_misc.c | 3 ++ sys/kern/imgact_elf.c | 7 +++- sys/kern/kern_fork.c | 3 +- sys/kern/kern_procctl.c | 76 +++++++++++++++++++++++++++++++++++ sys/sys/proc.h | 2 + sys/sys/procctl.h | 6 +++ 7 files changed, 157 insertions(+), 4 deletions(-) diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2 index ce7a2be5d5e4..30933875ccbc 100644 --- a/lib/libc/sys/procctl.2 +++ b/lib/libc/sys/procctl.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2021 +.Dd September 2, 2021 .Dt PROCCTL 2 .Os .Sh NAME @@ -599,6 +599,62 @@ following values is written: .It Dv PROC_NO_NEW_PRIVS_ENABLE .It Dv PROC_NO_NEW_PRIVS_DISABLE .El +.It Dv PROC_WXMAP_CTL +Controls the 'write exclusive against execution' permissions for the +mappings in the process address space. +It overrides the global settings established by the +.Dv kern.elf{32/64}.allow_wx +sysctl, +and the corresponding bit in the ELF control note, see +.Xr elfctl 1 . +.Pp +The +.Fa data +parameter must point to the integer variable holding one of the +following values: +.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC +.It Dv PROC_WX_MAPPINGS_PERMIT +Enable creation of mappings that have both write and execute +protection attributes, in the specified process' address space. +.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +In the new address space created by +.Xr execve 2 , +disallow creation of mappings that have both write and execute +permissions. +.El +.Pp +Once creation of writeable and executable mappings is allowed, +it is impossible (and pointless) to disallow it. +The only way to ensure the absence of such mappings after they +were enabled in a given process, is to set the +.Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +flag and +.Xr execve 2 +an image. +.It Dv PROC_WXMAP_STATUS +Returns the current status of the 'write exclusive against execution' +enforcement for the specified process. +The +.Dv data +parameter must point to the integer variable, where one of the +following values is written: +.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC +.It Dv PROC_WX_MAPPINGS_PERMIT +Creation of simultaneously writable and executable mapping is permitted, +otherwise the process cannot create such mappings. +.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC +After +.Xr execve 2 , +the new address space should disallow creation of simultaneously +writable and executable mappings. +.El +.Pp +Additionally, if the address space of the process disallows +creation of simultaneously writable and executable mappings and +it is guaranteed that no such mapping was created since address space +creation, the +.Dv PROC_WXORX_ENFORCE +flag is set in the returned value. .El .Sh x86 MACHINE-SPECIFIC REQUESTS .Bl -tag -width PROC_KPTI_STATUS @@ -648,6 +704,12 @@ feature, as it is bypassable both by the kernel and privileged processes, and via other system mechanisms. As such, it should not be utilized to reliably protect cryptographic keying material or other confidential data. +.Pp +Note that processes can trivially bypass the 'no simultaneously +writable and executable mappings' policy by first marking some mapping +as writeable and write code to it, then removing write and adding +execute permission. +This may be legitimately required by some programs, such as JIT compilers. .Sh RETURN VALUES If an error occurs, a value of -1 is returned and .Va errno diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index c417a64d286a..f4b1edb6c7b0 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3643,6 +3643,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: case PROC_NO_NEW_PRIVS_CTL: + case PROC_WXMAP_CTL: error = copyin(PTRIN(uap->data), &flags, sizeof(flags)); if (error != 0) return (error); @@ -3677,6 +3678,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -3709,6 +3711,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 5b888766daea..ef1edfcabaf0 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1216,7 +1216,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) */ if (imgp->credential_setid) { PROC_LOCK(imgp->proc); - imgp->proc->p_flag2 &= ~(P2_ASLR_ENABLE | P2_ASLR_DISABLE); + imgp->proc->p_flag2 &= ~(P2_ASLR_ENABLE | P2_ASLR_DISABLE | + P2_WXORX_DISABLE | P2_WXORX_ENABLE_EXEC); PROC_UNLOCK(imgp->proc); } if ((sv->sv_flags & SV_ASLR) == 0 || @@ -1239,7 +1240,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) imgp->map_flags |= MAP_ASLR_IGNSTART; } - if (!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0) + if ((!__elfN(allow_wx) && (fctl0 & NT_FREEBSD_FCTL_WXNEEDED) == 0 && + (imgp->proc->p_flag2 & P2_WXORX_DISABLE) == 0) || + (imgp->proc->p_flag2 & P2_WXORX_ENABLE_EXEC) != 0) imgp->map_flags |= MAP_WXORX; error = exec_new_vmspace(imgp, sv); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 1135f91e0510..2d8381894a7c 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -493,7 +493,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE | P2_TRAPCAP | - P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC | P2_NO_NEW_PRIVS); + P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC | P2_NO_NEW_PRIVS | + P2_WXORX_DISABLE | P2_WXORX_ENABLE_EXEC); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 68fa4bc0c3ac..53626caa0fd9 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -591,6 +591,71 @@ stackgap_status(struct thread *td, struct proc *p, int *data) return (0); } +static int +wxmap_ctl(struct thread *td, struct proc *p, int state) +{ + struct vmspace *vm; + vm_map_t map; + + PROC_LOCK_ASSERT(p, MA_OWNED); + if ((p->p_flag & P_WEXIT) != 0) + return (ESRCH); + + switch (state) { + case PROC_WX_MAPPINGS_PERMIT: + p->p_flag2 |= P2_WXORX_DISABLE; + _PHOLD(p); + PROC_UNLOCK(p); + vm = vmspace_acquire_ref(p); + if (vm != NULL) { + map = &vm->vm_map; + vm_map_lock(map); + map->flags &= ~MAP_WXORX; + vm_map_unlock(map); + vmspace_free(vm); + } + PROC_LOCK(p); + _PRELE(p); + break; + case PROC_WX_MAPPINGS_DISALLOW_EXEC: + p->p_flag2 |= P2_WXORX_ENABLE_EXEC; + break; + default: + return (EINVAL); + } + + return (0); +} + +static int +wxmap_status(struct thread *td, struct proc *p, int *data) +{ + struct vmspace *vm; + int d; + + PROC_LOCK_ASSERT(p, MA_OWNED); + if ((p->p_flag & P_WEXIT) != 0) + return (ESRCH); + + d = 0; + if ((p->p_flag2 & P2_WXORX_DISABLE) != 0) + d |= PROC_WX_MAPPINGS_PERMIT; + if ((p->p_flag2 & P2_WXORX_ENABLE_EXEC) != 0) + d |= PROC_WX_MAPPINGS_DISALLOW_EXEC; + _PHOLD(p); + PROC_UNLOCK(p); + vm = vmspace_acquire_ref(p); + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_WXORX) != 0) + d |= PROC_WXORX_ENFORCE; + vmspace_free(vm); + } + PROC_LOCK(p); + _PRELE(p); + *data = d; + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct procctl_args { idtype_t idtype; @@ -623,6 +688,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: case PROC_NO_NEW_PRIVS_CTL: + case PROC_WXMAP_CTL: error = copyin(uap->data, &flags, sizeof(flags)); if (error != 0) return (error); @@ -655,6 +721,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: data = &flags; break; case PROC_PDEATHSIG_CTL: @@ -686,6 +753,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_STATUS: if (error == 0) error = copyout(&flags, uap->data, sizeof(flags)); break; @@ -739,6 +807,10 @@ kern_procctl_single(struct thread *td, struct proc *p, int com, void *data) return (no_new_privs_ctl(td, p, *(int *)data)); case PROC_NO_NEW_PRIVS_STATUS: return (no_new_privs_status(td, p, data)); + case PROC_WXMAP_CTL: + return (wxmap_ctl(td, p, *(int *)data)); + case PROC_WXMAP_STATUS: + return (wxmap_status(td, p, data)); default: return (EINVAL); } @@ -771,6 +843,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_PDEATHSIG_STATUS: case PROC_NO_NEW_PRIVS_CTL: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_CTL: + case PROC_WXMAP_STATUS: if (idtype != P_PID) return (EINVAL); } @@ -821,6 +895,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data) case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_NO_NEW_PRIVS_STATUS: + case PROC_WXMAP_CTL: + case PROC_WXMAP_STATUS: tree_locked = false; break; default: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ddc8392481aa..3d01aae2d06b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -838,6 +838,8 @@ struct proc { #define P2_ITSTOPPED 0x00002000 #define P2_PTRACEREQ 0x00004000 /* Active ptrace req */ #define P2_NO_NEW_PRIVS 0x00008000 /* Ignore setuid */ +#define P2_WXORX_DISABLE 0x00010000 /* WX mappings enabled */ +#define P2_WXORX_ENABLE_EXEC 0x00020000 /* WXORX enabled after exec */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ diff --git a/sys/sys/procctl.h b/sys/sys/procctl.h index cc0279fb0d08..0fcb62e94bb9 100644 --- a/sys/sys/procctl.h +++ b/sys/sys/procctl.h @@ -65,6 +65,8 @@ #define PROC_STACKGAP_STATUS 18 /* query stack gap */ #define PROC_NO_NEW_PRIVS_CTL 19 /* disable setuid/setgid */ #define PROC_NO_NEW_PRIVS_STATUS 20 /* query suid/sgid disabled status */ +#define PROC_WXMAP_CTL 21 /* control W^X */ +#define PROC_WXMAP_STATUS 22 /* query W^X */ /* Operations for PROC_SPROTECT (passed in integer arg). */ #define PPROT_OP(x) ((x) & 0xf) @@ -146,6 +148,10 @@ struct procctl_reaper_kill { #define PROC_NO_NEW_PRIVS_ENABLE 1 #define PROC_NO_NEW_PRIVS_DISABLE 2 +#define PROC_WX_MAPPINGS_PERMIT 0x0001 +#define PROC_WX_MAPPINGS_DISALLOW_EXEC 0x0002 +#define PROC_WXORX_ENFORCE 0x80000000 + #ifndef _KERNEL __BEGIN_DECLS int procctl(idtype_t, id_t, int, void *); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 12:59:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 621506B2DB8; Fri, 17 Sep 2021 12:59:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9vCz15PLz3rvd; Fri, 17 Sep 2021 12:59:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EED5914FE6; Fri, 17 Sep 2021 12:59:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HCxAAM060756; Fri, 17 Sep 2021 12:59:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HCxA4k060755; Fri, 17 Sep 2021 12:59:10 GMT (envelope-from git) Date: Fri, 17 Sep 2021 12:59:10 GMT Message-Id: <202109171259.18HCxA4k060755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ac8af1938085 - main - proccontrol(1): Add wxmap control MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac8af1938085dae0df32db3229c9d5cb659b90a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 12:59:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ac8af1938085dae0df32db3229c9d5cb659b90a4 commit ac8af1938085dae0df32db3229c9d5cb659b90a4 Author: Konstantin Belousov AuthorDate: 2021-09-01 23:27:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-17 12:42:07 +0000 proccontrol(1): Add wxmap control Reviewed by: brooks, emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31779 --- usr.bin/proccontrol/proccontrol.1 | 4 +++- usr.bin/proccontrol/proccontrol.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1 index b4ed6c268a6a..09ec49431293 100644 --- a/usr.bin/proccontrol/proccontrol.1 +++ b/usr.bin/proccontrol/proccontrol.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2021 +.Dd September 2, 2021 .Dt PROCCONTROL 1 .Os .Sh NAME @@ -72,6 +72,8 @@ Controls the implicit PROT_MAX application for .It Ar nonewprivs Controls disabling the setuid and sgid bits for .Xr execve 2 . +.It Ar wxmap +Controls the write exclusive execute mode for mappings. .It Ar kpti Controls the KPTI enable, AMD64 only. .It Ar la48 diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c index 8b34ecbb06d4..d9237c4c6b33 100644 --- a/usr.bin/proccontrol/proccontrol.c +++ b/usr.bin/proccontrol/proccontrol.c @@ -46,6 +46,7 @@ enum { MODE_PROTMAX, MODE_STACKGAP, MODE_NO_NEW_PRIVS, + MODE_WXMAP, #ifdef PROC_KPTI_CTL MODE_KPTI, #endif @@ -85,7 +86,7 @@ usage(void) { fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap|" - "stackgap|nonewprivs"KPTI_USAGE LA_USAGE") [-q] " + "stackgap|nonewprivs|wxmap"KPTI_USAGE LA_USAGE") [-q] " "[-s (enable|disable)] [-p pid | command]\n"); exit(1); } @@ -116,6 +117,8 @@ main(int argc, char *argv[]) mode = MODE_STACKGAP; else if (strcmp(optarg, "nonewprivs") == 0) mode = MODE_NO_NEW_PRIVS; + else if (strcmp(optarg, "wxmap") == 0) + mode = MODE_WXMAP; #ifdef PROC_KPTI_CTL else if (strcmp(optarg, "kpti") == 0) mode = MODE_KPTI; @@ -181,6 +184,9 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_STATUS, &arg); break; + case MODE_WXMAP: + error = procctl(P_PID, pid, PROC_WXMAP_STATUS, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: error = procctl(P_PID, pid, PROC_KPTI_STATUS, &arg); @@ -281,6 +287,17 @@ main(int argc, char *argv[]) break; } break; + case MODE_WXMAP: + if ((arg & PROC_WX_MAPPINGS_PERMIT) != 0) + printf("enabled"); + else + printf("disabled"); + if ((arg & PROC_WX_MAPPINGS_DISALLOW_EXEC) != 0) + printf(", disabled on exec"); + if ((arg & PROC_WXORX_ENFORCE) != 0) + printf(", wxorx enforced"); + printf("\n"); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: switch (arg & ~PROC_KPTI_STATUS_ACTIVE) { @@ -353,6 +370,11 @@ main(int argc, char *argv[]) error = procctl(P_PID, pid, PROC_NO_NEW_PRIVS_CTL, &arg); break; + case MODE_WXMAP: + arg = enable ? PROC_WX_MAPPINGS_PERMIT : + PROC_WX_MAPPINGS_DISALLOW_EXEC; + error = procctl(P_PID, pid, PROC_WXMAP_CTL, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: arg = enable ? PROC_KPTI_CTL_ENABLE_ON_EXEC : From owner-dev-commits-src-main@freebsd.org Fri Sep 17 13:57:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BAD26B3E7B; Fri, 17 Sep 2021 13:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9wVx0Gpsz4fsk; Fri, 17 Sep 2021 13:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9CDA1619D; Fri, 17 Sep 2021 13:57:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HDvCp2040805; Fri, 17 Sep 2021 13:57:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HDvCap040804; Fri, 17 Sep 2021 13:57:12 GMT (envelope-from git) Date: Fri, 17 Sep 2021 13:57:12 GMT Message-Id: <202109171357.18HDvCap040804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f161abf9f2cd - main - readelf: include notes (-n) and unwind (-u) in --all/-a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f161abf9f2cd7fdd28543f9774de82c89675477c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 13:57:13 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f161abf9f2cd7fdd28543f9774de82c89675477c commit f161abf9f2cd7fdd28543f9774de82c89675477c Author: Ed Maste AuthorDate: 2021-09-17 12:06:27 +0000 Commit: Ed Maste CommitDate: 2021-09-17 13:51:59 +0000 readelf: include notes (-n) and unwind (-u) in --all/-a This matches the GNU and LLVM versions of readelf. As markj noted in the review -u is not actually implemented yet and has no effect. The option is accepted and just ignored. Reported by: andrew Reviewed by: andrew, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32003 --- contrib/elftoolchain/readelf/readelf.1 | 4 +++- contrib/elftoolchain/readelf/readelf.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 67344d5359b4..108b62775712 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -24,7 +24,7 @@ .\" .\" $Id: readelf.1 3753 2019-06-28 01:13:13Z emaste $ .\" -.Dd October 31, 2020 +.Dd September 17, 2021 .Dt READELF 1 .Os .Sh NAME @@ -76,8 +76,10 @@ Turn on the following flags: .Fl h , .Fl I , .Fl l , +.Fl n , .Fl r , .Fl s , +.Fl u , .Fl A , .Fl S and diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index 81e6897cf3cd..d5f9205e354d 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -7788,7 +7788,7 @@ main(int argc, char **argv) break; case 'a': re->options |= RE_AA | RE_D | RE_G | RE_H | RE_II | - RE_L | RE_R | RE_SS | RE_S | RE_VV; + RE_L | RE_N | RE_R | RE_SS | RE_S | RE_U | RE_VV; break; case 'c': re->options |= RE_C; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 14:26:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1C4A6B45B0; Fri, 17 Sep 2021 14:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9x883v9Xz4mhY; Fri, 17 Sep 2021 14:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 662CA16921; Fri, 17 Sep 2021 14:26:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HEQ0NH081125; Fri, 17 Sep 2021 14:26:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HEQ0rf081124; Fri, 17 Sep 2021 14:26:00 GMT (envelope-from git) Date: Fri, 17 Sep 2021 14:26:00 GMT Message-Id: <202109171426.18HEQ0rf081124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: deef4b8ce8ba - main - readelf: document that -u / --unwind is not yet implemented MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 14:26:00 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8 commit deef4b8ce8ba7292fe5088bf9f6d4e2e35662fe8 Author: Ed Maste AuthorDate: 2021-09-17 13:59:41 +0000 Commit: Ed Maste CommitDate: 2021-09-17 14:22:05 +0000 readelf: document that -u / --unwind is not yet implemented ELF tool chain readelf accepts -u / --unwind but just ignores the option. This was previously undocumented, which could be confusing for someone encountering `readelf -u` (in a script or GNU readelf example). Reported by: markj (in D32003) MFC after: 1 week Sponsored by: The FreeBSD Foundation --- contrib/elftoolchain/readelf/readelf.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/elftoolchain/readelf/readelf.1 b/contrib/elftoolchain/readelf/readelf.1 index 108b62775712..c4f3408e814a 100644 --- a/contrib/elftoolchain/readelf/readelf.1 +++ b/contrib/elftoolchain/readelf/readelf.1 @@ -43,6 +43,7 @@ .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl r | Fl -relocs .Op Fl t | Fl -section-details +.Op Fl u | Fl -unwind .Op Fl v | Fl -version .Oo .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | @@ -118,6 +119,8 @@ Print additional information about sections, such as the flags fields in section headers. Implies .Fl S . +.It Fl u | Fl -unwind +Not yet implemented (option accepted but ignored). .It Fl v | Fl -version Prints a version identifier for .Nm From owner-dev-commits-src-main@freebsd.org Fri Sep 17 15:00:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E44176B494A; Fri, 17 Sep 2021 15:00:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9xw95wMCz3Bn2; Fri, 17 Sep 2021 15:00:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACADD169C6; Fri, 17 Sep 2021 15:00:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HF0f4W030257; Fri, 17 Sep 2021 15:00:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HF0fGr030256; Fri, 17 Sep 2021 15:00:41 GMT (envelope-from git) Date: Fri, 17 Sep 2021 15:00:41 GMT Message-Id: <202109171500.18HF0fGr030256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7eb138a9e536 - main - libc/locale: Fix races between localeconv(3) and setlocale(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7eb138a9e53636366e615bdf04062fedc044bcea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 15:00:42 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7eb138a9e53636366e615bdf04062fedc044bcea commit 7eb138a9e53636366e615bdf04062fedc044bcea Author: Mark Johnston AuthorDate: 2021-09-17 14:44:23 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 14:47:46 +0000 libc/locale: Fix races between localeconv(3) and setlocale(3) Each locale embeds a lazily initialized lconv which is populated by localeconv(3) and localeconv_l(3). When setlocale(3) updates the global locale, the lconv needs to be (lazily) reinitialized. To signal this, we set flag variables in the locale structure. There are two problems: - The flags are set before the locale is fully updated, so a concurrent localeconv() call can observe partially initialized locale data. - No barriers ensure that localeconv() observes a fully initialized locale if a flag is set. So, move the flag update appropriately, and use acq/rel barriers to provide some synchronization. Note that this is inadequate in the face of multiple concurrent calls to setlocale(3), but this is not expected to work regardless. Thanks to Henry Hu for providing a test case demonstrating the race. PR: 258360 MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31899 --- lib/libc/locale/lmonetary.c | 4 ++-- lib/libc/locale/lnumeric.c | 4 ++-- lib/libc/locale/localeconv.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c index 99800ae69922..b8b4e78c060b 100644 --- a/lib/libc/locale/lmonetary.c +++ b/lib/libc/locale/lmonetary.c @@ -107,8 +107,6 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, &loc->buffer, "LC_MONETARY", LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN, (const char **)l); - if (ret != _LDP_ERROR) - *changed = 1; if (ret == _LDP_LOADED) { l->mon_grouping = __fix_locale_grouping_str(l->mon_grouping); @@ -146,6 +144,8 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale, M_ASSIGN_ICHAR(p_sign_posn); M_ASSIGN_ICHAR(n_sign_posn); } + if (ret != _LDP_ERROR) + atomic_store_rel_int(changed, 1); return (ret); } int diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c index 046d1f1817dc..cc1daa3863e3 100644 --- a/lib/libc/locale/lnumeric.c +++ b/lib/libc/locale/lnumeric.c @@ -73,8 +73,6 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed &loc->buffer, "LC_NUMERIC", LCNUMERIC_SIZE, LCNUMERIC_SIZE, (const char**)l); - if (ret != _LDP_ERROR) - *changed= 1; if (ret == _LDP_LOADED) { /* Can't be empty according to C99 */ if (*l->decimal_point == '\0') @@ -83,6 +81,8 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed l->grouping = __fix_locale_grouping_str(l->grouping); } + if (ret != _LDP_ERROR) + atomic_store_rel_int(changed, 1); return (ret); } diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c index 641773944e32..130f93c178f4 100644 --- a/lib/libc/locale/localeconv.c +++ b/lib/libc/locale/localeconv.c @@ -65,7 +65,7 @@ localeconv_l(locale_t loc) FIX_LOCALE(loc); struct lconv *ret = &loc->lconv; - if (loc->monetary_locale_changed) { + if (atomic_load_acq_int(&loc->monetary_locale_changed) != 0) { /* LC_MONETARY part */ struct lc_monetary_T * mptr; @@ -94,10 +94,10 @@ localeconv_l(locale_t loc) M_ASSIGN_CHAR(int_n_sep_by_space); M_ASSIGN_CHAR(int_p_sign_posn); M_ASSIGN_CHAR(int_n_sign_posn); - loc->monetary_locale_changed = 0; + atomic_store_int(&loc->monetary_locale_changed, 0); } - if (loc->numeric_locale_changed) { + if (atomic_load_acq_int(&loc->numeric_locale_changed) != 0) { /* LC_NUMERIC part */ struct lc_numeric_T * nptr; @@ -107,7 +107,7 @@ localeconv_l(locale_t loc) N_ASSIGN_STR(decimal_point); N_ASSIGN_STR(thousands_sep); N_ASSIGN_STR(grouping); - loc->numeric_locale_changed = 0; + atomic_store_int(&loc->numeric_locale_changed, 0); } return ret; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 16:44:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DE0C6B59A7; Fri, 17 Sep 2021 16:44:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB0DM1vNNz4Sbf; Fri, 17 Sep 2021 16:44:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12d.google.com with SMTP id d42so13672350lfv.10; Fri, 17 Sep 2021 09:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AVSDB95rilSPFCbqIS7Vwa2mE5UN+mtkV1Ti5BvLwd0=; b=EsY4r5itpv0rs3BVUkkTPj7oj8/HHowOVt430PQsHwsVN50eVrd1vlfqBRMiW45nD9 /kEFN5tZHuMMYXf8WGc/PwcBu5JnJIkMVdgJPZyv4/MDa1lx8VKXL3qRWNU1+drDwoGH KRHaUYl73G0NWgvu5PrdfUkFJHj2DA+ygcT5BeFgRwGlPPBwBLEySmh4v1t1LQsUPof7 0Uzo89Oh5UakRfKxT7GM+HGDc0VHvLSB4smydcAFUP8TngFF5sqNBfxdBLpOVRVeX066 5i+TVriQ428qzhAypjB8tkkbFv244Xcks6pdj/Be3NIgSJBx0X2QinboEcCPaMNK8Rq3 dVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AVSDB95rilSPFCbqIS7Vwa2mE5UN+mtkV1Ti5BvLwd0=; b=BxfHlszUvahkqyWSz9p4Fq/82lNpWSsJLt/fmbOA2ZsSEHEm3nQkBOrYDfkroBnZM/ ibS8YPFxQVUtsnxsRdLQaiCBvYbWa2ScJn0PCoOZYPfzggWu60RqHgGKpabo8R0HwEkO 5C14RhUSe466HsCfQRhfy+LX7/imrHcnrvcRtvRh08C8kmv26xGtVwrptEPuz4LDcnEG 1aDSkBP4NvwZhJi8G4t9i+D7h+M8xg/hgSgj0PXKxszLV4Soam7oE1N6GnbWPsAtOhbf yJulNYKeEYxLnOBripyJuIQpkPp/4iBFHC3ZWVkSgAbGjx1DwiamOo1/73h84VvOWL45 xZBA== X-Gm-Message-State: AOAM530+iXO74REJ3w2+h87OzplIoxzewiPl4qFK83Xa2/3/2svwvMzP mDfBqs79Hr4p41jlVhI2r+xt25ivnGU1v6uCuDCiqmjm X-Google-Smtp-Source: ABdhPJzE1DsWmneFjJKwyZfOQdmN8VxJRgEXPixg+gufKtABlK+gSSjg1wNRCDVhlA8yvusKCM166XruEzKM+eroNdU= X-Received: by 2002:a05:6512:1114:: with SMTP id l20mr8955330lfg.550.1631897089684; Fri, 17 Sep 2021 09:44:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:2115:0:0:0:0 with HTTP; Fri, 17 Sep 2021 09:44:48 -0700 (PDT) In-Reply-To: References: <202109130411.18D4BUs3004805@gitrepo.freebsd.org> From: Mateusz Guzik Date: Fri, 17 Sep 2021 18:44:48 +0200 Message-ID: Subject: Re: git: 6fa041d7f125 - main - Measure latency of PMC interruptions To: Wojciech Macek Cc: Mitchell Horne , Wojciech Macek , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HB0DM1vNNz4Sbf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=EsY4r5it; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::12d as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-2.01 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(0.99)[0.993]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12d:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 16:44:52 -0000 ping? On 9/14/21, Wojciech Macek wrote: > Hi, > > Thanks for comments, I'll handle all of them as well as docs. > > Wojtek > > pon., 13 wrz 2021 o 22:06 Mitchell Horne napisa=C5= =82(a): > >> On Mon, Sep 13, 2021 at 1:11 AM Wojciech Macek wrote: >> > >> > The branch main has been updated by wma: >> > >> > URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D6fa041d7f125db65f400af7f520a41= ff78d19cd7 >> > >> > commit 6fa041d7f125db65f400af7f520a41ff78d19cd7 >> > Author: Wojciech Macek >> > AuthorDate: 2021-09-13 04:08:32 +0000 >> > Commit: Wojciech Macek >> > CommitDate: 2021-09-13 04:08:32 +0000 >> > >> > Measure latency of PMC interruptions >> > >> > Add HWPMC events to measure latency. >> > Provide sysctl to choose the number of outstanding events which >> > trigger HWPMC event. >> > >> > Obtained from: Semihalf >> > Sponsored by: Stormshield >> > Differential revision: https://reviews.freebsd.org/D31283 >> > --- >> > sys/kern/kern_intr.c | 58 >> ++++++++++++++++++++++++++++++++++++++++++++++------ >> > 1 file changed, 52 insertions(+), 6 deletions(-) >> > >> > diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c >> > index 1660414a50ef..19401877dfbd 100644 >> > --- a/sys/kern/kern_intr.c >> > +++ b/sys/kern/kern_intr.c >> > @@ -30,6 +30,7 @@ >> > __FBSDID("$FreeBSD$"); >> > >> > #include "opt_ddb.h" >> > +#include "opt_hwpmc_hooks.h" >> > #include "opt_kstack_usage_prof.h" >> > >> > #include >> > @@ -75,6 +76,7 @@ struct intr_thread { >> > struct thread *it_thread; /* Kernel thread. */ >> > int it_flags; /* (j) IT_* flags. */ >> > int it_need; /* Needs service. */ >> > + int it_waiting; /* Waiting in the runq. */ >> > }; >> > >> > /* Interrupt thread flags kept in it_flags */ >> > @@ -100,13 +102,19 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_threshold, >> CTLFLAG_RWTUN, >> > static int intr_epoch_batch =3D 1000; >> > SYSCTL_INT(_hw, OID_AUTO, intr_epoch_batch, CTLFLAG_RWTUN, >> &intr_epoch_batch, >> > 0, "Maximum interrupt handler executions without re-entering >> epoch(9)"); >> > +#ifdef HWPMC_HOOKS >> > +static int intr_hwpmc_waiting_report_threshold =3D 1; >> > +SYSCTL_INT(_hw, OID_AUTO, intr_hwpmc_waiting_report_threshold, >> CTLFLAG_RWTUN, >> > + &intr_hwpmc_waiting_report_threshold, 1, >> > + "Threshold for reporting number of events in a workq"); >> > +#endif >> > static TAILQ_HEAD(, intr_event) event_list =3D >> > TAILQ_HEAD_INITIALIZER(event_list); >> > static struct mtx event_lock; >> > MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF)= ; >> > >> > static void intr_event_update(struct intr_event *ie); >> > -static int intr_event_schedule_thread(struct intr_event *ie); >> > +static int intr_event_schedule_thread(struct intr_event *ie, stru= ct >> trapframe *frame); >> > static struct intr_thread *ithread_create(const char *name); >> > static void ithread_destroy(struct intr_thread *ithread); >> > static void ithread_execute_handlers(struct proc *p, >> > @@ -115,6 +123,16 @@ static void ithread_loop(void *); >> > static void ithread_update(struct intr_thread *ithd); >> > static void start_softintr(void *); >> > >> > +#ifdef HWPMC_HOOKS >> > +#include >> > +PMC_SOFT_DEFINE( , , intr, all); >> > +PMC_SOFT_DEFINE( , , intr, ithread); >> > +PMC_SOFT_DEFINE( , , intr, filter); >> > +PMC_SOFT_DEFINE( , , intr, stray); >> > +PMC_SOFT_DEFINE( , , intr, schedule); >> > +PMC_SOFT_DEFINE( , , intr, waiting); >> > +#endif >> > + >> >> Hi Wojciech, >> >> Do you plan to document these new events in the pmc.soft(3) man page? >> >> Cheers, >> Mitchell >> >> >> > /* Map an interrupt type to an ithread priority. */ >> > u_char >> > intr_priority(enum intr_type flags) >> > @@ -773,7 +791,7 @@ intr_handler_barrier(struct intr_handler *handler) >> > } >> > if ((handler->ih_flags & IH_CHANGED) =3D=3D 0) { >> > handler->ih_flags |=3D IH_CHANGED; >> > - intr_event_schedule_thread(ie); >> > + intr_event_schedule_thread(ie, NULL); >> > } >> > while ((handler->ih_flags & IH_CHANGED) !=3D 0) >> > msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); >> > @@ -872,7 +890,7 @@ intr_event_remove_handler(void *cookie) >> > KASSERT((handler->ih_flags & IH_DEAD) =3D=3D 0, >> > ("duplicate handle remove")); >> > handler->ih_flags |=3D IH_DEAD; >> > - intr_event_schedule_thread(ie); >> > + intr_event_schedule_thread(ie, NULL); >> > while (handler->ih_flags & IH_DEAD) >> > msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0); >> > intr_event_update(ie); >> > @@ -944,7 +962,7 @@ intr_event_resume_handler(void *cookie) >> > } >> > >> > static int >> > -intr_event_schedule_thread(struct intr_event *ie) >> > +intr_event_schedule_thread(struct intr_event *ie, struct trapframe >> *frame) >> > { >> > struct intr_entropy entropy; >> > struct intr_thread *it; >> > @@ -986,11 +1004,28 @@ intr_event_schedule_thread(struct intr_event *i= e) >> > atomic_store_rel_int(&it->it_need, 1); >> > thread_lock(td); >> > if (TD_AWAITING_INTR(td)) { >> > +#ifdef HWPMC_HOOKS >> > + atomic_set_int(&it->it_waiting, 0); >> > + if (frame !=3D NULL) >> > + PMC_SOFT_CALL_TF( , , intr, schedule, frame); >> > + else >> > + PMC_SOFT_CALL( , , intr, schedule); >> > +#endif >> > CTR3(KTR_INTR, "%s: schedule pid %d (%s)", __func__, >> td->td_proc->p_pid, >> > td->td_name); >> > TD_CLR_IWAIT(td); >> > sched_add(td, SRQ_INTR); >> > } else { >> > +#ifdef HWPMC_HOOKS >> > + atomic_add_int(&it->it_waiting, 1); >> > + >> > + if (atomic_load_int(&it->it_waiting) >=3D >> intr_hwpmc_waiting_report_threshold) { >> > + if (frame !=3D NULL) >> > + PMC_SOFT_CALL_TF( , , intr, waiting, >> frame); >> > + else >> > + PMC_SOFT_CALL( , , intr, waiting); >> > + } >> > +#endif >> > CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d"= , >> > __func__, td->td_proc->p_pid, td->td_name, >> it->it_need, TD_GET_STATE(td)); >> > thread_unlock(td); >> > @@ -1083,7 +1118,7 @@ swi_sched(void *cookie, int flags) >> > #endif >> > } else { >> > VM_CNT_INC(v_soft); >> > - error =3D intr_event_schedule_thread(ie); >> > + error =3D intr_event_schedule_thread(ie, NULL); >> > KASSERT(error =3D=3D 0, ("stray software interrupt")); >> > } >> > } >> > @@ -1374,12 +1409,23 @@ intr_event_handle(struct intr_event *ie, struc= t >> trapframe *frame) >> > ret =3D ih->ih_filter(frame); >> > else >> > ret =3D ih->ih_filter(ih->ih_argument); >> > +#ifdef HWPMC_HOOKS >> > + PMC_SOFT_CALL_TF( , , intr, all, frame); >> > +#endif >> > KASSERT(ret =3D=3D FILTER_STRAY || >> > ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) >> !=3D 0 && >> > (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) >> =3D=3D 0), >> > ("%s: incorrect return value %#x from %s", __func_= _, >> ret, >> > ih->ih_name)); >> > filter =3D filter || ret =3D=3D FILTER_HANDLED; >> > +#ifdef HWPMC_HOOKS >> > + if (ret & FILTER_SCHEDULE_THREAD) >> > + PMC_SOFT_CALL_TF( , , intr, ithread, frame); >> > + else if (ret & FILTER_HANDLED) >> > + PMC_SOFT_CALL_TF( , , intr, filter, frame); >> > + else if (ret =3D=3D FILTER_STRAY) >> > + PMC_SOFT_CALL_TF( , , intr, stray, frame); >> > +#endif >> > >> > /* >> > * Wrapper handler special handling: >> > @@ -1416,7 +1462,7 @@ intr_event_handle(struct intr_event *ie, struct >> trapframe *frame) >> > if (thread) { >> > int error __unused; >> > >> > - error =3D intr_event_schedule_thread(ie); >> > + error =3D intr_event_schedule_thread(ie, frame); >> > KASSERT(error =3D=3D 0, ("bad stray interrupt")); >> > } >> > critical_exit(); >> > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > --=20 Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Fri Sep 17 16:56:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 438976B61BB; Fri, 17 Sep 2021 16:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB0Tl19yBz4VBT; Fri, 17 Sep 2021 16:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08E081895A; Fri, 17 Sep 2021 16:56:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HGuQJJ080692; Fri, 17 Sep 2021 16:56:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HGuQmN080691; Fri, 17 Sep 2021 16:56:26 GMT (envelope-from git) Date: Fri, 17 Sep 2021 16:56:26 GMT Message-Id: <202109171656.18HGuQmN080691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c6efcb1281f3 - main - bhyve: Support setting the disk serial number for VirtIO block devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6efcb1281f3518a92fdc579d2c3c3c74eb6070c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 16:56:27 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6efcb1281f3518a92fdc579d2c3c3c74eb6070c commit c6efcb1281f3518a92fdc579d2c3c3c74eb6070c Author: John Baldwin AuthorDate: 2021-09-17 16:55:06 +0000 Commit: John Baldwin CommitDate: 2021-09-17 16:55:48 +0000 bhyve: Support setting the disk serial number for VirtIO block devices. Reviewed by: allanjude Obtained from: illumos Differential Revision: https://reviews.freebsd.org/D31983 --- usr.sbin/bhyve/bhyve_config.5 | 12 +++++++++++- usr.sbin/bhyve/pci_virtio_block.c | 27 +++++++++++++++++---------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index a6f621048c1a..25bd818d6148 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 20, 2021 +.Dd September 17, 2021 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -514,6 +514,16 @@ The path of a directory on the host to export to the guest. .It Va ro Ta bool Ta false Ta If true, the guest filesystem is read-only. .El +.Ss VirtIO Block Device Settings +In addition to the block device settings described above, each +VirtIO block device supports the following settings: +.Bl -column "model" "integer" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va ser Ta string Ta generated Ta +Serial number of up to twenty characters. +A default serial number is generated using a hash of the backing +store's pathname. +.El .Ss VirtIO Console Device Settings Each VirtIO Console device contains one or more console ports. Each port stores its settings in a node named diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 3718b2d7eff0..385b812be84c 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -453,7 +453,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) { char bident[sizeof("XX:X:X")]; struct blockif_ctxt *bctxt; - const char *path; + const char *path, *serial; MD5_CTX mdctx; u_char digest[16]; struct pci_vtblk_softc *sc; @@ -498,16 +498,23 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) /* sc->vbsc_vq.vq_notify = we have no per-queue notify */ /* - * Create an identifier for the backing file. Use parts of the - * md5 sum of the filename + * If an explicit identifier is not given, create an + * identifier using parts of the md5 sum of the filename. */ - path = get_config_value_node(nvl, "path"); - MD5Init(&mdctx); - MD5Update(&mdctx, path, strlen(path)); - MD5Final(digest, &mdctx); - snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES, - "BHYVE-%02X%02X-%02X%02X-%02X%02X", - digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]); + bzero(sc->vbsc_ident, VTBLK_BLK_ID_BYTES); + if ((serial = get_config_value_node(nvl, "serial")) != NULL || + (serial = get_config_value_node(nvl, "ser")) != NULL) { + strlcpy(sc->vbsc_ident, serial, VTBLK_BLK_ID_BYTES); + } else { + path = get_config_value_node(nvl, "path"); + MD5Init(&mdctx); + MD5Update(&mdctx, path, strlen(path)); + MD5Final(digest, &mdctx); + snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES, + "BHYVE-%02X%02X-%02X%02X-%02X%02X", + digest[0], digest[1], digest[2], digest[3], digest[4], + digest[5]); + } /* setup virtio block config space */ sc->vbsc_cfg.vbc_capacity = size / VTBLK_BSIZE; /* 512-byte units */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 17:43:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A1C6B6C14; Fri, 17 Sep 2021 17:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB1XK1d97z4kMy; Fri, 17 Sep 2021 17:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1825719AE8; Fri, 17 Sep 2021 17:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HHhjYJ047687; Fri, 17 Sep 2021 17:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HHhiQM047686; Fri, 17 Sep 2021 17:43:44 GMT (envelope-from git) Date: Fri, 17 Sep 2021 17:43:44 GMT Message-Id: <202109171743.18HHhiQM047686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 197a4f29f39e - main - buffer pager: allow get_blksize method to return error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 197a4f29f39e6ae6215a6dbd28ef449d305e6d49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 17:43:45 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=197a4f29f39e6ae6215a6dbd28ef449d305e6d49 commit 197a4f29f39e6ae6215a6dbd28ef449d305e6d49 Author: Konstantin Belousov AuthorDate: 2021-09-16 23:53:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-17 17:29:55 +0000 buffer pager: allow get_blksize method to return error Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31998 --- sys/fs/cd9660/cd9660_vnops.c | 5 +++-- sys/fs/fuse/fuse_vnops.c | 5 +++-- sys/fs/msdosfs/msdosfs_vnops.c | 5 +++-- sys/fs/nfsclient/nfs_clbio.c | 5 +++-- sys/kern/vfs_bio.c | 16 ++++++++++------ sys/sys/buf.h | 2 +- sys/ufs/ffs/ffs_vnops.c | 5 +++-- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 500ff79716be..0ddf73548e3f 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -858,12 +858,13 @@ cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn) +cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { struct iso_node *ip; ip = VTOI(vp); - return (blksize(ip->i_mnt, ip, lbn)); + *sz = blksize(ip->i_mnt, ip, lbn); + return (0); } static int diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index adb297b6aacb..1216c1252f2b 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -2199,7 +2199,7 @@ fuse_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn) +fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { off_t filesize; int blksz, err; @@ -2217,7 +2217,8 @@ fuse_gbp_getblksz(struct vnode *vp, daddr_t lbn) } else { blksz = biosize; } - return (blksz); + *sz = blksz; + return (0); } /* diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 6197340e8943..5f778724786d 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1861,10 +1861,11 @@ msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { - return (VTODE(vp)->de_pmp->pm_bpcluster); + *sz = VTODE(vp)->de_pmp->pm_bpcluster; + return (0); } static int diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index ff9f446ff1ef..10a76f0a4b83 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -94,7 +94,7 @@ ncl_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn) +ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { struct nfsnode *np; u_quad_t nsize; @@ -111,7 +111,8 @@ ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn) bcount = 0; else if ((off_t)(lbn + 1) * biosize > nsize) bcount = nsize - (off_t)lbn * biosize; - return (bcount); + *sz = bcount; + return (0); } int diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 174892b374d1..e234bf2d6563 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -5203,8 +5203,8 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, struct mount *mp; daddr_t lbn, lbnp; vm_ooffset_t la, lb, poff, poffe; - long bsize; - int bo_bs, br_flags, error, i, pgsin, pgsin_a, pgsin_b; + long bo_bs, bsize; + int br_flags, error, i, pgsin, pgsin_a, pgsin_b; bool redo, lpart; object = vp->v_object; @@ -5221,7 +5221,10 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count, */ la += PAGE_SIZE; lpart = la > object->un_pager.vnp.vnp_size; - bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex))); + error = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex)), + &bo_bs); + if (error != 0) + return (VM_PAGER_ERROR); /* * Calculate read-ahead, behind and total pages. @@ -5277,9 +5280,10 @@ again: goto next_page; lbnp = lbn; - bsize = get_blksize(vp, lbn); - error = bread_gb(vp, lbn, bsize, curthread->td_ucred, - br_flags, &bp); + error = get_blksize(vp, lbn, &bsize); + if (error == 0) + error = bread_gb(vp, lbn, bsize, + curthread->td_ucred, br_flags, &bp); if (error != 0) goto end_pages; if (bp->b_rcred == curthread->td_ucred) { diff --git a/sys/sys/buf.h b/sys/sys/buf.h index d6c4c7f44795..b831003cf63d 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -610,7 +610,7 @@ void bwait(struct buf *, u_char, const char *); void bdone(struct buf *); typedef daddr_t (vbg_get_lblkno_t)(struct vnode *, vm_ooffset_t); -typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t); +typedef int (vbg_get_blksize_t)(struct vnode *, daddr_t, long *); int vfs_bio_getpages(struct vnode *vp, struct vm_page **ma, int count, int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, vbg_get_blksize_t get_blksize); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index a10afd86f8e6..a1657db9ece2 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1935,10 +1935,11 @@ ffs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) } static int -ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn) +ffs_gbp_getblksz(struct vnode *vp, daddr_t lbn, long *sz) { - return (blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn)); + *sz = blksize(VFSTOUFS(vp->v_mount)->um_fs, VTOI(vp), lbn); + return (0); } static int From owner-dev-commits-src-main@freebsd.org Fri Sep 17 17:59:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E58646B7172; Fri, 17 Sep 2021 17:59:01 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4HB1sx293jz4pgm; Fri, 17 Sep 2021 17:59:01 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 18HHwxVA039633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 17 Sep 2021 10:58:59 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18HHwwqH039632; Fri, 17 Sep 2021 10:58:58 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 17 Sep 2021 10:58:58 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: kp@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test Message-ID: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4HB1sx293jz4pgm X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 17:59:02 -0000 Mateusz, On Tue, Sep 14, 2021 at 05:11:11PM +0200, Mateusz Guzik wrote: M> > On Fri, Sep 10, 2021 at 09:43:06AM +0200, Mateusz Guzik wrote: M> > M> > M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c M> > M> > M> index e2dd3eb7c0de..add76c7b98d4 100644 M> > M> > M> --- a/sys/netpfil/pf/pf.c M> > M> > M> +++ b/sys/netpfil/pf/pf.c M> > M> > M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet M> > *ifp, M> > M> > struct mbuf **m0, struct inpcb * M> > M> > M> M> > M> > M> PF_RULES_RLOCK(); M> > M> > M> M> > M> > M> - if (ip_divert_ptr != NULL && M> > M> > M> + if (__predict_false(ip_divert_ptr != NULL) && M> > M> > M> > M> > This is an optimization for a setup without divert(4) at cost of M> > M> > pessimization M> > M> > for a setup with divert(4). IMHO, __predict_false() predicate should M> > guard M> > M> > against error paths and other unusual events, not favor one setup over M> > M> > other. M> > M> > M> > M> M> > M> divert is non-standard and comes with tons of overhead, so I think M> > M> this is justified. M> > M> > pf is also non-standard and comes with tons of overhead, so what M> > about such change to ip_input(), and similar to ip_output(): M> > M> > diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c M> > index 465c00e4dac..e6feb837114 100644 M> > --- a/sys/netinet/ip_input.c M> > +++ b/sys/netinet/ip_input.c M> > @@ -605,7 +605,7 @@ ip_input(struct mbuf *m) M> > */ M> > M> > /* Jump over all PFIL processing if hooks are not active. */ M> > - if (!PFIL_HOOKED_IN(V_inet_pfil_head)) M> > + if (__predict_true(!PFIL_HOOKED_IN(V_inet_pfil_head))) M> > goto passin; M> > M> > odst = ip->ip_dst; M> > M> > I hope that brings my point. M> > M> > M> The real fix would be to either implement hot patchable branches or M> > M> otherwise generate pf_test always (or never) doing divert without M> > M> having to check for it, but that's far in the future. M> > M> > That would be great, but before we have such tools, I believe optimization M> > for one particular setup at cost of pessimization of other setups is not M> > a way to go. M> > M> M> So happens I would argue the pfil change should also be made, perhaps M> conditional on whether a known consumer is compiled in. Thanks for reply, although makes me think that you wouldn't reply anything unless you really want to proceed with my hyperbolic suggestion :( How deep are you going to go this path? May be if (__predict_true(ip->ip_proto == IPPROTO_TCP && th->th_port == ntohs(443))) A suggestion to get optimization for "non-standard" stuff by compiling it statically sounds like a jump 20 years to the past. M> I guess I should elaborate on how I see things here. M> M> The network stack comes with a rampant branch fest which can be M> significantly reduced in easy ways. For example from ip_input: M> M> #if defined(IPSEC) || defined(IPSEC_SUPPORT) M> /* M> * Bypass packet filtering for packets previously handled by IPsec. M> */ M> if (IPSEC_ENABLED(ipv4) && M> IPSEC_CAPS(ipv4, m, IPSEC_CAP_BYPASS_FILTER) != 0) M> goto passin; M> #endif M> M> Let's say this has to be checked every time. Even then IPSEC_CAPS is a M> func call which induces 2 more func calls, which also branch for no M> reason. Instead the complete result could be computed so that there is M> one bool to check (and even that could be hot patched later on). M> Finally, it should probably be predicted one way or the other. M> M> pf_test is an egregious example of this proble and, the commit at hand M> was a step towards cleaning the state up -- it is not meant to be M> permanent in the current form. The idea is to gradually split it into M> parts which have to be there and parts which are optional, the M> annotation will help going forward and should not measurably hurt M> divert. I understand your concerns, but this is the reality of network. A machine supports multiple protocols and encapsulations or whatever the same time. I understand, that some machines and workloads would work 99% of the time on just one protocol. So you create a benchmark that exercises a particular branch of code for all of the packets and then do optimizations for this particular branch. To justify such changes at least you need to have a second benchmark that would measure how much of pessimization you created for a setup that would have 99% prediction mismatch and document the results in the commit message, like: - improves packet rate without pf hooked in by X% - pessimizes packet rate with pf (empty ruleset) by Y% -- Gleb Smirnoff From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31F60668269; Fri, 17 Sep 2021 19:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vj0vtCz3PpC; Fri, 17 Sep 2021 19:12:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F365A1B2C9; Fri, 17 Sep 2021 19:12:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCS4P068144; Fri, 17 Sep 2021 19:12:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCSQN068143; Fri, 17 Sep 2021 19:12:28 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:28 GMT Message-Id: <202109171912.18HJCSQN068143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 40fcdb9366d5 - main - kcov: Disable address and memory sanitizers in get_kinfo() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40fcdb9366d51400259020accaac9df212bd9508 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=40fcdb9366d51400259020accaac9df212bd9508 commit 40fcdb9366d51400259020accaac9df212bd9508 Author: Mark Johnston AuthorDate: 2021-09-17 16:12:02 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:05 +0000 kcov: Disable address and memory sanitizers in get_kinfo() get_kinfo() is only called from the coverage sanitizer callbacks, which are similarly uninstrumented. Sponsored by: The FreeBSD Foundation --- sys/kern/kern_kcov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c index 7a11f800c7ce..1f8b62df7b4b 100644 --- a/sys/kern/kern_kcov.c +++ b/sys/kern/kern_kcov.c @@ -165,7 +165,7 @@ SYSCTL_UINT(_kern_kcov, OID_AUTO, max_entries, CTLFLAG_RW, static struct mtx kcov_lock; static int active_count; -static struct kcov_info * +static struct kcov_info * __nosanitizeaddress __nosanitizememory get_kinfo(struct thread *td) { struct kcov_info *info; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 762FC668294; Fri, 17 Sep 2021 19:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vl2przz3Q1Q; Fri, 17 Sep 2021 19:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 411E61B48F; Fri, 17 Sep 2021 19:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCV94068193; Fri, 17 Sep 2021 19:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCVtv068192; Fri, 17 Sep 2021 19:12:31 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:31 GMT Message-Id: <202109171912.18HJCVtv068192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d6e77cda9be1 - main - uma: Show the count of free slabs in each per-domain keg's sysctl tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6e77cda9be1509ea170142cca3ff0d3b9f12e35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d6e77cda9be1509ea170142cca3ff0d3b9f12e35 commit d6e77cda9be1509ea170142cca3ff0d3b9f12e35 Author: Mark Johnston AuthorDate: 2021-09-17 16:13:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:05 +0000 uma: Show the count of free slabs in each per-domain keg's sysctl tree This is useful for measuring the number of pages that could be freed from a NOFREE zone under memory pressure. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/vm/uma_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index cdf3d482679e..12cab490781b 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2690,7 +2690,10 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) "Total pages currently allocated from VM"); SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "free_items", CTLFLAG_RD, &dom->ud_free_items, 0, - "items free in the slab layer"); + "Items free in the slab layer"); + SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "free_slabs", CTLFLAG_RD, &dom->ud_free_slabs, 0, + "Unused slabs"); } } else SYSCTL_ADD_CONST_STRING(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0971F668293; Fri, 17 Sep 2021 19:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vk4PbWz3Q5k; Fri, 17 Sep 2021 19:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BD941B2CA; Fri, 17 Sep 2021 19:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCUcQ068169; Fri, 17 Sep 2021 19:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCU54068168; Fri, 17 Sep 2021 19:12:30 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:30 GMT Message-Id: <202109171912.18HJCU54068168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7fabaac2211e - main - rpc: Convert an SOLISTENING check to an assertion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fabaac2211e7ed1cec9650e46f4e03428411dcf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7fabaac2211e7ed1cec9650e46f4e03428411dcf commit 7fabaac2211e7ed1cec9650e46f4e03428411dcf Author: Mark Johnston AuthorDate: 2021-09-17 16:13:02 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:05 +0000 rpc: Convert an SOLISTENING check to an assertion Per the comment, this socket should always be a listening socket. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/rpc/svc_vc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c index d81c0b01d84d..77452d906594 100644 --- a/sys/rpc/svc_vc.c +++ b/sys/rpc/svc_vc.c @@ -328,11 +328,9 @@ svc_vc_accept(struct socket *head, struct socket **sop) int error = 0; short nbio; - /* XXXGL: shouldn't that be an assertion? */ - if (!SOLISTENING(head)) { - error = EINVAL; - goto done; - } + KASSERT(SOLISTENING(head), + ("%s: socket %p is not listening", __func__, head)); + #ifdef MAC error = mac_socket_check_accept(curthread->td_ucred, head); if (error != 0) From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41C9366803E; Fri, 17 Sep 2021 19:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vn0l3Vz3Plf; Fri, 17 Sep 2021 19:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AC061B41B; Fri, 17 Sep 2021 19:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCWdL068221; Fri, 17 Sep 2021 19:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCWIj068220; Fri, 17 Sep 2021 19:12:32 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:32 GMT Message-Id: <202109171912.18HJCWIj068220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bf25678226f0 - main - ktls: Fix error/mode confusion in TCP_*TLS_MODE getsockopt handlers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf25678226f0d9b52c27610c734c97d76a7cae59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bf25678226f0d9b52c27610c734c97d76a7cae59 commit bf25678226f0d9b52c27610c734c97d76a7cae59 Author: Mark Johnston AuthorDate: 2021-09-17 16:14:29 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:05 +0000 ktls: Fix error/mode confusion in TCP_*TLS_MODE getsockopt handlers ktls_get_(rx|tx)_mode() can return an errno value or a TLS mode, so errors are effectively hidden. Fix this by using a separate output parameter. Convert to the new socket buffer locking macros while here. Note that the socket buffer lock is not needed to synchronize the SOLISTENING check here, we can rely on the PCB lock. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31977 --- sys/kern/uipc_ktls.c | 26 ++++++++++++-------------- sys/netinet/tcp_usrreq.c | 12 ++++++++---- sys/sys/ktls.h | 4 ++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 9e9a6b5b60fb..bc21e6fe2493 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1199,45 +1199,43 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) } int -ktls_get_rx_mode(struct socket *so) +ktls_get_rx_mode(struct socket *so, int *modep) { struct ktls_session *tls; struct inpcb *inp; - int mode; if (SOLISTENING(so)) return (EINVAL); inp = so->so_pcb; INP_WLOCK_ASSERT(inp); - SOCKBUF_LOCK(&so->so_rcv); + SOCK_RECVBUF_LOCK(so); tls = so->so_rcv.sb_tls_info; if (tls == NULL) - mode = TCP_TLS_MODE_NONE; + *modep = TCP_TLS_MODE_NONE; else - mode = tls->mode; - SOCKBUF_UNLOCK(&so->so_rcv); - return (mode); + *modep = tls->mode; + SOCK_RECVBUF_UNLOCK(so); + return (0); } int -ktls_get_tx_mode(struct socket *so) +ktls_get_tx_mode(struct socket *so, int *modep) { struct ktls_session *tls; struct inpcb *inp; - int mode; if (SOLISTENING(so)) return (EINVAL); inp = so->so_pcb; INP_WLOCK_ASSERT(inp); - SOCKBUF_LOCK(&so->so_snd); + SOCK_SENDBUF_LOCK(so); tls = so->so_snd.sb_tls_info; if (tls == NULL) - mode = TCP_TLS_MODE_NONE; + *modep = TCP_TLS_MODE_NONE; else - mode = tls->mode; - SOCKBUF_UNLOCK(&so->so_snd); - return (mode); + *modep = tls->mode; + SOCK_SENDBUF_UNLOCK(so); + return (0); } /* diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 3a1608cc106a..e9f7fa541461 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2563,14 +2563,18 @@ unhold: #endif #ifdef KERN_TLS case TCP_TXTLS_MODE: - optval = ktls_get_tx_mode(so); + error = ktls_get_tx_mode(so, &optval); INP_WUNLOCK(inp); - error = sooptcopyout(sopt, &optval, sizeof(optval)); + if (error == 0) + error = sooptcopyout(sopt, &optval, + sizeof(optval)); break; case TCP_RXTLS_MODE: - optval = ktls_get_rx_mode(so); + error = ktls_get_rx_mode(so, &optval); INP_WUNLOCK(inp); - error = sooptcopyout(sopt, &optval, sizeof(optval)); + if (error == 0) + error = sooptcopyout(sopt, &optval, + sizeof(optval)); break; #endif case TCP_LRD: diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 9729fd6fe8c4..71d55ee1b3d8 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -212,9 +212,9 @@ void ktls_frame(struct mbuf *m, struct ktls_session *tls, int *enqueue_cnt, void ktls_seq(struct sockbuf *sb, struct mbuf *m); void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count); void ktls_enqueue_to_free(struct mbuf *m); -int ktls_get_rx_mode(struct socket *so); +int ktls_get_rx_mode(struct socket *so, int *modep); int ktls_set_tx_mode(struct socket *so, int mode); -int ktls_get_tx_mode(struct socket *so); +int ktls_get_tx_mode(struct socket *so, int *modep); int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls); #ifdef RATELIMIT int ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE5B16B7F66; Fri, 17 Sep 2021 19:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vn52F6z3Q5y; Fri, 17 Sep 2021 19:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C4491B603; Fri, 17 Sep 2021 19:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCXr2068250; Fri, 17 Sep 2021 19:12:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCXAI068249; Fri, 17 Sep 2021 19:12:33 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:33 GMT Message-Id: <202109171912.18HJCXAI068249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: dfcef8771484 - main - socket: Fix a use-after-free in soclose() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfcef8771484271f2bccdb1dbc088a838441c5a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:34 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dfcef8771484271f2bccdb1dbc088a838441c5a7 commit dfcef8771484271f2bccdb1dbc088a838441c5a7 Author: Mark Johnston AuthorDate: 2021-09-17 16:26:06 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:05 +0000 socket: Fix a use-after-free in soclose() After releasing the fd reference to a socket "so", we should avoid testing SOLISTENING(so) since the socket may have been freed. Instead, directly test whether the list of unaccepted sockets is empty. Fixes: f4bb1869ddd2 ("Consistently use the SOLISTENING() macro") Pointy hat: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31973 --- sys/kern/uipc_socket.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 95222a1ecf7b..f1a3b5acc827 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1223,6 +1223,7 @@ int soclose(struct socket *so) { struct accept_queue lqueue; + struct socket *sp, *tsp; int error = 0; KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter")); @@ -1257,11 +1258,9 @@ drop: if (so->so_proto->pr_usrreqs->pru_close != NULL) (*so->so_proto->pr_usrreqs->pru_close)(so); + TAILQ_INIT(&lqueue); SOCK_LOCK(so); if (SOLISTENING(so)) { - struct socket *sp; - - TAILQ_INIT(&lqueue); TAILQ_SWAP(&lqueue, &so->sol_incomp, socket, so_list); TAILQ_CONCAT(&lqueue, &so->sol_comp, so_list); @@ -1279,17 +1278,14 @@ drop: KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); so->so_state |= SS_NOFDREF; sorele(so); - if (SOLISTENING(so)) { - struct socket *sp, *tsp; - - TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { - SOCK_LOCK(sp); - if (sp->so_count == 0) { - SOCK_UNLOCK(sp); - soabort(sp); - } else - /* sp is now in sofree() */ - SOCK_UNLOCK(sp); + TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) { + SOCK_LOCK(sp); + if (refcount_load(&sp->so_count) == 0) { + SOCK_UNLOCK(sp); + soabort(sp); + } else { + /* sp is now in sofree() */ + SOCK_UNLOCK(sp); } } CURVNET_RESTORE(); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18377668385; Fri, 17 Sep 2021 19:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vp6x3pz3Q1j; Fri, 17 Sep 2021 19:12:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B44B51B604; Fri, 17 Sep 2021 19:12:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCYmk068274; Fri, 17 Sep 2021 19:12:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCYtH068273; Fri, 17 Sep 2021 19:12:34 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:34 GMT Message-Id: <202109171912.18HJCYtH068273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6b288408ca32 - main - socket: Add assertions around naked refcount decrements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b288408ca32e68c74f6ab12324448ab4862a045 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:35 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6b288408ca32e68c74f6ab12324448ab4862a045 commit 6b288408ca32e68c74f6ab12324448ab4862a045 Author: Mark Johnston AuthorDate: 2021-09-17 16:26:56 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:06 +0000 socket: Add assertions around naked refcount decrements Sockets in a listen queue hold a reference to the parent listening socket. Several code paths release this reference manually when moving a child socket out of the queue. Replace comments about the expected post-decrement refcount value with assertions. Use refcount_load() instead of a plain load. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31974 --- sys/kern/uipc_socket.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f1a3b5acc827..9e898861f8f4 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1120,11 +1120,12 @@ void sofree(struct socket *so) { struct protosw *pr = so->so_proto; + bool last __diagused; SOCK_LOCK_ASSERT(so); - if ((so->so_state & SS_NOFDREF) == 0 || so->so_count != 0 || - (so->so_state & SS_PROTOREF) || (so->so_qstate == SQ_COMP)) { + if ((so->so_state & (SS_NOFDREF | SS_PROTOREF)) != SS_NOFDREF || + refcount_load(&so->so_count) != 0 || so->so_qstate == SQ_COMP) { SOCK_UNLOCK(so); return; } @@ -1160,8 +1161,9 @@ sofree(struct socket *so) __func__, so, sol)); TAILQ_REMOVE(&sol->sol_incomp, so, so_list); sol->sol_incqlen--; - /* This is guarenteed not to be the last. */ - refcount_release(&sol->so_count); + last = refcount_release(&sol->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, sol)); so->so_qstate = SQ_NONE; so->so_listen = NULL; } else @@ -1169,7 +1171,7 @@ sofree(struct socket *so) ("%s: so %p not on (in)comp with so_listen", __func__, so)); sorele(sol); - KASSERT(so->so_count == 1, + KASSERT(refcount_load(&so->so_count) == 1, ("%s: so %p count %u", __func__, so, so->so_count)); so->so_count = 0; } @@ -1225,6 +1227,7 @@ soclose(struct socket *so) struct accept_queue lqueue; struct socket *sp, *tsp; int error = 0; + bool last __diagused; KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter")); @@ -1271,8 +1274,9 @@ drop: sp->so_qstate = SQ_NONE; sp->so_listen = NULL; SOCK_UNLOCK(sp); - /* Guaranteed not to be the last. */ - refcount_release(&so->so_count); + last = refcount_release(&so->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, so)); } } KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); @@ -1284,7 +1288,7 @@ drop: SOCK_UNLOCK(sp); soabort(sp); } else { - /* sp is now in sofree() */ + /* See the handling of queued sockets in sofree(). */ SOCK_UNLOCK(sp); } } @@ -4010,6 +4014,7 @@ soisconnecting(struct socket *so) void soisconnected(struct socket *so) { + bool last __diagused; SOCK_LOCK(so); so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); @@ -4042,8 +4047,9 @@ soisconnected(struct socket *so) sorele(head); return; } - /* Not the last one, as so holds a ref. */ - refcount_release(&head->so_count); + last = refcount_release(&head->so_count); + KASSERT(!last, ("%s: released last reference for %p", + __func__, head)); } again: if ((so->so_options & SO_ACCEPTFILTER) == 0) { From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 457DD6681C2; Fri, 17 Sep 2021 19:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vr0c4dz3Q3Y; Fri, 17 Sep 2021 19:12:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0C981B269; Fri, 17 Sep 2021 19:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCZDe068298; Fri, 17 Sep 2021 19:12:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCZBq068297; Fri, 17 Sep 2021 19:12:35 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:35 GMT Message-Id: <202109171912.18HJCZBq068297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 883761f0a81a - main - socket: Remove NOFREE from the socket zone MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 883761f0a81af392893b235632159b15b898e4c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:36 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=883761f0a81af392893b235632159b15b898e4c6 commit 883761f0a81af392893b235632159b15b898e4c6 Author: Mark Johnston AuthorDate: 2021-09-17 16:27:26 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:06 +0000 socket: Remove NOFREE from the socket zone This flag was added during the transition away from the legacy zone allocator, commit c897b81311792ccf6a93feff2a405e2ae53f664e. The old zone allocator effectively provided _NOFREE semantics, but it seems that they are not required for sockets. In particular, we use reference counting to keep sockets live. One somewhat dangerous case is sonewconn(), which returns a pointer to a socket with reference count 0. This socket is still effectively owned by the listening socket. Protocols must therefore be careful to synchronize sonewconn() calls with their pru_close implementations, since for listening sockets soclose() will abort the child sockets. For example, TCP holds the listening socket's PCB read locked across the sonewconn() call, which blocks tcp_usr_close(), and sofree() synchronizes with a concurrent soabort() of the nascent socket. However, _NOFREE semantics are not required here. Eliminating _NOFREE has several benefits: it enables use-after-free detection (e.g., by KASAN) and lets the system reclaim memory from the socket zone under memory pressure. No functional change intended. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31975 --- sys/kern/uipc_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 9e898861f8f4..c3f52a4640d3 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -309,7 +309,7 @@ socket_init(void *tag) { socket_zone = uma_zcreate("socket", sizeof(struct socket), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + NULL, NULL, UMA_ALIGN_PTR, 0); maxsockets = uma_zone_set_max(socket_zone, maxsockets); uma_zone_set_warning(socket_zone, "kern.ipc.maxsockets limit reached"); EVENTHANDLER_REGISTER(maxsockets_change, socket_zone_change, NULL, From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67F0D6681C6; Fri, 17 Sep 2021 19:12:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vs1BLYz3Q1r; Fri, 17 Sep 2021 19:12:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 033071B491; Fri, 17 Sep 2021 19:12:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCa1i068322; Fri, 17 Sep 2021 19:12:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCaPI068321; Fri, 17 Sep 2021 19:12:36 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:36 GMT Message-Id: <202109171912.18HJCaPI068321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ade1daa5c0d6 - main - socket: Synchronize soshutdown() with listen(2) and AIO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ade1daa5c0d66b9086f9066297ed984932b5e212 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ade1daa5c0d66b9086f9066297ed984932b5e212 commit ade1daa5c0d66b9086f9066297ed984932b5e212 Author: Mark Johnston AuthorDate: 2021-09-17 16:29:28 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:06 +0000 socket: Synchronize soshutdown() with listen(2) and AIO To handle shutdown(SHUT_RD) we flush the receive buffer of the socket. This may involve searching for control messages of type SCM_RIGHTS, since we need to close the file references. Closing arbitrary files with socket buffer locks held is undesirable, mainly due to lock ordering issues, so we instead make a copy of the socket buffer and operate on that without any locks. Fields in the original buffer are cleared. This behaviour clobbered the AIO job queue associated with a receive buffer. It could also cause us to leak a KTLS session reference. Reorder socket buffer fields to address this. An alternate solution would be to remove the hack in sorflush(), but this is not quite feasible (yet). In particular, though sorflush() flags the sockbuf with SBS_CANTRCVMORE, it is possible for more data to be queued - the flag just prevents userspace from reading more data. I suspect we should fix this; SBS_CANTRCVMORE represents a terminal state and protocols can likely just drop any data destined for such a buffer. Many of them already do, but in some cases the check is racy, and some KPI churn will be needed to fix everything. This approach is more straightforward for now. Reported by: syzbot+104d8ee3430361cb2795@syzkaller.appspotmail.com Reported by: syzbot+5bd2e7d05f84a59d0d1b@syzkaller.appspotmail.com Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31976 --- sys/kern/uipc_socket.c | 54 ++++++++++++++++++++++++++++++-------------------- sys/sys/sockbuf.h | 5 +++-- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index c3f52a4640d3..1f999108dd71 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2847,13 +2847,14 @@ soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, int soshutdown(struct socket *so, int how) { - struct protosw *pr = so->so_proto; + struct protosw *pr; int error, soerror_enotconn; if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) return (EINVAL); soerror_enotconn = 0; + SOCK_LOCK(so); if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING)) == 0) { /* @@ -2865,21 +2866,26 @@ soshutdown(struct socket *so, int how) * both backward-compatibility and POSIX requirements by forcing * ENOTCONN but still asking protocol to perform pru_shutdown(). */ - if (so->so_type != SOCK_DGRAM && !SOLISTENING(so)) + if (so->so_type != SOCK_DGRAM && !SOLISTENING(so)) { + SOCK_UNLOCK(so); return (ENOTCONN); + } soerror_enotconn = 1; } if (SOLISTENING(so)) { if (how != SHUT_WR) { - SOLISTEN_LOCK(so); so->so_error = ECONNABORTED; solisten_wakeup(so); /* unlocks so */ + } else { + SOCK_UNLOCK(so); } goto done; } + SOCK_UNLOCK(so); CURVNET_SET(so->so_vnet); + pr = so->so_proto; if (pr->pr_usrreqs->pru_flush != NULL) (*pr->pr_usrreqs->pru_flush)(so, how); if (how != SHUT_WR) @@ -2900,20 +2906,21 @@ done: void sorflush(struct socket *so) { - struct sockbuf *sb = &so->so_rcv; - struct protosw *pr = so->so_proto; struct socket aso; + struct protosw *pr; int error; VNET_SO_ASSERT(so); /* * In order to avoid calling dom_dispose with the socket buffer mutex - * held, and in order to generally avoid holding the lock for a long - * time, we make a copy of the socket buffer and clear the original - * (except locks, state). The new socket buffer copy won't have - * initialized locks so we can only call routines that won't use or - * assert those locks. + * held, we make a partial copy of the socket buffer and clear the + * original. The new socket buffer copy won't have initialized locks so + * we can only call routines that won't use or assert those locks. + * Ideally calling socantrcvmore() would prevent data from being added + * to the buffer, but currently it merely prevents buffered data from + * being read by userspace. We make this effort to free buffered data + * nonetheless. * * Dislodge threads currently blocked in receive and wait to acquire * a lock against other simultaneous readers before clearing the @@ -2921,28 +2928,31 @@ sorflush(struct socket *so) * despite any existing socket disposition on interruptable waiting. */ socantrcvmore(so); + error = SOCK_IO_RECV_LOCK(so, SBL_WAIT | SBL_NOINTR); - KASSERT(error == 0, ("%s: cannot lock sock %p recv buffer", - __func__, so)); + if (error != 0) { + KASSERT(SOLISTENING(so), + ("%s: soiolock(%p) failed", __func__, so)); + return; + } - /* - * Invalidate/clear most of the sockbuf structure, but leave selinfo - * and mutex data unchanged. - */ - SOCKBUF_LOCK(sb); + SOCK_RECVBUF_LOCK(so); bzero(&aso, sizeof(aso)); aso.so_pcb = so->so_pcb; - bcopy(&sb->sb_startzero, &aso.so_rcv.sb_startzero, - sizeof(*sb) - offsetof(struct sockbuf, sb_startzero)); - bzero(&sb->sb_startzero, - sizeof(*sb) - offsetof(struct sockbuf, sb_startzero)); - SOCKBUF_UNLOCK(sb); + bcopy(&so->so_rcv.sb_startzero, &aso.so_rcv.sb_startzero, + offsetof(struct sockbuf, sb_endzero) - + offsetof(struct sockbuf, sb_startzero)); + bzero(&so->so_rcv.sb_startzero, + offsetof(struct sockbuf, sb_endzero) - + offsetof(struct sockbuf, sb_startzero)); + SOCK_RECVBUF_UNLOCK(so); SOCK_IO_RECV_UNLOCK(so); /* * Dispose of special rights and flush the copied socket. Don't call * any unsafe routines (that rely on locks being initialized) on aso. */ + pr = so->so_proto; if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL) (*pr->pr_domain->dom_dispose)(&aso); sbrelease_internal(&aso.so_rcv, so); diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index 3fc9b10cd240..eb35a372cae5 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -104,12 +104,13 @@ struct sockbuf { u_int sb_tlsdcc; /* (a) TLS characters being decrypted */ int sb_lowat; /* (a) low water mark */ sbintime_t sb_timeo; /* (a) timeout for read/write */ - uint64_t sb_tls_seqno; /* (a) TLS seqno */ - struct ktls_session *sb_tls_info; /* (a + b) TLS state */ struct mbuf *sb_mtls; /* (a) TLS mbuf chain */ struct mbuf *sb_mtlstail; /* (a) last mbuf in TLS chain */ int (*sb_upcall)(struct socket *, void *, int); /* (a) */ void *sb_upcallarg; /* (a) */ +#define sb_endzero sb_tls_seqno + uint64_t sb_tls_seqno; /* (a) TLS seqno */ + struct ktls_session *sb_tls_info; /* (a + b) TLS state */ TAILQ_HEAD(, kaiocb) sb_aiojobq; /* (a) pending AIO ops */ struct task sb_aiotask; /* AIO task */ }; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1FEE6682AF; Fri, 17 Sep 2021 19:12:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vv6hrfz3Q23; Fri, 17 Sep 2021 19:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 429091B605; Fri, 17 Sep 2021 19:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCd2W068376; Fri, 17 Sep 2021 19:12:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCdm4068375; Fri, 17 Sep 2021 19:12:39 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:39 GMT Message-Id: <202109171912.18HJCdm4068375@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2bd9826995ca - main - vfs: Permit unix sockets to be opened with O_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bd9826995ca6b23f8b088cfa035c0ad1c578ac3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:40 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2bd9826995ca6b23f8b088cfa035c0ad1c578ac3 commit 2bd9826995ca6b23f8b088cfa035c0ad1c578ac3 Author: Mark Johnston AuthorDate: 2021-09-17 16:34:21 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:06 +0000 vfs: Permit unix sockets to be opened with O_PATH As with FIFOs, a path descriptor for a unix socket cannot be used with kevent(). In principle connectat(2) and bindat(2) could be modified to support an AT_EMPTY_PATH-like mode which operates on the socket referenced by an O_PATH fd referencing a unix socket. That would eliminate the path length limit imposed by sockaddr_un. Update O_PATH tests. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31970 --- sys/kern/vfs_vnops.c | 11 ++++------- tests/sys/file/path_test.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 93d5a9e6b127..d4229160f11e 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -399,13 +399,13 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, if ((fmode & O_PATH) == 0 || (fmode & FEXEC) != 0) return (EMLINK); } - if (vp->v_type == VSOCK) - return (EOPNOTSUPP); if (vp->v_type != VDIR && fmode & O_DIRECTORY) return (ENOTDIR); accmode = 0; if ((fmode & O_PATH) == 0) { + if (vp->v_type == VSOCK) + return (EOPNOTSUPP); if ((fmode & (FWRITE | O_TRUNC)) != 0) { if (vp->v_type == VDIR) return (EISDIR); @@ -437,11 +437,8 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, return (error); } if ((fmode & O_PATH) != 0) { - if (vp->v_type == VFIFO) - error = EPIPE; - else - error = VOP_ACCESS(vp, VREAD, cred, td); - if (error == 0) + if (vp->v_type != VFIFO && vp->v_type != VSOCK && + VOP_ACCESS(vp, VREAD, cred, td) == 0) fp->f_flag |= FKQALLOWED; return (0); } diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index ad88c691a914..a39862cc78d6 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -845,13 +845,15 @@ ATF_TC_BODY(path_rights, tc) CHECKED_CLOSE(sd[1]); } -/* Verify that a local socket can't be opened with O_PATH. */ +/* Verify that a local socket can be opened with O_PATH. */ ATF_TC_WITHOUT_HEAD(path_unix); ATF_TC_BODY(path_unix, tc) { - char path[PATH_MAX]; + char buf[BUFSIZ], path[PATH_MAX]; + struct kevent ev; struct sockaddr_un sun; - int pathfd, sd; + struct stat sb; + int kq, pathfd, sd; snprintf(path, sizeof(path), "path_unix.XXXXXX"); ATF_REQUIRE_MSG(mktemp(path) == path, FMT_ERR("mktemp")); @@ -866,9 +868,31 @@ ATF_TC_BODY(path_unix, tc) FMT_ERR("bind")); pathfd = open(path, O_PATH); - ATF_REQUIRE_ERRNO(EOPNOTSUPP, pathfd < 0); + ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open")); + + ATF_REQUIRE_MSG(fstatat(pathfd, "", &sb, AT_EMPTY_PATH) == 0, + FMT_ERR("fstatat")); + ATF_REQUIRE_MSG(sb.st_mode & S_IFSOCK, "socket mode %#x", sb.st_mode); + ATF_REQUIRE_MSG(sb.st_ino != 0, "socket has inode number 0"); + + memset(buf, 0, sizeof(buf)); + ATF_REQUIRE_ERRNO(EBADF, write(pathfd, buf, sizeof(buf))); + ATF_REQUIRE_ERRNO(EBADF, read(pathfd, buf, sizeof(buf))); + + /* kevent() is disallowed with sockets. */ + kq = kqueue(); + ATF_REQUIRE_MSG(kq >= 0, FMT_ERR("kqueue")); + EV_SET(&ev, pathfd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + ATF_REQUIRE_ERRNO(EBADF, kevent(kq, &ev, 1, NULL, 0, NULL) == -1); + + /* Should not be able to open a socket without O_PATH. */ + ATF_REQUIRE_ERRNO(EOPNOTSUPP, openat(pathfd, "", O_EMPTY_PATH) == -1); + + ATF_REQUIRE_MSG(funlinkat(AT_FDCWD, path, pathfd, 0) == 0, + FMT_ERR("funlinkat")); CHECKED_CLOSE(sd); + CHECKED_CLOSE(pathfd); } ATF_TP_ADD_TCS(tp) From owner-dev-commits-src-main@freebsd.org Fri Sep 17 19:12:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA7416B785E; Fri, 17 Sep 2021 19:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB3Vt4GQFz3Q7n; Fri, 17 Sep 2021 19:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 251BA1B26A; Fri, 17 Sep 2021 19:12:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HJCcn3068348; Fri, 17 Sep 2021 19:12:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HJCcWK068347; Fri, 17 Sep 2021 19:12:38 GMT (envelope-from git) Date: Fri, 17 Sep 2021 19:12:38 GMT Message-Id: <202109171912.18HJCcWK068347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c13f6dd7d213 - main - aio_test: Validate interactions between AIO on sockets and shutdown(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c13f6dd7d213cf08a26ed9a08290e239b49c25c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 19:12:39 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c13f6dd7d213cf08a26ed9a08290e239b49c25c4 commit c13f6dd7d213cf08a26ed9a08290e239b49c25c4 Author: Mark Johnston AuthorDate: 2021-09-17 16:31:59 +0000 Commit: Mark Johnston CommitDate: 2021-09-17 18:19:06 +0000 aio_test: Validate interactions between AIO on sockets and shutdown(2) Reviewed by: asomers, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31976 --- tests/sys/aio/aio_test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index a81cb906e38a..c3cf1d372e23 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -1319,6 +1320,72 @@ ATF_TC_BODY(aio_socket_short_write_cancel, tc) close(s[0]); } +/* + * Test handling of aio_read() and aio_write() on shut-down sockets. + */ +ATF_TC_WITHOUT_HEAD(aio_socket_shutdown); +ATF_TC_BODY(aio_socket_shutdown, tc) +{ + struct aiocb iocb; + sigset_t set; + char *buffer; + ssize_t len; + size_t bsz; + int error, s[2]; + + ATF_REQUIRE_KERNEL_MODULE("aio"); + + ATF_REQUIRE(socketpair(PF_UNIX, SOCK_STREAM, 0, s) != -1); + + bsz = 1024; + buffer = malloc(bsz); + memset(buffer, 0, bsz); + + /* Put some data in s[0]'s recv buffer. */ + ATF_REQUIRE(send(s[1], buffer, bsz, 0) == (ssize_t)bsz); + + /* No more reading from s[0]. */ + ATF_REQUIRE(shutdown(s[0], SHUT_RD) != -1); + + ATF_REQUIRE(buffer != NULL); + + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s[0]; + iocb.aio_buf = buffer; + iocb.aio_nbytes = bsz; + ATF_REQUIRE(aio_read(&iocb) == 0); + + /* Expect to see zero bytes, analogous to recv(2). */ + while ((error = aio_error(&iocb)) == EINPROGRESS) + usleep(25000); + ATF_REQUIRE_MSG(error == 0, "aio_error() returned %d", error); + len = aio_return(&iocb); + ATF_REQUIRE_MSG(len == 0, "read job returned %zd bytes", len); + + /* No more writing to s[1]. */ + ATF_REQUIRE(shutdown(s[1], SHUT_WR) != -1); + + /* Block SIGPIPE so that we can detect the error in-band. */ + sigemptyset(&set); + sigaddset(&set, SIGPIPE); + ATF_REQUIRE(sigprocmask(SIG_BLOCK, &set, NULL) == 0); + + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s[1]; + iocb.aio_buf = buffer; + iocb.aio_nbytes = bsz; + ATF_REQUIRE(aio_write(&iocb) == 0); + + /* Expect an error, analogous to send(2). */ + while ((error = aio_error(&iocb)) == EINPROGRESS) + usleep(25000); + ATF_REQUIRE_MSG(error == EPIPE, "aio_error() returned %d", error); + + ATF_REQUIRE(close(s[0]) != -1); + ATF_REQUIRE(close(s[1]) != -1); + free(buffer); +} + /* * test aio_fsync's behavior with bad inputs */ @@ -1885,6 +1952,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, aio_socket_listen_fail); ATF_TP_ADD_TC(tp, aio_socket_listen_pending); ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); + ATF_TP_ADD_TC(tp, aio_socket_shutdown); ATF_TP_ADD_TC(tp, aio_writev_dos_iov_len); ATF_TP_ADD_TC(tp, aio_writev_dos_iovcnt); ATF_TP_ADD_TC(tp, aio_writev_efault); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:05:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E283B66A100; Fri, 17 Sep 2021 21:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB60d5pQzz4f1D; Fri, 17 Sep 2021 21:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2D561D085; Fri, 17 Sep 2021 21:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HL556I014982; Fri, 17 Sep 2021 21:05:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HL55YB014981; Fri, 17 Sep 2021 21:05:05 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:05:05 GMT Message-Id: <202109172105.18HL55YB014981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: a4378873e9ce - main - e1000: Revert Update intel shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4378873e9ce1b35b55378c21f8eae69e58c2525 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:05:06 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a4378873e9ce1b35b55378c21f8eae69e58c2525 commit a4378873e9ce1b35b55378c21f8eae69e58c2525 Author: Kevin Bowling AuthorDate: 2021-09-08 22:43:13 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:03:08 +0000 e1000: Revert Update intel shared code This reverts commit fc7682b17f3738573099b8b03f5628dcc8148adb. This will be done incrementally to help with bisecting an issue in later I21x devices (ich8lan). PR: 258153 Approved by: imp MFC after: 1 day --- sys/dev/e1000/e1000_80003es2lan.c | 36 ++--- sys/dev/e1000/e1000_80003es2lan.h | 38 ++--- sys/dev/e1000/e1000_82540.c | 40 ++--- sys/dev/e1000/e1000_82541.c | 40 ++--- sys/dev/e1000/e1000_82541.h | 40 ++--- sys/dev/e1000/e1000_82542.c | 40 ++--- sys/dev/e1000/e1000_82543.c | 40 ++--- sys/dev/e1000/e1000_82543.h | 40 ++--- sys/dev/e1000/e1000_82571.c | 42 ++--- sys/dev/e1000/e1000_82571.h | 40 ++--- sys/dev/e1000/e1000_82575.c | 40 ++--- sys/dev/e1000/e1000_82575.h | 40 ++--- sys/dev/e1000/e1000_api.c | 56 +++---- sys/dev/e1000/e1000_api.h | 41 +++-- sys/dev/e1000/e1000_defines.h | 73 +++------ sys/dev/e1000/e1000_hw.h | 42 +++-- sys/dev/e1000/e1000_i210.c | 140 +++-------------- sys/dev/e1000/e1000_i210.h | 42 +++-- sys/dev/e1000/e1000_ich8lan.c | 316 ++++++++------------------------------ sys/dev/e1000/e1000_ich8lan.h | 47 +++--- sys/dev/e1000/e1000_mac.c | 40 ++--- sys/dev/e1000/e1000_mac.h | 40 ++--- sys/dev/e1000/e1000_manage.c | 40 ++--- sys/dev/e1000/e1000_manage.h | 40 ++--- sys/dev/e1000/e1000_mbx.c | 40 ++--- sys/dev/e1000/e1000_mbx.h | 40 ++--- sys/dev/e1000/e1000_nvm.c | 199 +++--------------------- sys/dev/e1000/e1000_nvm.h | 42 ++--- sys/dev/e1000/e1000_osdep.c | 40 ++--- sys/dev/e1000/e1000_osdep.h | 40 ++--- sys/dev/e1000/e1000_phy.c | 62 ++++---- sys/dev/e1000/e1000_phy.h | 49 +++--- sys/dev/e1000/e1000_regs.h | 55 +++---- sys/dev/e1000/e1000_vf.c | 43 +++--- sys/dev/e1000/e1000_vf.h | 40 ++--- sys/dev/e1000/if_em.c | 10 +- 36 files changed, 755 insertions(+), 1298 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index c1aa47a73ac8..5c0220adfc6f 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation 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, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its + + 3. Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_80003es2lan.h b/sys/dev/e1000/e1000_80003es2lan.h index 501cfc958819..cbf0eafa9407 100644 --- a/sys/dev/e1000/e1000_80003es2lan.h +++ b/sys/dev/e1000/e1000_80003es2lan.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index 720798260f8a..adc944a8ebb4 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index aaa3de7f02ce..ead974cb1358 100644 --- a/sys/dev/e1000/e1000_82541.c +++ b/sys/dev/e1000/e1000_82541.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82541.h b/sys/dev/e1000/e1000_82541.h index d31065d9a182..ce29548a4d85 100644 --- a/sys/dev/e1000/e1000_82541.h +++ b/sys/dev/e1000/e1000_82541.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82542.c b/sys/dev/e1000/e1000_82542.c index 2fdf7066865b..09906699ab10 100644 --- a/sys/dev/e1000/e1000_82542.c +++ b/sys/dev/e1000/e1000_82542.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index 42c4726fa8c7..e247b01f6cda 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82543.h b/sys/dev/e1000/e1000_82543.h index 27f8507fb63c..98289524f6d8 100644 --- a/sys/dev/e1000/e1000_82543.h +++ b/sys/dev/e1000/e1000_82543.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 8db1fcb921a9..348a3daa3c05 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -515,7 +515,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) u32 extcnf_ctrl; s32 i = 0; /* XXX assert that mutex is held */ - DEBUGFUNC("e1000_get_hw_semaphore_82574"); + DEBUGFUNC("e1000_get_hw_semaphore_82573"); ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); diff --git a/sys/dev/e1000/e1000_82571.h b/sys/dev/e1000/e1000_82571.h index 77303adb162f..a39f63c53e2d 100644 --- a/sys/dev/e1000/e1000_82571.h +++ b/sys/dev/e1000/e1000_82571.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index d588539ca8e8..81bd419fcf0d 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index 22c2f8c4a2f5..36045556661b 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index b28ab77f3794..b1d5ef74c24f 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -383,7 +383,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_I210_COPPER_FLASHLESS: case E1000_DEV_ID_I210_SERDES_FLASHLESS: - case E1000_DEV_ID_I210_SGMII_FLASHLESS: case E1000_DEV_ID_I210_COPPER: case E1000_DEV_ID_I210_COPPER_OEM1: case E1000_DEV_ID_I210_COPPER_IT: @@ -1269,21 +1268,6 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) return e1000_read_pba_length_generic(hw, pba_num_size); } -/** - * e1000_read_pba_num - Read device part number - * @hw: pointer to the HW structure - * @pba_num: pointer to device part number - * - * Reads the product board assembly (PBA) number from the EEPROM and stores - * the value in pba_num. - * Currently no func pointer exists and all implementations are handled in the - * generic version of this function. - **/ -s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) -{ - return e1000_read_pba_num_generic(hw, pba_num); -} - /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index b558b1cf5f23..bf5f637cb3dd 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -100,7 +100,6 @@ void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); -s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); void e1000_reload_nvm(struct e1000_hw *hw); s32 e1000_update_nvm_checksum(struct e1000_hw *hw); s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 6c1138ed9335..262b01dd5b64 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2020, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -1070,44 +1070,11 @@ /* NVM Word Offsets */ #define NVM_COMPAT 0x0003 #define NVM_ID_LED_SETTINGS 0x0004 -#define NVM_VERSION 0x0005 #define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ #define NVM_PHY_CLASS_WORD 0x0007 #define E1000_I210_NVM_FW_MODULE_PTR 0x0010 #define E1000_I350_NVM_FW_MODULE_PTR 0x0051 #define NVM_FUTURE_INIT_WORD1 0x0019 -#define NVM_ETRACK_WORD 0x0042 -#define NVM_ETRACK_HIWORD 0x0043 -#define NVM_COMB_VER_OFF 0x0083 -#define NVM_COMB_VER_PTR 0x003D - -/* NVM version defines */ -#define NVM_MAJOR_MASK 0xF000 -#define NVM_MINOR_MASK 0x0FF0 -#define NVM_IMAGE_ID_MASK 0x000F -#define NVM_COMB_VER_MASK 0x00FF -#define NVM_MAJOR_SHIFT 12 -#define NVM_MINOR_SHIFT 4 -#define NVM_COMB_VER_SHFT 8 -#define NVM_VER_INVALID 0xFFFF -#define NVM_ETRACK_SHIFT 16 -#define NVM_ETRACK_VALID 0x8000 -#define NVM_NEW_DEC_MASK 0x0F00 -#define NVM_HEX_CONV 16 -#define NVM_HEX_TENS 10 *** 2213 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:06:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C2F1669C46; Fri, 17 Sep 2021 21:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6231Zn9z4fC3; Fri, 17 Sep 2021 21:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15BC11D10B; Fri, 17 Sep 2021 21:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HL6JwN015182; Fri, 17 Sep 2021 21:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HL6IcQ015181; Fri, 17 Sep 2021 21:06:18 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:06:18 GMT Message-Id: <202109172106.18HL6IcQ015181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 702cac6c6bf2 - main - e1000: Update copyrights and readme MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 702cac6c6bf20ca43db26c38185f65fc9ed1935e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:06:19 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=702cac6c6bf20ca43db26c38185f65fc9ed1935e commit 702cac6c6bf20ca43db26c38185f65fc9ed1935e Author: Kevin Bowling AuthorDate: 2021-09-16 11:35:45 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:06:01 +0000 e1000: Update copyrights and readme Copyrights in sync with "cid-gigabit.2020.06.05.tar.gz released by ND" (from DPDK). README from the latest em-7.7.8 on intel.com Approved by: imp MFC after: 1 week --- sys/dev/e1000/LICENSE | 41 ++- sys/dev/e1000/README | 547 ++++++++++++++++++++------------------ sys/dev/e1000/e1000_80003es2lan.c | 40 +-- sys/dev/e1000/e1000_80003es2lan.h | 40 +-- sys/dev/e1000/e1000_82540.c | 40 +-- sys/dev/e1000/e1000_82541.c | 40 +-- sys/dev/e1000/e1000_82541.h | 40 +-- sys/dev/e1000/e1000_82542.c | 40 +-- sys/dev/e1000/e1000_82543.c | 40 +-- sys/dev/e1000/e1000_82543.h | 40 +-- sys/dev/e1000/e1000_82571.c | 40 +-- sys/dev/e1000/e1000_82571.h | 40 +-- sys/dev/e1000/e1000_82575.c | 40 +-- sys/dev/e1000/e1000_82575.h | 40 +-- sys/dev/e1000/e1000_api.c | 40 +-- sys/dev/e1000/e1000_api.h | 40 +-- sys/dev/e1000/e1000_defines.h | 40 +-- sys/dev/e1000/e1000_hw.h | 40 +-- sys/dev/e1000/e1000_i210.c | 40 +-- sys/dev/e1000/e1000_i210.h | 40 +-- sys/dev/e1000/e1000_ich8lan.c | 40 +-- sys/dev/e1000/e1000_ich8lan.h | 40 +-- sys/dev/e1000/e1000_mac.c | 40 +-- sys/dev/e1000/e1000_mac.h | 40 +-- sys/dev/e1000/e1000_manage.c | 40 +-- sys/dev/e1000/e1000_manage.h | 40 +-- sys/dev/e1000/e1000_mbx.c | 40 +-- sys/dev/e1000/e1000_mbx.h | 40 +-- sys/dev/e1000/e1000_nvm.c | 40 +-- sys/dev/e1000/e1000_nvm.h | 40 +-- sys/dev/e1000/e1000_osdep.c | 40 +-- sys/dev/e1000/e1000_osdep.h | 40 +-- sys/dev/e1000/e1000_phy.c | 40 +-- sys/dev/e1000/e1000_phy.h | 40 +-- sys/dev/e1000/e1000_regs.h | 40 +-- sys/dev/e1000/e1000_vf.c | 40 +-- sys/dev/e1000/e1000_vf.h | 40 +-- 37 files changed, 1007 insertions(+), 981 deletions(-) diff --git a/sys/dev/e1000/LICENSE b/sys/dev/e1000/LICENSE index f70a7cbd4a1d..51a32a819633 100644 --- a/sys/dev/e1000/LICENSE +++ b/sys/dev/e1000/LICENSE @@ -1,31 +1,30 @@ $FreeBSD$ - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/sys/dev/e1000/README b/sys/dev/e1000/README index c0abeacccf4a..d734be75e758 100644 --- a/sys/dev/e1000/README +++ b/sys/dev/e1000/README @@ -1,9 +1,8 @@ $FreeBSD$ -FreeBSD* Driver for Intel Network Connection -============================================= - -May 30, 2007 +FreeBSD* Driver for Intel(R) Ethernet +===================================== +August 7, 2019 Contents ======== @@ -11,396 +10,424 @@ Contents - Overview - Identifying Your Adapter - Building and Installation -- Speed and Duplex Configuration -- Additional Configurations -- Known Limitations +- Additional Features and Configurations +- Known Issues/Troubleshooting - Support - License Overview ======== - -This file describes the FreeBSD* driver for Intel Network Connection. -This driver has been developed for use with FreeBSD, Release 7.x. +This file describes the FreeBSD* driver for Intel(R) Ethernet. This driver has +been developed for use with all community-supported versions of FreeBSD. For questions related to hardware requirements, refer to the documentation -supplied with your Gigabit adapter. All hardware requirements listed +supplied with your Intel Ethernet Adapter. All hardware requirements listed apply to use with FreeBSD. Identifying Your Adapter ======================== +This release includes two gigabit FreeBSD base Drivers for Intel(R) Ethernet. +These drivers are em and igb. -For information on how to identify your adapter, go to the Adapter & -Driver ID Guide at: - -http://support.intel.com/support/network/sb/cs-012904.htm - - -For the latest Intel network drivers for FreeBSD, see: +- The igb driver supports all 82575 and 82576-based gigabit network connections. +- The em driver supports all other gigabit network connections. +- Gigabit devices base on the Intel(R) Ethernet Controller X722 are supported by + the ixl driver. -http://downloadfinder.intel.com/scripts-df-external/support_intel.aspx - - -NOTE: Mobile adapters are not fully supported. NOTE: The Intel(R) 82562v 10/100 Network Connection only provides 10/100 support. +For information on how to identify your adapter, and for the latest Intel +network drivers, refer to the Intel Support website: +http://www.intel.com/support + + Building and Installation ========================= +NOTE: This driver package is to be used only as a standalone archive and the +user should not attempt to incorporate it into the kernel source tree. -NOTE: The driver can be installed as a dynamic loadable kernel module or - compiled into the kernel. You must have kernel sources installed in - order to compile the driver module. - -In the instructions below, x.x.x is the driver version as indicated in the -name of the driver tar file. +In the instructions below, x.x.x is the driver version as indicated in the name +of the driver tar file. 1. Move the base driver tar file to the directory of your choice. For example, use /home/username/em or /usr/local/src/em. 2. Untar/unzip the archive: - tar xzvf em-x.x.x.tar.gz - - This will create an em-x.x.x directory. - -3. To create a loadable module, perform the following steps. - NOTE: To compile the driver into the kernel, go directly to step 4. - - a. To compile the module - - cd em-x.x.x - make - - b. To install the compiled module to the system directory: - - make install - - c. If you want the driver to load automatically when the system is booted: + # tar xzf em-x.x.x.tar.gz - 1. Edit /boot/loader.conf, and add the following line: +This will create the em-x.x.x directory. - if_em_load="YES" +3. To install man page: -4. To compile the driver into the kernel, enter: + # cd em-x.x.x + # gzip -c em.4 > /usr/share/man/man4/em.4.gz - cd em-x.x.x/src - cp *.[ch] /usr/src/sys/dev/em +4. To load the driver onto a running system: - Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in - /usr/src/sys/i386/conf, and ensure the following line is present: - - device em - - Compile and install the kernel. The system must be rebooted for the - kernel updates to take effect. For additional information on compiling - the kernel, consult the FreeBSD operating system documentation. + # cd em-x.x.x/src + # make + # kldload ./if_em.ko 5. To assign an IP address to the interface, enter the following: - ifconfig em + # ifconfig em 6. Verify that the interface works. Enter the following, where is the IP address for another machine on the same subnet as the interface that is being tested: - ping - -7. To configure the IP address to remain after reboot, edit /etc/rc.conf, - and create the appropriate ifconfig_ementry: - - ifconfig_em="" + # ping - Example usage: +7. If you want the driver to load automatically when the system is booted: - ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" + # cd em-x.x.x/src + # make + # make install - NOTE: For assistance, see the ifconfig man page. +Edit /boot/loader.conf, and add the following line: + if_em_load="YES" +Edit /etc/rc.conf, and create the appropriate ifconfig_em entry: -Speed and Duplex Configuration -============================== - -By default, the adapter auto-negotiates the speed and duplex of the -connection. If there is a specific need, the ifconfig utility can be used to -configure the speed and duplex settings on the adapter. Example usage: + ifconfig_em="" - ifconfig em media 100baseTX mediaopt - full-duplex +Example usage: + ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" - NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is - not specified and you are not running at gigabit speed, the driver - defaults to half-duplex. + NOTE: For assistance, see the ifconfig man page. -If the interface is currently forced to 100 full duplex, in order to change -to half duplex you must use this command: - ifconfig em media 100baseTX -mediaopt - full-duplex +Additional Features and Configurations +====================================== +Speed and Duplex Configuration +------------------------------ +In addressing speed and duplex configuration issues, you need to distinguish +between copper-based adapters and fiber-based adapters. -This driver supports the following media type options: +In the default mode, an Intel(R) Ethernet Network Adapter using copper +connections will attempt to auto-negotiate with its link partner to determine +the best setting. If the adapter cannot establish link with the link partner +using auto-negotiation, you may need to manually configure the adapter and link +partner to identical settings to establish link and pass packets. This should +only be needed when attempting to link with an older switch that does not +support auto-negotiation or one that has been forced to a specific speed or +duplex mode. Your link partner must match the setting you choose. 1 Gbps speeds +and higher cannot be forced. Use the autonegotiation advertising setting to +manually set devices for 1 Gbps and higher. - autoselect - Enables auto-negotiation for speed and duplex. +Caution: Only experienced network administrators should force speed and duplex +or change autonegotiation advertising manually. The settings at the switch must +always match the adapter settings. Adapter performance may suffer or your +adapter may not operate if you configure the adapter differently from your +switch. - 10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +An Intel(R) Ethernet Network Adapter using fiber-based connections, however, +will not attempt to auto-negotiate with its link partner since those adapters +operate only in full duplex and only at their native speed. - 100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt - option to select full-duplex mode. +By default, the adapter auto-negotiates the speed and duplex of the connection. +If there is a specific need, the ifconfig utility can be used to configure the +speed and duplex settings on the adapter. - 1000baseTX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +Example usage: - 1000baseSX - Sets speed to 1000 Mbps. In this case, the driver - supports only full-duplex mode. +# ifconfig emX media 100baseTX mediaopt full-duplex -For more information on the ifconfig utility, see the ifconfig man page. +NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is not +specified and you are not running at gigabit speed, the driver defaults to +half-duplex. +If the interface is currently forced to 100 full duplex, you must use this +command to change to half duplex: -Additional Configurations -========================= +# ifconfig emX media 100baseTX -mediaopt full-duplex -The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on -all but the 82542-based adapters. For specific adapters, refer to the -Identifying Your Adapter section. +This driver supports the following media type options: - Jumbo Frames - ------------ - To enable Jumbo Frames, use the ifconfig utility to set the Maximum - Transport Unit (MTU) frame size above its default of 1500 bytes. +Media Type Description +---------- ----------- +autoselect Enables auto-negotiation for speed and duplex. +10baseT/UTP Sets speed to 10 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +100baseTX Sets speed to 100 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. +1000baseTX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. +1000baseSX Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. - The Jumbo Frames MTU range for Intel Adapters is 1500 to 16110. To modify - the setting, enter the following: +For more information on the ifconfig utility, see the ifconfig man page. - ifconfig em mtu 9000 +Jumbo Frames +------------ +Jumbo Frames support is enabled by changing the Maximum Transmission Unit (MTU) +to a value larger than the default value of 1500. + +Use the ifconfig command to increase the MTU size. For example, enter the +following where X is the interface number: + +# ifconfig emX mtu 9000 + +To confirm an interface's MTU value, use the ifconfig command. + +To confirm the MTU used between two specific devices, use: + +# route get + +NOTE: The maximum MTU setting for Jumbo Frames is 16110. This value coincides +with the maximum Jumbo Frames size of 16132 bytes. + +NOTE: Using Jumbo frames at 10 or 100 Mbps is not supported and may result in +poor performance or loss of link. + +NOTE: Packet loss may have a greater impact on throughput when you use jumbo +frames. If you observe a drop in performance after enabling jumbo frames, +enabling flow control may mitigate the issue. + +NOTE: Some Intel gigabit adapters that support Jumbo Frames have a frame size +limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. The +adapters with this limitation are based on the Intel(R) 82571EB, 82572EI, +82573L, 82566, 82562, and 80003ES2LAN controller. These correspond to the +following product names: + Intel(R) PRO/1000 PT Server Adapter + Intel(R) PRO/1000 PT Desktop Adapter + Intel(R) PRO/1000 PT Network Connection + Intel(R) PRO/1000 PT Dual Port Server Adapter + Intel(R) PRO/1000 PT Dual Port Network Connection + Intel(R) PRO/1000 PT Quad Port Server Adapter + Intel(R) PRO/1000 PF Quad Port Server Adapter + Intel(R) PRO/1000 PF Server Adapter + Intel(R) PRO/1000 PF Network Connection + Intel(R) PRO/1000 PF Dual Port Server Adapter + Intel(R) PRO/1000 PB Server Connection + Intel(R) PRO/1000 PL Network Connection + Intel(R) PRO/1000 EB Network Connection with I/O Acceleration + Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration + Intel(R) 82566DM-2 Gigabit Network Connection + Intel(R) 82574L Gigabit Network Connection + Intel(R) Gigabit CT Desktop Adapter + Intel(R) 82567LM-4 Gigabit Network Connection + Intel(R) 82567LM-3 Gigabit Network Connection + Intel(R) 82567LF-3 Gigabit Network Connection - To confirm the MTU used between two specific devices, use: +NOTE: The following adapters limit Jumbo Frames sized packets to a maximum of +4088 bytes: + - Intel(R) 82578DM Gigabit Network Connection + - Intel(R) 82577LM Gigabit Network Connection +- The following adapters do not support Jumbo Frames: + - Intel(R) PRO/1000 Gigabit Server Adapter + - Intel(R) PRO/1000 PM Network Connection + - Intel(R) 82562G 10/100 Network Connection + - Intel(R) 82562G-2 10/100 Network Connection + - Intel(R) 82562GT 10/100 Network Connection + - Intel(R) 82562GT-2 10/100 Network Connection + - Intel(R) 82562V 10/100 Network Connection + - Intel(R) 82562V-2 10/100 Network Connection + - Intel(R) 82566DC Gigabit Network Connection + - Intel(R) 82566DC-2 Gigabit Network Connection + - Intel(R) 82566DM Gigabit Network Connection + - Intel(R) 82566MC Gigabit Network Connection + - Intel(R) 82566MM Gigabit Network Connection + - Intel(R) 82567V-3 Gigabit Network Connection + - Intel(R) 82577LC Gigabit Network Connection + - Intel(R) 82578DC Gigabit Network Connection +- Jumbo Frames cannot be configured on an 82579-based Network device if + MACSec is enabled on the system. - route get - Notes: +VLANS +----- +To create a new VLAN interface: - - Only enable Jumbo Frames if your network infrastructure supports them. +# ifconfig create - - To enable Jumbo Frames, increase the MTU size on the interface beyond - 1500. +To associate the VLAN interface with a physical interface and assign a VLAN ID, +IP address, and netmask: - - The Jumbo Frames setting on the switch must be set to at least 22 bytes - larger than that of the MTU. +# ifconfig netmask vlan +vlandev - - The maximum MTU setting for Jumbo Frames is 16110. This value coincides - with the maximum Jumbo Frames size of 16128. +Example: - - Some Intel gigabit adapters that support Jumbo Frames have a frame size - limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. - The adapters with this limitation are based on the Intel(R) 82571EB, - 82572EI, 82573L, 82566, 82562, and 80003ES2LAN controller. These - correspond to the following product names: - Intel(R) PRO/1000 PT Server Adapter - Intel(R) PRO/1000 PT Desktop Adapter - Intel(R) PRO/1000 PT Network Connection - Intel(R) PRO/1000 PT Dual Port Server Adapter - Intel(R) PRO/1000 PT Dual Port Network Connection - Intel(R) PRO/1000 PT Quad Port Server Adapter - Intel(R) PRO/1000 PF Quad Port Server Adapter - Intel(R) PRO/1000 PF Server Adapter - Intel(R) PRO/1000 PF Network Connection - Intel(R) PRO/1000 PF Dual Port Server Adapter - Intel(R) PRO/1000 PB Server Connection - Intel(R) PRO/1000 PL Network Connection - Intel(R) PRO/1000 EB Network Connection with I/O Acceleration - Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration - Intel(R) 82566DM-2 Gigabit Network Connection +# ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - - Adapters based on the Intel(R) 82542 and 82573V/E controller do not - support Jumbo Frames. These correspond to the following product names: - Intel(R) PRO/1000 Gigabit Server Adapter - Intel(R) PRO/1000 PM Network Connection +In this example, all packets will be marked on egress with 802.1Q VLAN tags, +specifying a VLAN ID of 10. - - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or - loss of link. +To remove a VLAN interface: - - The following adapters do not support Jumbo Frames: - Intel(R) 82562V 10/100 Network Connection - Intel(R) 82566DM Gigabit Network Connection - Intel(R) 82566DC Gigabit Network Connection - Intel(R) 82566MM Gigabit Network Connection - Intel(R) 82566MC Gigabit Network Connection - Intel(R) 82562GT 10/100 Network Connection - Intel(R) 82562G 10/100 Network Connection - Intel(R) 82566DC-2 Gigabit Network Connection - Intel(R) 82562V-2 10/100 Network Connection - Intel(R) 82562G-2 10/100 Network Connection - Intel(R) 82562GT-2 10/100 Network Connection +# ifconfig destroy - VLANs - ----- - To create a new VLAN interface: - ifconfig create +Polling +------- +NOTES: +- Device Polling is only valid for non-SMP kernels. +- The driver has to be built into the kernel for Device Polling to be + enabled in the driver. - To associate the VLAN interface with a physical interface and - assign a VLAN ID, IP address, and netmask: +To enable polling in the driver, add the following options to the kernel +configuration, and then recompile the kernel: - ifconfig netmask vlan - vlandev + options DEVICE_POLLING + options HZ=1000 - Example: +At runtime use: + ifconfig emX polling (to turn polling on) +and: + ifconfig emX -polling (to turn it off) - ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 - In this example, all packets will be marked on egress with 802.1Q VLAN - tags, specifying a VLAN ID of 10. +Checksum Offload +---------------- +Checksum offloading is not supported on 82542 Gigabit adapters. - To remove a VLAN interface: +Checksum offloading supports both TCP and UDP packets and is supported for both +transmit and receive. - Intel Network Connection ifconfig destroy +Checksum offloading can be enabled or disabled using ifconfig. Both transmit +and receive offloading will be either enabled or disabled together. You cannot +enable/disable one without the other. +To enable checksum offloading: - Polling - ------- +# ifconfig emX rxcsum - To enable polling in the driver, add the following options to the kernel - configuration, and then recompile the kernel: +To disable checksum offloading: - options DEVICE_POLLING - options HZ=1000 +# ifconfig emX -rxcsum - At runtime use: - ifconfig emX polling (to turn polling on) - and: - ifconfig emX -polling (to turn it off) +To confirm the current setting: +# ifconfig emX - Checksum Offload - ---------------- - Checksum offloading is not supported on 82542 Gigabit adapters. +Look for the presence or absence of the following line: + options=3 - Checksum offloading supports both TCP and UDP packets and is - supported for both transmit and receive. +See the ifconfig man page for further information. - Checksum offloading can be enabled or disabled using ifconfig. - Both transmit and receive offloading will be either enabled or - disabled together. You cannot enable/disable one without the other. - To enable checksum offloading: +TSO +--- +TSO (TCP Segmentation Offload) supports both IPv4 and IPv6. TSO can be disabled +and enabled using the ifconfig utility or sysctl. - ifconfig rxcsum +NOTE: TSO requires Tx checksum, if Tx checksum is disabled, TSO will also be +disabled. - To disable checksum offloading: +NOTE: By default only PCI-Express adapters are ENABLED to do TSO. Others can be +enabled by the user at their own risk. TSO is not supported on 82547 or +82544-based adapters, as well as older adapters. - ifconfig -rxcsum +To enable/disable TSO in the stack: - To confirm the current setting: +# sysctl net.inet.tcp.tso=0 (or 1 to enable it) - ifconfig +Doing this disables/enables TSO in the stack and affects all installed adapters. - Look for the presence or absence of the following line: +To disable BOTH TSO IPv4 and IPv6: - options=3 +# ifconfig em -tso - See the ifconfig man page for further information. +To enable BOTH TSO IPv4 and IPv6: +# ifconfig em tso - TSO - --- - The FreeBSD driver offers support for TSO (TCP Segmentation Offload). +You can also enable/disable IPv4 TSO or IPv6 TSO individually. Simply replace +tso|-tso in the above command with tso4 or tso6. For example, to disable +TSO IPv4: - You can enable/disable it in two ways/places: +# ifconfig em -tso4 - - sysctl net.inet.tcp.tso=0 (or 1 to enable it) +To disable TSO IPv6: - Doing this disables TSO in the stack and will affect all adapters. +# ifconfig em -tso6 - - ifconfig emX -tso - Doing this will disable TSO only for this adapter. +MSI-X +----- +MSI or MSI-X can be turned off by an entry in /etc/sysctl.conf - To enable: + hw.em.enable_msi=0 - - ifconfig emX tso +Unload and reload the driver. - NOTES: By default only PCI-Express adapters are ENABLED to do TSO. Others - can be enabled by the user at their own risk - TSO is not supported on 82547 and 82544-based adapters, as well as older adapters. +Known Issues/Troubleshooting +============================ -Known Limitations -================= +Detected Tx Unit Hang in Quad Port Adapters +------------------------------------------- +In some cases ports 3 and 4 don't pass traffic and report 'Detected Tx Unit +Hang' followed by 'NETDEV WATCHDOG: emX: transmit timed out' errors. Ports 1 +and 2 do not show any errors and will pass traffic. - Detected Tx Unit Hang in Quad Port Adapters - ------------------------------------------- +This issue may be resolved by updating to the latest kernel and BIOS. You +should use an OS that fully supports Message Signaled Interrupts (MSI) and make +sure that MSI is enabled in your system's BIOS. - In some cases ports 3 and 4 wont pass traffic. Ports 1 and 2 don't show - any errors and will pass traffic. - This issue MAY be resolved by updating to the latest BIOS. You can - check your system's BIOS by downloading the Linux Firmware Developer Kit - that can be obtained at http://www.linuxfirmwarekit.org/ +There are known performance issues with this driver when running UDP traffic +with Jumbo Frames. +---------------------------------------------------------------------------- - There are known performance issues with this driver when running UDP traffic - with Jumbo Frames. - ---------------------------------------------------------------------------- +82541/82547 can't link or is slow to link with some link partners +----------------------------------------------------------------- +There is a known compatibility issue where time to link is slow or link is not +established between 82541/82547 controllers and some switches. Known switches +include: + Planex FXG-08TE + I-O Data ETG-SH8 - 82541/82547 can't link or is slow to link with some link partners - ----------------------------------------------------------------- +The driver can be compiled with the following changes: - There is a known compatibility issue where time to link is slow or link is not - established between 82541/82547 controllers and some switches. Known switches - include: - Planex FXG-08TE - I-O Data ETG-SH8 - Netgear GS105v3 + Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - The driver can be compiled with the following changes: +For example, change from: - Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE - For example, change from: + #define EM_MASTER_SLAVE e1000_ms_hw_default - #define EM_MASTER_SLAVE e1000_ms_hw_default - to: - #define EM_MASTER_SLAVE 2 +to: - Use one of the following options: - 1 = Master mode - 2 = Slave mode - 3 = Auto master/slave - Setting 2 is recommended. + #define EM_MASTER_SLAVE 2 - Recompile the module: - a. To compile the module - cd em-x.x.x - make clean - make +Use one of the following options: + 1 = Master mode + 2 = Slave mode + 3 = Auto master/slave +Setting 2 is recommended. - b. To install the compiled module in system directory: - make install +Recompile the module: + a. To compile the module + cd em-x.x.x + make clean + make + b. To install the compiled module in system directory: + make install Support ======= +For general information, go to the Intel support website at: +http://www.intel.com/support/ -For general information and support, go to the Intel support website at: +If an issue is identified with the released source code on a supported kernel +with a supported adapter, email the specific information related to the issue +to freebsd@intel.com - http://support.intel.com -If an issue is identified, support is through email only at: -freebsd@intel.com +Copyright(c) 1999-2019 Intel Corporation. -License -======= - -This software program is released under the terms of a license agreement -between you ('Licensee') and Intel. Do not use or load this software or any -associated materials (collectively, the 'Software') until you have carefully -read the full terms and conditions of the LICENSE located in this software -package. By loading or using the Software, you agree to the terms of this -Agreement. If you do not agree with the terms of this Agreement, do not -install or use the Software. +Trademarks +========== +Intel is a trademark or registered trademark of Intel Corporation or its +subsidiaries in the United States and/or other countries. * Other names and brands may be claimed as the property of others. diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 5c0220adfc6f..50fdfab54685 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_80003es2lan.h b/sys/dev/e1000/e1000_80003es2lan.h index cbf0eafa9407..9e6de14757d7 100644 --- a/sys/dev/e1000/e1000_80003es2lan.h +++ b/sys/dev/e1000/e1000_80003es2lan.h @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index adc944a8ebb4..720798260f8a 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -1,32 +1,32 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2015, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index ead974cb1358..aaa3de7f02ce 100644 --- a/sys/dev/e1000/e1000_82541.c *** 1821 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:09:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28C6066A034; Fri, 17 Sep 2021 21:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB65K0gp9z4gJS; Fri, 17 Sep 2021 21:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAD5C1CB6B; Fri, 17 Sep 2021 21:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HL98Rr015508; Fri, 17 Sep 2021 21:09:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HL98wf015507; Fri, 17 Sep 2021 21:09:08 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:09:08 GMT Message-Id: <202109172109.18HL98wf015507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: de0ae5d1cb89 - main - e1000: support flashless i211 PBA MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:09:09 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce commit de0ae5d1cb896dbc04c5334ef0b864b3c841c3ce Author: Guinan Sun AuthorDate: 2020-07-06 08:11:59 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:07:27 +0000 e1000: support flashless i211 PBA Add support to print PBA when using flashless. Signed-off-by: Todd Fujinaka Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d3c41d90dfd5b39dec14c74cf53086f4e6634aed) MFC after: 1 week --- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_nvm.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index d588539ca8e8..27e564d7841b 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -461,7 +461,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else - mac->ops.init_hw = e1000_init_hw_82575; + mac->ops.init_hw = e1000_init_hw_82575; /* link setup */ mac->ops.setup_link = e1000_setup_link_generic; /* physical interface link setup */ diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index ecc7b013febb..f46444cf38b9 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -776,8 +776,9 @@ s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, DEBUGFUNC("e1000_read_pba_string_generic"); - if ((hw->mac.type >= e1000_i210) && - !e1000_get_flash_presence_i210(hw)) { + if ((hw->mac.type == e1000_i210 || + hw->mac.type == e1000_i211) && + !e1000_get_flash_presence_i210(hw)) { DEBUGOUT("Flashless no PBA string\n"); return -E1000_ERR_NVM_PBA_SECTION; } From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:09:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0696F66A0E3; Fri, 17 Sep 2021 21:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6646qbnz4gSr; Fri, 17 Sep 2021 21:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0E271CEDA; Fri, 17 Sep 2021 21:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HL9mWB015664; Fri, 17 Sep 2021 21:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HL9mFG015663; Fri, 17 Sep 2021 21:09:48 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:09:48 GMT Message-Id: <202109172109.18HL9mFG015663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 82a9d0c2c1ef - main - e1000: add missing device ID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:09:49 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=82a9d0c2c1ef75703d16e49e96d1e7b0bf046882 commit 82a9d0c2c1ef75703d16e49e96d1e7b0bf046882 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:10 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:09:32 +0000 e1000: add missing device ID Adding Intel(R) I210 Gigabit Network Connection 15F6 device ID for SGMII flashless automotive device. Signed-off-by: Kamil Bednarczyk Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (586d770bfefc01d4af97c0ddf17c960c3e49ec22) MFC after: 1 week --- sys/dev/e1000/e1000_api.c | 1 + sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/if_em.c | 1 + 3 files changed, 3 insertions(+) diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index a36b228e075f..6e0f51ab7ffa 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -383,6 +383,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) break; case E1000_DEV_ID_I210_COPPER_FLASHLESS: case E1000_DEV_ID_I210_SERDES_FLASHLESS: + case E1000_DEV_ID_I210_SGMII_FLASHLESS: case E1000_DEV_ID_I210_COPPER: case E1000_DEV_ID_I210_COPPER_OEM1: case E1000_DEV_ID_I210_COPPER_IT: diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index a08630618662..95973e29dbf0 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -209,6 +209,7 @@ struct e1000_hw; #define E1000_DEV_ID_I210_SGMII 0x1538 #define E1000_DEV_ID_I210_COPPER_FLASHLESS 0x157B #define E1000_DEV_ID_I210_SERDES_FLASHLESS 0x157C +#define E1000_DEV_ID_I210_SGMII_FLASHLESS 0x15F6 #define E1000_DEV_ID_I211_COPPER 0x1539 #define E1000_DEV_ID_I354_BACKPLANE_1GBPS 0x1F40 #define E1000_DEV_ID_I354_SGMII 0x1F41 diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index fadbcc2473e8..0ef542dd4c78 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -233,6 +233,7 @@ static pci_vendor_info_t igb_vendor_info_array[] = PVID(0x8086, E1000_DEV_ID_I210_COPPER_OEM1, "Intel(R) I210 (OEM)"), PVID(0x8086, E1000_DEV_ID_I210_COPPER_FLASHLESS, "Intel(R) I210 Flashless (Copper)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES_FLASHLESS, "Intel(R) I210 Flashless (SERDES)"), + PVID(0x8086, E1000_DEV_ID_I210_SGMII_FLASHLESS, "Intel(R) I210 Flashless (SGMII)"), PVID(0x8086, E1000_DEV_ID_I210_FIBER, "Intel(R) I210 (Fiber)"), PVID(0x8086, E1000_DEV_ID_I210_SERDES, "Intel(R) I210 (SERDES)"), PVID(0x8086, E1000_DEV_ID_I210_SGMII, "Intel(R) I210 (SGMII)"), From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:12:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E899166A3C9; Fri, 17 Sep 2021 21:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB68x6Jybz4gp4; Fri, 17 Sep 2021 21:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B89BE1D05F; Fri, 17 Sep 2021 21:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLCHSX027383; Fri, 17 Sep 2021 21:12:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLCHpS027382; Fri, 17 Sep 2021 21:12:17 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:12:17 GMT Message-Id: <202109172112.18HLCHpS027382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: da24467c7a16 - main - e1000: expose xMDIO methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da24467c7a162691a14f2f74d90ff8dedb816cfc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:12:18 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=da24467c7a162691a14f2f74d90ff8dedb816cfc commit da24467c7a162691a14f2f74d90ff8dedb816cfc Author: Guinan Sun AuthorDate: 2020-07-06 08:12:00 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:10:02 +0000 e1000: expose xMDIO methods Move read and write xmdio methods to e1000_phy. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b14d20f1b2bb0e6d95f19963c5d7f55374e0ead9) MFC after: 1 week --- sys/dev/e1000/e1000_i210.c | 71 --------------------------------------------- sys/dev/e1000/e1000_i210.h | 4 --- sys/dev/e1000/e1000_phy.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_phy.h | 5 ++++ 4 files changed, 77 insertions(+), 75 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 88806891566f..c0055aa0df71 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -600,77 +600,6 @@ out: return ret_val; } -/** - * __e1000_access_xmdio_reg - Read/write XMDIO register - * @hw: pointer to the HW structure - * @address: XMDIO address to program - * @dev_addr: device address to program - * @data: pointer to value to read/write from/to the XMDIO address - * @read: boolean flag to indicate read or write - **/ -static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, - u8 dev_addr, u16 *data, bool read) -{ - s32 ret_val; - - DEBUGFUNC("__e1000_access_xmdio_reg"); - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); - if (ret_val) - return ret_val; - - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | - dev_addr); - if (ret_val) - return ret_val; - - if (read) - ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); - else - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); - if (ret_val) - return ret_val; - - /* Recalibrate the device back to 0 */ - ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); - if (ret_val) - return ret_val; - - return ret_val; -} - -/** - * e1000_read_xmdio_reg - Read XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be read from the EMI address - **/ -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, TRUE); -} - -/** - * e1000_write_xmdio_reg - Write XMDIO register - * @hw: pointer to the HW structure - * @addr: XMDIO address to program - * @dev_addr: device address to program - * @data: value to be written to the XMDIO address - **/ -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) -{ - DEBUGFUNC("e1000_read_xmdio_reg"); - - return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, FALSE); -} - /** * e1000_pll_workaround_i210 * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index d1ef4edf6261..9ad9e28c363b 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,10 +44,6 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); -s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 *data); -s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, - u16 data); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index 3215ed33d115..d22bcb7149c1 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -4251,3 +4251,75 @@ bool e1000_is_mphy_ready(struct e1000_hw *hw) return ready; } + +/** + * __e1000_access_xmdio_reg - Read/write XMDIO register + * @hw: pointer to the HW structure + * @address: XMDIO address to program + * @dev_addr: device address to program + * @data: pointer to value to read/write from/to the XMDIO address + * @read: boolean flag to indicate read or write + **/ +static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, + u8 dev_addr, u16 *data, bool read) +{ + s32 ret_val; + + DEBUGFUNC("__e1000_access_xmdio_reg"); + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address); + if (ret_val) + return ret_val; + + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA | + dev_addr); + if (ret_val) + return ret_val; + + if (read) + ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data); + else + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data); + if (ret_val) + return ret_val; + + /* Recalibrate the device back to 0 */ + ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0); + if (ret_val) + return ret_val; + + return ret_val; +} + +/** + * e1000_read_xmdio_reg - Read XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be read from the EMI address + **/ +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data) +{ + DEBUGFUNC("e1000_read_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, true); +} + +/** + * e1000_write_xmdio_reg - Write XMDIO register + * @hw: pointer to the HW structure + * @addr: XMDIO address to program + * @dev_addr: device address to program + * @data: value to be written to the XMDIO address + **/ +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data) +{ + DEBUGFUNC("e1000_write_xmdio_reg"); + + return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, + false); +} diff --git a/sys/dev/e1000/e1000_phy.h b/sys/dev/e1000/e1000_phy.h index a13413e98638..38c8f9b466ce 100644 --- a/sys/dev/e1000/e1000_phy.h +++ b/sys/dev/e1000/e1000_phy.h @@ -122,6 +122,11 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data, bool line_override); bool e1000_is_mphy_ready(struct e1000_hw *hw); +s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 *data); +s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, + u16 data); + #define E1000_MAX_PHY_ADDR 8 /* IGP01E1000 Specific Registers */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:14:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBC6A66A07F; Fri, 17 Sep 2021 21:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6CD6KJ5z4h5t; Fri, 17 Sep 2021 21:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8E611D385; Fri, 17 Sep 2021 21:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLEGaa028347; Fri, 17 Sep 2021 21:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLEGFs028346; Fri, 17 Sep 2021 21:14:16 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:14:16 GMT Message-Id: <202109172114.18HLEGFs028346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 5b426b3e8cbd - main - e1000: add function parameter descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:14:17 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5b426b3e8cbd5abdb3a57ff49cd27c36cac03427 commit 5b426b3e8cbd5abdb3a57ff49cd27c36cac03427 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:02 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:13:37 +0000 e1000: add function parameter descriptions Add function parameter descriptions to address gcc 7 warnings. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1bf35d435c9764e83be76042fa6489dd127b6c40) MFC after: 1 week --- sys/dev/e1000/e1000_82575.c | 11 +++++------ sys/dev/e1000/e1000_mac.c | 8 ++++++++ sys/dev/e1000/e1000_mbx.c | 4 ++++ sys/dev/e1000/e1000_nvm.c | 7 +++++++ sys/dev/e1000/e1000_phy.c | 6 ++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 27e564d7841b..296a72542914 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -2702,7 +2702,7 @@ out: /** * __e1000_access_emi_reg - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write **/ @@ -2929,8 +2929,8 @@ out: /** * e1000_set_eee_i350 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE based on setting in dev_spec structure. * @@ -2984,8 +2984,8 @@ out: /** * e1000_set_eee_i354 - Enable/disable EEE support * @hw: pointer to the HW structure - * @adv1g: boolean flag enabling 1G EEE advertisement - * @adv100m: boolean flag enabling 100M EEE advertisement + * @adv1G: boolean flag enabling 1G EEE advertisement + * @adv100M: boolean flag enabling 100M EEE advertisement * * Enable/disable EEE legacy mode based on setting in dev_spec structure. * @@ -3641,7 +3641,6 @@ static s32 e1000_set_i2c_data(struct e1000_hw *hw, u32 *i2cctl, bool data) /** * e1000_get_i2c_data - Reads the I2C SDA data bit - * @hw: pointer to hardware structure * @i2cctl: Current value of I2CCTL register * * Returns the I2C data bit value diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index 11fbcb62142f..bda2ad65e3dc 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -105,6 +105,8 @@ void e1000_null_mac_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_link_info - No-op function, return 0 * @hw: pointer to the HW structure + * @s: dummy variable + * @d: dummy variable **/ s32 e1000_null_link_info(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *s, u16 E1000_UNUSEDARG *d) @@ -126,6 +128,8 @@ bool e1000_null_mng_mode(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_update_mc - No-op function, return void * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) @@ -137,6 +141,8 @@ void e1000_null_update_mc(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_vfta - No-op function, return void * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable **/ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG a, u32 E1000_UNUSEDARG b) @@ -148,6 +154,8 @@ void e1000_null_write_vfta(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_rar_set - No-op function, return 0 * @hw: pointer to the HW structure + * @h: dummy variable + * @a: dummy variable **/ int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw, u8 E1000_UNUSEDARG *h, u32 E1000_UNUSEDARG a) diff --git a/sys/dev/e1000/e1000_mbx.c b/sys/dev/e1000/e1000_mbx.c index da31185c3476..3fc3811757f7 100644 --- a/sys/dev/e1000/e1000_mbx.c +++ b/sys/dev/e1000/e1000_mbx.c @@ -38,6 +38,7 @@ /** * e1000_null_mbx_check_for_flag - No-op function, return 0 * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG mbx_id) @@ -50,6 +51,9 @@ static s32 e1000_null_mbx_check_for_flag(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_mbx_transact - No-op function, return 0 * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read **/ static s32 e1000_null_mbx_transact(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG *msg, diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index f46444cf38b9..46c00e1d64b3 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -63,6 +63,9 @@ void e1000_init_nvm_ops_generic(struct e1000_hw *hw) /** * e1000_null_nvm_read - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_read_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, @@ -85,6 +88,7 @@ void e1000_null_nvm_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_led_default - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG *data) @@ -96,6 +100,9 @@ s32 e1000_null_led_default(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_nvm - No-op function, return 0 * @hw: pointer to the HW structure + * @a: dummy variable + * @b: dummy variable + * @c: dummy variable **/ s32 e1000_null_write_nvm(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG a, u16 E1000_UNUSEDARG b, diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d22bcb7149c1..d73e3a10ae13 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -104,6 +104,7 @@ void e1000_init_phy_ops_generic(struct e1000_hw *hw) /** * e1000_null_set_page - No-op function, return 0 * @hw: pointer to the HW structure + * @data: dummy variable **/ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, u16 E1000_UNUSEDARG data) @@ -115,6 +116,8 @@ s32 e1000_null_set_page(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_read_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_read_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG *data) @@ -136,6 +139,7 @@ void e1000_null_phy_generic(struct e1000_hw E1000_UNUSEDARG *hw) /** * e1000_null_lplu_state - No-op function, return 0 * @hw: pointer to the HW structure + * @active: dummy variable **/ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, bool E1000_UNUSEDARG active) @@ -147,6 +151,8 @@ s32 e1000_null_lplu_state(struct e1000_hw E1000_UNUSEDARG *hw, /** * e1000_null_write_reg - No-op function, return 0 * @hw: pointer to the HW structure + * @offset: dummy variable + * @data: dummy variable **/ s32 e1000_null_write_reg(struct e1000_hw E1000_UNUSEDARG *hw, u32 E1000_UNUSEDARG offset, u16 E1000_UNUSEDARG data) From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:15:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A742B66A536; Fri, 17 Sep 2021 21:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6DL4LSdz4hRS; Fri, 17 Sep 2021 21:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74D831CD6D; Fri, 17 Sep 2021 21:15:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLFELx028542; Fri, 17 Sep 2021 21:15:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLFEQU028541; Fri, 17 Sep 2021 21:15:14 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:15:14 GMT Message-Id: <202109172115.18HLFEQU028541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 6c59e1866ca7 - main - e1000: fix minor issues and improve code style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:15:14 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756 commit 6c59e1866ca7a48d84f1d298bb3e6a07d2e6f756 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:14:34 +0000 e1000: fix minor issues and improve code style Fix typo in piece of code of NVM access for SPT. And cleans up the remaining instances in the shared code where it was not adhering to the Linux code standard. Wrong description was found in the mentioned file, so fix them. Remove shadowing variable declarations. Relating to operands in bitwise operations having different sizes. Unreachable code since *clock_in_i2c_* always return success. Don't return unused s32 and don't check for constants. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Vitaly Lifshits Signed-off-by: Robert Konklewski Signed-off-by: Doug Dziggel Signed-off-by: Todd Fujinaka Signed-off-by: Jacob Keller Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (b8592c89c8fbc871d22313dcac0b86c89a7d5a62) MFC after: 1 week --- sys/dev/e1000/e1000_80003es2lan.c | 1 - sys/dev/e1000/e1000_82575.c | 16 +++++----------- sys/dev/e1000/e1000_i210.c | 8 +++----- sys/dev/e1000/e1000_ich8lan.c | 40 ++++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 2 +- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 5 ++++- 7 files changed, 35 insertions(+), 39 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index 50fdfab54685..db6f1aeb65fb 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -1168,7 +1168,6 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw) /** * e1000_cfg_on_link_up_80003es2lan - es2 link configuration after link-up * @hw: pointer to the HW structure - * @duplex: current duplex setting * * Configure the KMRN interface by applying last minute quirks for * 10/100 operation. diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 296a72542914..b252a4c7ff1d 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -104,10 +104,10 @@ static void e1000_clear_vfta_i350(struct e1000_hw *hw); static void e1000_i2c_start(struct e1000_hw *hw); static void e1000_i2c_stop(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data); static s32 e1000_clock_out_i2c_byte(struct e1000_hw *hw, u8 data); static s32 e1000_get_i2c_ack(struct e1000_hw *hw); -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data); static s32 e1000_clock_out_i2c_bit(struct e1000_hw *hw, bool data); static void e1000_raise_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); static void e1000_lower_i2c_clk(struct e1000_hw *hw, u32 *i2cctl); @@ -3238,9 +3238,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, if (status != E1000_SUCCESS) goto fail; - status = e1000_clock_in_i2c_byte(hw, data); - if (status != E1000_SUCCESS) - goto fail; + e1000_clock_in_i2c_byte(hw, data); status = e1000_clock_out_i2c_bit(hw, nack); if (status != E1000_SUCCESS) @@ -3404,7 +3402,7 @@ static void e1000_i2c_stop(struct e1000_hw *hw) * * Clocks in one byte data via I2C data/clock **/ -static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) +static void e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) { s32 i; bool bit = 0; @@ -3416,8 +3414,6 @@ static s32 e1000_clock_in_i2c_byte(struct e1000_hw *hw, u8 *data) e1000_clock_in_i2c_bit(hw, &bit); *data |= bit << i; } - - return E1000_SUCCESS; } /** @@ -3506,7 +3502,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) * * Clocks in one bit via I2C data/clock **/ -static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) +static void e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) { u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); @@ -3524,8 +3520,6 @@ static s32 e1000_clock_in_i2c_bit(struct e1000_hw *hw, bool *data) /* Minimum low period of clock is 4.7 us */ usec_delay(E1000_I2C_T_LOW); - - return E1000_SUCCESS; } /** diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index c0055aa0df71..c6ca38f0f917 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,7 +195,7 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { - eewr = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) | + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; @@ -281,9 +281,9 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, switch (offset) { case NVM_MAC_ADDR: ret_val = e1000_read_invm_word_i210(hw, (u8)offset, &data[0]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+1, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 1, &data[1]); - ret_val |= e1000_read_invm_word_i210(hw, (u8)offset+2, + ret_val |= e1000_read_invm_word_i210(hw, (u8)offset + 2, &data[2]); if (ret_val != E1000_SUCCESS) DEBUGOUT("MAC Addr not found in iNVM\n"); @@ -561,8 +561,6 @@ void e1000_init_function_pointers_i210(struct e1000_hw *hw) { e1000_init_function_pointers_82575(hw); hw->nvm.ops.init_params = e1000_init_nvm_params_i210; - - return; } /** diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 39e5ad518617..3a912dc3870e 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -841,7 +841,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /** * __e1000_access_emi_reg_locked - Read/write EMI register * @hw: pointer to the HW structure - * @addr: EMI address to program + * @address: EMI address to program * @data: pointer to value to read/write from/to the EMI address * @read: boolean flag to indicate read or write * @@ -1619,8 +1619,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (hw->mac.type >= e1000_pch_lpt) { - u16 phy_reg; - hw->phy.ops.read_reg_locked(hw, I217_PLL_CLOCK_GATE_REG, &phy_reg); phy_reg &= ~I217_PLL_CLOCK_GATE_MASK; @@ -2474,7 +2472,7 @@ release: /** * e1000_configure_k1_ich8lan - Configure K1 power state * @hw: pointer to the HW structure - * @enable: K1 state to configure + * @k1_enable: K1 state to configure * * Configure the K1 power state based on the provided parameter. * Assumes semaphore already acquired. @@ -2622,6 +2620,7 @@ static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) /** * e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -2943,6 +2942,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) /** * e1000_lv_phy_workarounds_ich8lan - A series of Phy workarounds to be * done after every PHY reset. + * @hw: pointer to the HW structure **/ static s32 e1000_lv_phy_workarounds_ich8lan(struct e1000_hw *hw) { @@ -3550,8 +3550,9 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, for (i = 0; i < words; i += 2) { if (words - i == 1) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = + dev_spec->shadow_ram[offset + i].value; } else { offset_to_read = act_offset + i - ((act_offset + i) % 2); @@ -3568,8 +3569,8 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, } } else { offset_to_read = act_offset + i; - if (!(dev_spec->shadow_ram[offset+i].modified) || - !(dev_spec->shadow_ram[offset+i+1].modified)) { + if (!(dev_spec->shadow_ram[offset + i].modified) || + !(dev_spec->shadow_ram[offset + i + 1].modified)) { ret_val = e1000_read_flash_dword_ich8lan(hw, offset_to_read, @@ -3577,15 +3578,16 @@ static s32 e1000_read_nvm_spt(struct e1000_hw *hw, u16 offset, u16 words, if (ret_val) break; } - if (dev_spec->shadow_ram[offset+i].modified) - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) + data[i] = + dev_spec->shadow_ram[offset + i].value; else - data[i] = (u16) (dword & 0xFFFF); - if (dev_spec->shadow_ram[offset+i].modified) - data[i+1] = - dev_spec->shadow_ram[offset+i+1].value; + data[i] = (u16)(dword & 0xFFFF); + if (dev_spec->shadow_ram[offset + i + 1].modified) + data[i + 1] = + dev_spec->shadow_ram[offset + i + 1].value; else - data[i+1] = (u16) (dword >> 16 & 0xFFFF); + data[i + 1] = (u16)(dword >> 16 & 0xFFFF); } } @@ -3639,8 +3641,8 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, ret_val = E1000_SUCCESS; for (i = 0; i < words; i++) { - if (dev_spec->shadow_ram[offset+i].modified) { - data[i] = dev_spec->shadow_ram[offset+i].value; + if (dev_spec->shadow_ram[offset + i].modified) { + data[i] = dev_spec->shadow_ram[offset + i].value; } else { ret_val = e1000_read_flash_word_ich8lan(hw, act_offset + i, @@ -4045,8 +4047,8 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, nvm->ops.acquire(hw); for (i = 0; i < words; i++) { - dev_spec->shadow_ram[offset+i].modified = TRUE; - dev_spec->shadow_ram[offset+i].value = data[i]; + dev_spec->shadow_ram[offset + i].modified = TRUE; + dev_spec->shadow_ram[offset + i].value = data[i]; } nvm->ops.release(hw); diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index bda2ad65e3dc..e0d078d924f9 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -2362,7 +2362,7 @@ e1000_release_swfw_sync(struct e1000_hw *hw, u16 mask) ; /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); - swfw_sync &= ~mask; + swfw_sync &= (u32)~mask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); e1000_put_hw_semaphore(hw); diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 46c00e1d64b3..86a1e772fb13 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -578,7 +578,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) } for (i = 0; i < words; i++) { - eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) + + eerd = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) + E1000_NVM_RW_REG_START; E1000_WRITE_REG(hw, E1000_EERD, eerd); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d73e3a10ae13..d84b6120dd31 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -621,7 +621,7 @@ s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data) * lane and update whole word */ data_local = i2ccmd & 0xFF00; - data_local |= data; + data_local |= (u32)data; i2ccmd = ((offset << E1000_I2CCMD_REG_ADDR_SHIFT) | E1000_I2CCMD_OPCODE_WRITE | data_local); @@ -3094,6 +3094,7 @@ s32 e1000_determine_phy_address(struct e1000_hw *hw) /** * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address * @page: page to access + * @reg: register to access * * Returns the phy address for the page requested. **/ @@ -3531,6 +3532,7 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw) * @offset: register offset to be read * @data: pointer to the read data * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then reads the PHY register at offset * and stores the retrieved information in data. Release any acquired @@ -3641,6 +3643,7 @@ s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data) * @offset: register offset to write to * @data: data to write at register offset * @locked: semaphore has already been acquired or not + * @page_set: BM_WUC_PAGE already set and access enabled * * Acquires semaphore, if necessary, then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:16:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D35166A61B; Fri, 17 Sep 2021 21:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6GJ0Kc7z4jF8; Fri, 17 Sep 2021 21:16:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9A701CEFE; Fri, 17 Sep 2021 21:16:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLGtNU028825; Fri, 17 Sep 2021 21:16:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLGtdj028824; Fri, 17 Sep 2021 21:16:55 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:16:55 GMT Message-Id: <202109172116.18HLGtdj028824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d50f362b505e - main - e1000: modify HW level time sync mechanisms MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d50f362b505e9026fbd33d00dc43e09cac26a209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:16:56 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d50f362b505e9026fbd33d00dc43e09cac26a209 commit d50f362b505e9026fbd33d00dc43e09cac26a209 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:04 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:16:15 +0000 e1000: modify HW level time sync mechanisms Add additional configuration space access to allow HW level time sync mechanism. Signed-off-by: Evgeny Efimov Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d53391f1fe2e0eba8818517fdf285f893d95dcc8) MFC after: 1 week --- sys/dev/e1000/e1000_ich8lan.c | 18 ++++++++++++++++++ sys/dev/e1000/e1000_ich8lan.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 3a912dc3870e..1d15881f047d 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -4963,6 +4963,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) u16 kum_cfg; u32 ctrl, reg; s32 ret_val; + u16 pci_cfg; DEBUGFUNC("e1000_reset_hw_ich8lan"); @@ -5023,11 +5024,28 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) e1000_gate_hw_phy_config_ich8lan(hw, TRUE); } ret_val = e1000_acquire_swflag_ich8lan(hw); + + /* Read from EXTCNF_CTRL in e1000_acquire_swflag_ich8lan function + * may occur during global reset and cause system hang. + * Configuration space access creates the needed delay. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER value + * insures configuration space read is done before global reset. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); DEBUGOUT("Issuing a global reset to ich8lan\n"); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_RST)); /* cannot issue a flush here because it hangs the hardware */ msec_delay(20); + /* Configuration space access improve HW level time sync mechanism. + * Write to E1000_STRAP RO register E1000_PCI_VENDOR_ID_REGISTER + * value to insure configuration space read is done + * before any access to mac register. + */ + e1000_read_pci_cfg(hw, E1000_PCI_VENDOR_ID_REGISTER, &pci_cfg); + E1000_WRITE_REG(hw, E1000_STRAP, pci_cfg); + /* Set Phy Config Counter to 50msec */ if (hw->mac.type == e1000_pch2lan) { reg = E1000_READ_REG(hw, E1000_FEXTNVM3); diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index a467e647636f..12f912ebc6e0 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -327,6 +327,8 @@ #define E1000_SVCR_OFF_TIMER_SHIFT 16 #define E1000_SVT_OFF_HWM_MASK 0x0000001F +#define E1000_PCI_VENDOR_ID_REGISTER 0x00 + void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, bool state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:17:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0047466A69A; Fri, 17 Sep 2021 21:17:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6HG69svz4jHb; Fri, 17 Sep 2021 21:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B447B1D313; Fri, 17 Sep 2021 21:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLHk1n028993; Fri, 17 Sep 2021 21:17:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLHkiX028992; Fri, 17 Sep 2021 21:17:46 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:17:46 GMT Message-Id: <202109172117.18HLHkiX028992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 6b9d35fac12b - main - e1000: remove duplicated phy codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b9d35fac12bf657cd1df8f1521c70704ff62b61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:17:47 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6b9d35fac12bf657cd1df8f1521c70704ff62b61 commit 6b9d35fac12bf657cd1df8f1521c70704ff62b61 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:05 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:17:15 +0000 e1000: remove duplicated phy codes Add two files base.c and base.h to reduce the redundancy in the silicon family code. Remove the code duplication from e1000_82575 files. Clean family specific functions from base. Fix up a stray and duplicate function declaration. Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (44dddd14059f151f39f7e075b887decfc9a10f11) MFC after: 1 week --- sys/conf/files | 2 + sys/dev/e1000/e1000_82575.c | 471 ++++++++++++++---------------------------- sys/dev/e1000/e1000_82575.h | 93 +-------- sys/dev/e1000/e1000_api.h | 1 - sys/dev/e1000/e1000_base.c | 221 ++++++++++++++++++++ sys/dev/e1000/e1000_base.h | 158 ++++++++++++++ sys/dev/e1000/e1000_defines.h | 14 +- sys/dev/e1000/e1000_hw.h | 1 + sys/dev/e1000/e1000_i210.c | 2 +- sys/dev/e1000/e1000_regs.h | 23 ++- sys/dev/e1000/if_em.c | 2 +- sys/dev/e1000/igb_txrx.c | 4 +- sys/modules/em/Makefile | 6 +- 13 files changed, 578 insertions(+), 420 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 4dd0151945bb..bf1c680093d1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1674,6 +1674,8 @@ dev/e1000/e1000_i210.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_api.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" +dev/e1000/e1000_base.c optional em \ + compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_mac.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_manage.c optional em \ diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index b252a4c7ff1d..172e99b02d5c 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -48,8 +48,6 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw); static s32 e1000_init_mac_params_82575(struct e1000_hw *hw); -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw); -static void e1000_release_phy_82575(struct e1000_hw *hw); static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw); static void e1000_release_nvm_82575(struct e1000_hw *hw); static s32 e1000_check_for_link_82575(struct e1000_hw *hw); @@ -61,6 +59,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data); static s32 e1000_reset_hw_82575(struct e1000_hw *hw); +static s32 e1000_init_hw_82575(struct e1000_hw *hw); static s32 e1000_reset_hw_82580(struct e1000_hw *hw); static s32 e1000_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data); @@ -84,10 +83,8 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); static bool e1000_sgmii_active_82575(struct e1000_hw *hw); -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); static void e1000_config_collision_dist_82575(struct e1000_hw *hw); -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); static void e1000_shutdown_serdes_link_82575(struct e1000_hw *hw); static void e1000_power_up_serdes_link_82575(struct e1000_hw *hw); static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); @@ -156,8 +153,8 @@ static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) } /** - * e1000_init_phy_params_82575 - Init PHY func ptrs. - * @hw: pointer to the HW structure + * e1000_init_phy_params_82575 - Initialize PHY function ptrs + * @hw: pointer to the HW structure **/ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) { @@ -175,17 +172,17 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82575; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_base; phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - phy->ops.acquire = e1000_acquire_phy_82575; + phy->ops.acquire = e1000_acquire_phy_base; phy->ops.check_reset_block = e1000_check_reset_block_generic; phy->ops.commit = e1000_phy_sw_reset_generic; phy->ops.get_cfg_done = e1000_get_cfg_done_82575; - phy->ops.release = e1000_release_phy_82575; + phy->ops.release = e1000_release_phy_base; ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -232,76 +229,39 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) case I347AT4_E_PHY_ID: case M88E1112_E_PHY_ID: case M88E1340M_E_PHY_ID: + phy->type = e1000_phy_m88; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88_gen2; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + break; case M88E1111_I_PHY_ID: phy->type = e1000_phy_m88; phy->ops.check_polarity = e1000_check_polarity_m88; phy->ops.get_info = e1000_get_phy_info_m88; - if (phy->id == I347AT4_E_PHY_ID || - phy->id == M88E1112_E_PHY_ID || - phy->id == M88E1340M_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else if (phy->id == M88E1543_E_PHY_ID || - phy->id == M88E1512_E_PHY_ID) - phy->ops.get_cable_length = - e1000_get_cable_length_m88_gen2; - else - phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - /* Check if this PHY is confgured for media swap. */ - if (phy->id == M88E1112_E_PHY_ID) { - u16 data; - - ret_val = phy->ops.write_reg(hw, - E1000_M88E1112_PAGE_ADDR, - 2); - if (ret_val) - goto out; - - ret_val = phy->ops.read_reg(hw, - E1000_M88E1112_MAC_CTRL_1, - &data); - if (ret_val) - goto out; - - data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> - E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; - if (data == E1000_M88E1112_AUTO_COPPER_SGMII || - data == E1000_M88E1112_AUTO_COPPER_BASEX) - hw->mac.ops.check_for_link = - e1000_check_for_link_media_swap; - } - if (phy->id == M88E1512_E_PHY_ID) { - ret_val = e1000_initialize_M88E1512_phy(hw); - if (ret_val) - goto out; - } - if (phy->id == M88E1543_E_PHY_ID) { - ret_val = e1000_initialize_M88E1543_phy(hw); - if (ret_val) - goto out; - } break; case IGP03E1000_E_PHY_ID: case IGP04E1000_E_PHY_ID: - phy->type = e1000_phy_igp_3; - phy->ops.check_polarity = e1000_check_polarity_igp; - phy->ops.get_info = e1000_get_phy_info_igp; + phy->type = e1000_phy_igp_3; + phy->ops.check_polarity = e1000_check_polarity_igp; + phy->ops.get_info = e1000_get_phy_info_igp; phy->ops.get_cable_length = e1000_get_cable_length_igp_2; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82575; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp; break; case I82580_I_PHY_ID: case I350_I_PHY_ID: - phy->type = e1000_phy_82580; - phy->ops.check_polarity = e1000_check_polarity_82577; - phy->ops.force_speed_duplex = - e1000_phy_force_speed_duplex_82577; + phy->type = e1000_phy_82580; + phy->ops.check_polarity = e1000_check_polarity_82577; + phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.get_cable_length = e1000_get_cable_length_82577; - phy->ops.get_info = e1000_get_phy_info_82577; phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82580; phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82580; + phy->ops.force_speed_duplex = + e1000_phy_force_speed_duplex_82577; break; case I210_I_PHY_ID: phy->type = e1000_phy_i210; @@ -317,98 +277,49 @@ static s32 e1000_init_phy_params_82575(struct e1000_hw *hw) goto out; } -out: - return ret_val; -} - -/** - * e1000_init_nvm_params_82575 - Init NVM func ptrs. - * @hw: pointer to the HW structure - **/ -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) -{ - struct e1000_nvm_info *nvm = &hw->nvm; - u32 eecd = E1000_READ_REG(hw, E1000_EECD); - u16 size; - - DEBUGFUNC("e1000_init_nvm_params_82575"); - - size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); - /* - * Added to a constant, "size" becomes the left-shift value - * for setting word_size. - */ - size += NVM_WORD_SIZE_BASE_SHIFT; - - /* Just in case size is out of range, cap it to the largest - * EEPROM size supported - */ - if (size > 15) - size = 15; - - nvm->word_size = 1 << size; - if (hw->mac.type < e1000_i210) { - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + /* Check if this PHY is configured for media swap. */ + switch (phy->id) { + case M88E1112_E_PHY_ID: + { + u16 data; - switch (nvm->override) { - case e1000_nvm_override_spi_large: - nvm->page_size = 32; - nvm->address_bits = 16; - break; - case e1000_nvm_override_spi_small: - nvm->page_size = 8; - nvm->address_bits = 8; - break; - default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; - nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? - 16 : 8; - break; - } - if (nvm->word_size == (1 << 15)) - nvm->page_size = 128; + ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 2); + if (ret_val) + goto out; + ret_val = phy->ops.read_reg(hw, E1000_M88E1112_MAC_CTRL_1, + &data); + if (ret_val) + goto out; - nvm->type = e1000_nvm_eeprom_spi; - } else { - nvm->type = e1000_nvm_flash_hw; + data = (data & E1000_M88E1112_MAC_CTRL_1_MODE_MASK) >> + E1000_M88E1112_MAC_CTRL_1_MODE_SHIFT; + if (data == E1000_M88E1112_AUTO_COPPER_SGMII || + data == E1000_M88E1112_AUTO_COPPER_BASEX) + hw->mac.ops.check_for_link = + e1000_check_for_link_media_swap; + break; } - - /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_82575; - nvm->ops.release = e1000_release_nvm_82575; - if (nvm->word_size < (1 << 15)) - nvm->ops.read = e1000_read_nvm_eerd; - else - nvm->ops.read = e1000_read_nvm_spi; - - nvm->ops.write = e1000_write_nvm_spi; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_82575; - - /* override generic family function pointers for specific descendants */ - switch (hw->mac.type) { - case e1000_82580: - nvm->ops.validate = e1000_validate_nvm_checksum_82580; - nvm->ops.update = e1000_update_nvm_checksum_82580; + case M88E1512_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1512_phy(hw); break; - case e1000_i350: - case e1000_i354: - nvm->ops.validate = e1000_validate_nvm_checksum_i350; - nvm->ops.update = e1000_update_nvm_checksum_i350; + } + case M88E1543_E_PHY_ID: + { + ret_val = e1000_initialize_M88E1543_phy(hw); break; + } default: - break; + goto out; } - return E1000_SUCCESS; +out: + return ret_val; } /** - * e1000_init_mac_params_82575 - Init MAC func ptrs. - * @hw: pointer to the HW structure + * e1000_init_mac_params_82575 - Init MAC func ptrs. + * @hw: pointer to the HW structure **/ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) { @@ -417,13 +328,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_init_mac_params_82575"); + /* Initialize function pointer */ + e1000_init_mac_ops_generic(hw); + /* Derives media type */ e1000_get_media_type_82575(hw); - /* Set mta register count */ + /* Set MTA register count */ mac->mta_reg_count = 128; - /* Set uta register count */ + /* Set UTA register count */ mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128; - /* Set rar entry count */ + /* Set RAR entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES_82575; if (mac->type == e1000_82576) mac->rar_entry_count = E1000_RAR_ENTRIES_82576; @@ -456,8 +370,8 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) if (mac->type >= e1000_82580) mac->ops.reset_hw = e1000_reset_hw_82580; else - mac->ops.reset_hw = e1000_reset_hw_82575; - /* hw initialization */ + mac->ops.reset_hw = e1000_reset_hw_82575; + /* HW initialization */ if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) mac->ops.init_hw = e1000_init_hw_i210; else @@ -493,7 +407,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } if (hw->mac.type >= e1000_82580) mac->ops.validate_mdi_setting = - e1000_validate_mdi_setting_crossover_generic; + e1000_validate_mdi_setting_crossover_generic; /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; /* blink LED */ @@ -511,6 +425,7 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) mac->ops.get_link_up_info = e1000_get_link_up_info_82575; /* acquire SW_FW sync */ mac->ops.acquire_swfw_sync = e1000_acquire_swfw_sync; + /* release SW_FW sync */ mac->ops.release_swfw_sync = e1000_release_swfw_sync; /* set lan id for port to determine which phy lock to use */ @@ -520,63 +435,102 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) } /** - * e1000_init_function_pointers_82575 - Init func ptrs. - * @hw: pointer to the HW structure - * - * Called to initialize all function pointers and parameters. + * e1000_init_nvm_params_82575 - Initialize NVM function ptrs + * @hw: pointer to the HW structure **/ -void e1000_init_function_pointers_82575(struct e1000_hw *hw) +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw) { - DEBUGFUNC("e1000_init_function_pointers_82575"); + struct e1000_nvm_info *nvm = &hw->nvm; + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + u16 size; - hw->mac.ops.init_params = e1000_init_mac_params_82575; - hw->nvm.ops.init_params = e1000_init_nvm_params_82575; - hw->phy.ops.init_params = e1000_init_phy_params_82575; - hw->mbx.ops.init_params = e1000_init_mbx_params_pf; -} + DEBUGFUNC("e1000_init_nvm_params_82575"); -/** - * e1000_acquire_phy_82575 - Acquire rights to access PHY - * @hw: pointer to the HW structure - * - * Acquire access rights to the correct PHY. - **/ -static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) -{ - u16 mask = E1000_SWFW_PHY0_SM; + size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> + E1000_EECD_SIZE_EX_SHIFT); + /* Added to a constant, "size" becomes the left-shift value + * for setting word_size. + */ + size += NVM_WORD_SIZE_BASE_SHIFT; - DEBUGFUNC("e1000_acquire_phy_82575"); + /* Just in case size is out of range, cap it to the largest + * EEPROM size supported + */ + if (size > 15) + size = 15; - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + nvm->word_size = 1 << size; + if (hw->mac.type < e1000_i210) { + nvm->opcode_bits = 8; + nvm->delay_usec = 1; + + switch (nvm->override) { + case e1000_nvm_override_spi_large: + nvm->page_size = 32; + nvm->address_bits = 16; + break; + case e1000_nvm_override_spi_small: + nvm->page_size = 8; + nvm->address_bits = 8; + break; + default: + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? + 16 : 8; + break; + } + if (nvm->word_size == (1 << 15)) + nvm->page_size = 128; + + nvm->type = e1000_nvm_eeprom_spi; + } else { + nvm->type = e1000_nvm_flash_hw; + } + + /* Function Pointers */ + nvm->ops.acquire = e1000_acquire_nvm_82575; + nvm->ops.release = e1000_release_nvm_82575; + if (nvm->word_size < (1 << 15)) + nvm->ops.read = e1000_read_nvm_eerd; + else + nvm->ops.read = e1000_read_nvm_spi; + + nvm->ops.write = e1000_write_nvm_spi; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_82575; + + /* override generic family function pointers for specific descendants */ + switch (hw->mac.type) { + case e1000_82580: + nvm->ops.validate = e1000_validate_nvm_checksum_82580; + nvm->ops.update = e1000_update_nvm_checksum_82580; + break; + case e1000_i350: + nvm->ops.validate = e1000_validate_nvm_checksum_i350; + nvm->ops.update = e1000_update_nvm_checksum_i350; + break; + default: + break; + } - return hw->mac.ops.acquire_swfw_sync(hw, mask); + return E1000_SUCCESS; } /** - * e1000_release_phy_82575 - Release rights to access PHY + * e1000_init_function_pointers_82575 - Init func ptrs. * @hw: pointer to the HW structure * - * A wrapper to release access rights to the correct PHY. + * Called to initialize all function pointers and parameters. **/ -static void e1000_release_phy_82575(struct e1000_hw *hw) +void e1000_init_function_pointers_82575(struct e1000_hw *hw) { - u16 mask = E1000_SWFW_PHY0_SM; - - DEBUGFUNC("e1000_release_phy_82575"); - - if (hw->bus.func == E1000_FUNC_1) - mask = E1000_SWFW_PHY1_SM; - else if (hw->bus.func == E1000_FUNC_2) - mask = E1000_SWFW_PHY2_SM; - else if (hw->bus.func == E1000_FUNC_3) - mask = E1000_SWFW_PHY3_SM; + DEBUGFUNC("e1000_init_function_pointers_82575"); - hw->mac.ops.release_swfw_sync(hw, mask); + hw->mac.ops.init_params = e1000_init_mac_params_82575; + hw->nvm.ops.init_params = e1000_init_nvm_params_82575; + hw->phy.ops.init_params = e1000_init_phy_params_82575; + hw->mbx.ops.init_params = e1000_init_mbx_params_pf; } /** @@ -1401,16 +1355,15 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) } /** - * e1000_init_hw_82575 - Initialize hardware - * @hw: pointer to the HW structure + * e1000_init_hw_82575 - Initialize hardware + * @hw: pointer to the HW structure * - * This inits the hardware readying it for operation. + * This inits the hardware readying it for operation. **/ -s32 e1000_init_hw_82575(struct e1000_hw *hw) +STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; - u16 i, rar_count = mac->rar_entry_count; DEBUGFUNC("e1000_init_hw_82575"); @@ -1425,27 +1378,12 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) DEBUGOUT("Initializing the IEEE VLAN\n"); mac->ops.clear_vfta(hw); - /* Setup the receive address */ - e1000_init_rx_addrs_generic(hw, rar_count); - - /* Zero out the Multicast HASH table */ - DEBUGOUT("Zeroing the MTA\n"); - for (i = 0; i < mac->mta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); - - /* Zero out the Unicast HASH table */ - DEBUGOUT("Zeroing the UTA\n"); - for (i = 0; i < mac->uta_reg_count; i++) - E1000_WRITE_REG_ARRAY(hw, E1000_UTA, i, 0); - - /* Setup link and flow control */ - ret_val = mac->ops.setup_link(hw); + ret_val = e1000_init_hw_base(hw); /* Set the default MTU size */ hw->dev_spec._82575.mtu = 1500; - /* - * Clear all of the statistics registers (clear on read). It is + /* Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link * because the symbol error count will increment wildly if there * is no link. @@ -1454,7 +1392,6 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) return ret_val; } - /** * e1000_setup_copper_link_82575 - Configure copper link settings * @hw: pointer to the HW structure @@ -1465,9 +1402,9 @@ s32 e1000_init_hw_82575(struct e1000_hw *hw) **/ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) { + u32 phpm_reg; u32 ctrl; s32 ret_val; - u32 phpm_reg; DEBUGFUNC("e1000_setup_copper_link_82575"); @@ -1889,7 +1826,7 @@ static bool e1000_sgmii_active_82575(struct e1000_hw *hw) * Inits recommended HW defaults after a reset when there is no EEPROM * detected. This is only for the 82575. **/ -static s32 e1000_reset_init_script_82575(struct e1000_hw *hw) +s32 e1000_reset_init_script_82575(struct e1000_hw *hw) { DEBUGFUNC("e1000_reset_init_script_82575"); @@ -1967,27 +1904,6 @@ static void e1000_config_collision_dist_82575(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } -/** - * e1000_power_down_phy_copper_82575 - Remove link during PHY power down - * @hw: pointer to the HW structure - * - * In the case of a PHY power down to save power, or to turn off link during a - * driver unload, or wake on lan is not enabled, remove the link. - **/ -static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw) -{ - struct e1000_phy_info *phy = &hw->phy; - - if (!(phy->ops.check_reset_block)) - return; - - /* If the management interface is not enabled, then power down */ - if (!(e1000_enable_mng_pass_thru(hw) || phy->ops.check_reset_block(hw))) - e1000_power_down_phy_copper(hw); - - return; -} - /** * e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters * @hw: pointer to the HW structure @@ -2053,85 +1969,6 @@ static void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_SCVPC); } -/** - * e1000_rx_fifo_flush_82575 - Clean rx fifo after Rx enable - * @hw: pointer to the HW structure - * - * After Rx enable, if manageability is enabled then there is likely some - * bad data at the start of the fifo and possibly in the DMA fifo. This - * function clears the fifos and flushes any packets that came in as rx was - * being enabled. - **/ -void e1000_rx_fifo_flush_82575(struct e1000_hw *hw) -{ - u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled; - int i, ms_wait; - - DEBUGFUNC("e1000_rx_fifo_flush_82575"); - - /* disable IPv6 options as per hardware errata */ - rfctl = E1000_READ_REG(hw, E1000_RFCTL); - rfctl |= E1000_RFCTL_IPV6_EX_DIS; - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - if (hw->mac.type != e1000_82575 || - !(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN)) - return; - - /* Disable all Rx queues */ - for (i = 0; i < 4; i++) { - rxdctl[i] = E1000_READ_REG(hw, E1000_RXDCTL(i)); - E1000_WRITE_REG(hw, E1000_RXDCTL(i), - rxdctl[i] & ~E1000_RXDCTL_QUEUE_ENABLE); - } - /* Poll all queues to verify they have shut down */ - for (ms_wait = 0; ms_wait < 10; ms_wait++) { - msec_delay(1); - rx_enabled = 0; - for (i = 0; i < 4; i++) - rx_enabled |= E1000_READ_REG(hw, E1000_RXDCTL(i)); - if (!(rx_enabled & E1000_RXDCTL_QUEUE_ENABLE)) - break; - } - - if (ms_wait == 10) - DEBUGOUT("Queue disable timed out after 10ms\n"); - - /* Clear RLPML, RCTL.SBP, RFCTL.LEF, and set RCTL.LPE so that all - * incoming packets are rejected. Set enable and wait 2ms so that - * any packet that was coming in as RCTL.EN was set is flushed - */ - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF); - - rlpml = E1000_READ_REG(hw, E1000_RLPML); - E1000_WRITE_REG(hw, E1000_RLPML, 0); - - rctl = E1000_READ_REG(hw, E1000_RCTL); - temp_rctl = rctl & ~(E1000_RCTL_EN | E1000_RCTL_SBP); - temp_rctl |= E1000_RCTL_LPE; - - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl); - E1000_WRITE_REG(hw, E1000_RCTL, temp_rctl | E1000_RCTL_EN); - E1000_WRITE_FLUSH(hw); - msec_delay(2); - - /* Enable Rx queues that were previously enabled and restore our - * previous state - */ - for (i = 0; i < 4; i++) - E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl[i]); - E1000_WRITE_REG(hw, E1000_RCTL, rctl); - E1000_WRITE_FLUSH(hw); - - E1000_WRITE_REG(hw, E1000_RLPML, rlpml); - E1000_WRITE_REG(hw, E1000_RFCTL, rfctl); - - /* Flush receive errors generated by workaround */ - E1000_READ_REG(hw, E1000_ROC); - E1000_READ_REG(hw, E1000_RNBC); - E1000_READ_REG(hw, E1000_MPC); -} - /** * e1000_set_pcie_completion_timeout - set pci-e completion timeout * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_82575.h b/sys/dev/e1000/e1000_82575.h index 22c2f8c4a2f5..d6665bfe64dd 100644 --- a/sys/dev/e1000/e1000_82575.h +++ b/sys/dev/e1000/e1000_82575.h @@ -56,9 +56,7 @@ #define E1000_RAR_ENTRIES_I350 32 #define E1000_SW_SYNCH_MB 0x00000100 #define E1000_STAT_DEV_RST_SET 0x00100000 -#define E1000_CTRL_DEV_RST 0x20000000 -#ifdef E1000_BIT_FIELDS struct e1000_adv_data_desc { __le64 buffer_addr; /* Address of the descriptor's data buffer */ union { @@ -121,7 +119,6 @@ struct e1000_adv_context_desc { } fields; } l4_setup; }; -#endif /* SRRCTL bit definitions */ #define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ @@ -181,46 +178,12 @@ struct e1000_adv_context_desc { /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ #define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ #define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ -#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ #define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ #define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ #define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ #define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ #define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ #define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ -#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ - -/* Receive Descriptor - Advanced */ -union e1000_adv_rx_desc { - struct { - __le64 pkt_addr; /* Packet buffer address */ - __le64 hdr_addr; /* Header buffer address */ - } read; - struct { - struct { - union { - __le32 data; - struct { - __le16 pkt_info; /*RSS type, Pkt type*/ - /* Split Header, header buffer len */ - __le16 hdr_info; - } hs_rss; - } lo_dword; - union { - __le32 rss; /* RSS Hash */ - struct { - __le16 ip_id; /* IP id */ - __le16 csum; /* Packet Checksum */ - } csum_ip; - } hi_dword; - } lower; - struct { - __le32 status_error; /* ext status/error */ - __le16 length; /* Packet length */ - __le16 vlan; /* VLAN tag */ - } upper; - } wb; /* writeback */ -}; #define E1000_RXDADV_RSSTYPE_MASK 0x0000000F #define E1000_RXDADV_RSSTYPE_SHIFT 12 @@ -229,7 +192,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_SPLITHEADER_EN 0x00001000 #define E1000_RXDADV_SPH 0x8000 #define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */ -#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ #define E1000_RXDADV_ERR_HBO 0x00800000 /* RSS Hash results */ @@ -278,20 +240,6 @@ union e1000_adv_rx_desc { #define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 #define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000 -/* Transmit Descriptor - Advanced */ -union e1000_adv_tx_desc { - struct { - __le64 buffer_addr; /* Address of descriptor's data buf */ - __le32 cmd_type_len; - __le32 olinfo_status; - } read; - struct { - __le64 rsvd; /* Reserved */ - __le32 nxtseq_seed; - __le32 status; - } wb; -}; - /* Adv Transmit Descriptor Config Masks */ #define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */ #define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ @@ -314,33 +262,6 @@ union e1000_adv_tx_desc { #define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ #define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ -/* Context descriptors */ -struct e1000_adv_tx_context_desc { - __le32 vlan_macip_lens; - __le32 seqnum_seed; - __le32 type_tucmd_mlhl; - __le32 mss_l4len_idx; -}; - -#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ -#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ -#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ -#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ -#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ -#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ -#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ -#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ -/* IPSec Encrypt Enable for ESP */ -#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 -/* Req requires Markers and CRC */ -#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 -#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ -#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ -/* Adv ctxt IPSec SA IDX mask */ -#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF -/* Adv ctxt IPSec ESP len mask */ -#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF - /* Additional Transmit Descriptor Control definitions */ #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */ #define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wbk flushing */ @@ -380,11 +301,6 @@ struct e1000_adv_tx_context_desc { #define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ #define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */ -/* ETQF register bit definitions */ -#define E1000_ETQF_FILTER_ENABLE (1 << 26) -#define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1U << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -395,10 +311,6 @@ struct e1000_adv_tx_context_desc { */ #define E1000_ETQF_FILTER_EAPOL 0 -#define E1000_FTQF_VF_BP 0x00008000 -#define E1000_FTQF_1588_TIME_STAMP 0x08000000 -#define E1000_FTQF_MASK 0xF0000000 -#define E1000_FTQF_MASK_PROTO_BP 0x10000000 #define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000 #define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000 #define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000 @@ -474,13 +386,14 @@ struct e1000_adv_tx_context_desc { #define ALL_QUEUES 0xFFFF +s32 e1000_reset_init_script_82575(struct e1000_hw *hw); +s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); + /* Rx packet buffer size defines */ #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); -s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); -s32 e1000_init_hw_82575(struct e1000_hw *hw); enum e1000_promisc_type { e1000_promisc_disabled = 0, /* all promisc modes disabled */ diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index 7e052910e7d0..db4caac37e97 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -46,7 +46,6 @@ extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); -extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_base.c b/sys/dev/e1000/e1000_base.c new file mode 100644 index 000000000000..e12a5fbecf25 --- /dev/null +++ b/sys/dev/e1000/e1000_base.c @@ -0,0 +1,221 @@ +/****************************************************************************** + SPDX-License-Identifier: BSD-3-Clause + + Copyright (c) 2001-2020, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD$*/ + +#include "e1000_hw.h" +#include "e1000_82575.h" +#include "e1000_mac.h" +#include "e1000_base.h" +#include "e1000_manage.h" + +/** + * e1000_acquire_phy_base - Acquire rights to access PHY + * @hw: pointer to the HW structure + * + * Acquire access rights to the correct PHY. + **/ +s32 e1000_acquire_phy_base(struct e1000_hw *hw) +{ + u16 mask = E1000_SWFW_PHY0_SM; + + DEBUGFUNC("e1000_acquire_phy_base"); + + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + else if (hw->bus.func == E1000_FUNC_2) + mask = E1000_SWFW_PHY2_SM; + else if (hw->bus.func == E1000_FUNC_3) + mask = E1000_SWFW_PHY3_SM; + + return hw->mac.ops.acquire_swfw_sync(hw, mask); +} + +/** + * e1000_release_phy_base - Release rights to access PHY + * @hw: pointer to the HW structure + * *** 508 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:19:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1C5066A6B0; Fri, 17 Sep 2021 21:19:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6Jl6PpQz4jCb; Fri, 17 Sep 2021 21:19:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC9CF1D314; Fri, 17 Sep 2021 21:19:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLJ3F1029252; Fri, 17 Sep 2021 21:19:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLJ3dv029251; Fri, 17 Sep 2021 21:19:03 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:19:03 GMT Message-Id: <202109172119.18HLJ3dv029251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 1883a6ff3b2e - main - e1000: update for i210 slow system clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:19:04 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9 commit 1883a6ff3b2ebaf108c45717c8eb94e0a76bb0b9 Author: Guinan Sun AuthorDate: 2020-07-06 08:11:56 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:18:25 +0000 e1000: update for i210 slow system clock This code is required for the update for system clock. Signed-off-by: Todd Fujinaka Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (3f0188c8f29847038bc9f306b2570ace57e3811c) MFC after: 1 week --- sys/dev/e1000/e1000_i210.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0bdad37e56d3..cd85a8c3172a 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -612,6 +612,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) u16 nvm_word, phy_word, pci_word, tmp_nvm; int i; + /* Get PHY semaphore */ + hw->phy.ops.acquire(hw); /* Get and set needed register values */ wuc = E1000_READ_REG(hw, E1000_WUC); mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); @@ -626,8 +628,11 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ - e1000_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | - E1000_PHY_PLL_FREQ_REG), &phy_word); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); + usec_delay(20); + e1000_read_phy_reg_mdic(hw, E1000_PHY_PLL_FREQ_REG, &phy_word); + usec_delay(20); + e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0); if ((phy_word & E1000_PHY_PLL_UNCONF) != E1000_PHY_PLL_UNCONF) { ret_val = E1000_SUCCESS; @@ -661,6 +666,8 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) } /* restore MDICNFG setting */ E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); + /* Release PHY semaphore */ + hw->phy.ops.release(hw); return ret_val; } From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:19:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7971766A834; Fri, 17 Sep 2021 21:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6Kl32c7z4jTH; Fri, 17 Sep 2021 21:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 480AD1D06C; Fri, 17 Sep 2021 21:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLJtCG029420; Fri, 17 Sep 2021 21:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLJtjL029419; Fri, 17 Sep 2021 21:19:55 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:19:55 GMT Message-Id: <202109172119.18HLJtjL029419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d1c37752e2af - main - e1000: expose MAC functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1c37752e2afb51dfb2e08afe714a799788b6ede Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:19:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d1c37752e2afb51dfb2e08afe714a799788b6ede commit d1c37752e2afb51dfb2e08afe714a799788b6ede Author: Guinan Sun AuthorDate: 2020-07-06 08:12:06 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:19:22 +0000 e1000: expose MAC functions Now the functions are being accessed outside of the file, we need to properly expose them for silicon families to use. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a) MFC after: 1 week --- sys/dev/e1000/e1000_mac.c | 3 +-- sys/dev/e1000/e1000_mac.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c index e0d078d924f9..a13572d8dc18 100644 --- a/sys/dev/e1000/e1000_mac.c +++ b/sys/dev/e1000/e1000_mac.c @@ -38,7 +38,6 @@ static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); static void e1000_config_collision_dist_generic(struct e1000_hw *hw); -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); /** * e1000_init_mac_ops_generic - Initialize MAC function pointers @@ -484,7 +483,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) * Sets the receive address array register at index to the address passed * in by addr. **/ -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; diff --git a/sys/dev/e1000/e1000_mac.h b/sys/dev/e1000/e1000_mac.h index 1f472d42421e..370f7f9d8a1a 100644 --- a/sys/dev/e1000/e1000_mac.h +++ b/sys/dev/e1000/e1000_mac.h @@ -70,6 +70,7 @@ s32 e1000_led_on_generic(struct e1000_hw *hw); s32 e1000_led_off_generic(struct e1000_hw *hw); void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count); +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); s32 e1000_set_default_fc_generic(struct e1000_hw *hw); s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:21:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C42CC66A85E for ; Fri, 17 Sep 2021 21:21:11 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6MC4xxdz4jP8 for ; Fri, 17 Sep 2021 21:21:11 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-qk1-x733.google.com with SMTP id 73so16665236qki.4 for ; Fri, 17 Sep 2021 14:21:11 -0700 (PDT) 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=OdD6yP68iCBuhgNXmy09gqHUNUyqUMFZlv6jO7YM8j8=; b=FytPDH2EqX42eKFyyO24EpbK6l93S/JpF07zoQ+UVy6BugW2r2FtPJ/PFJwGNSzW47 VaGHwhUL0GtbBvfJa1qhGBgieEpU9xwnJMcUgLwMxhZSuZCRG2onfHT557gTHZDOzAfV 9nI3/QoOVeZa+efoA7Gbg/55flcDKV3XmMsUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OdD6yP68iCBuhgNXmy09gqHUNUyqUMFZlv6jO7YM8j8=; b=u6qPUpIroEYWWe9S5MlOFTYttDAx5jVyTx/NKm2OX3/R0+PMSJ3sXyIXglzdgG1SpK shUDtjYd6RYrPTgVqbDkEU4ZC89IZ1+btzHEOCDq4lPHd3uqdk/W5YxbHOKGaQgRpHJQ W61jUaLGnmx045GMEPYzYIcn70jwT8OeTwqe20+wHUx29sVQ9pc6hyxFdpULE0t0XHpR kVShOHhGmGfOQlhH5y4NbSie/dwZheWQObKdhfc2kayN5P7yFgudwDuKiJnAWqLtcF5+ pbxmBMr/T1j+Yshe9jrYzPipelOD5R28biMVoWcIudKWAcYJNya959giD6G0NfC8oCG7 1g0w== X-Gm-Message-State: AOAM5336vnHbrUw6ihgpfa9K3V+UmzxrvYKdJ3nv3gPNWj7HWyHoYSWb xzZMzIkYAMVOUivRX1/iiEIrcM/uGiED5JO6Ykvs2g== X-Google-Smtp-Source: ABdhPJyLWqvV+K3z7s01nH3XB3N9F6oWqnlePJGrBFuMN5kTXlXn5+4cOyL2tGLwCzT4JNHKjY6HhD9GFzpTLgOxGF8= X-Received: by 2002:a05:6902:1204:: with SMTP id s4mr15991574ybu.493.1631913671011; Fri, 17 Sep 2021 14:21:11 -0700 (PDT) MIME-Version: 1.0 References: <202109172119.18HLJtjL029419@gitrepo.freebsd.org> In-Reply-To: <202109172119.18HLJtjL029419@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 17 Sep 2021 14:20:59 -0700 Message-ID: Subject: Re: git: d1c37752e2af - main - e1000: expose MAC functions To: Kevin Bowling Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HB6MC4xxdz4jP8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:21:11 -0000 Sorry for a pasto (X11 clipboard :o)), the DPDK commit hash is aca51d3158c25ea8e50abb3f71c930d667f8c275 here. On Fri, Sep 17, 2021 at 2:19 PM Kevin Bowling wrote: > > The branch main has been updated by kbowling (ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=d1c37752e2afb51dfb2e08afe714a799788b6ede > > commit d1c37752e2afb51dfb2e08afe714a799788b6ede > Author: Guinan Sun > AuthorDate: 2020-07-06 08:12:06 +0000 > Commit: Kevin Bowling > CommitDate: 2021-09-17 21:19:22 +0000 > > e1000: expose MAC functions > > Now the functions are being accessed outside of the file, we need > to properly expose them for silicon families to use. > > Signed-off-by: Jeff Kirsher > Signed-off-by: Guinan Sun > Reviewed-by: Wei Zhao > > Approved by: imp > Obtained from: DPDK (df01c0ee277d51f81d7d72501dba97550d3b6c4a) > MFC after: 1 week > --- > sys/dev/e1000/e1000_mac.c | 3 +-- > sys/dev/e1000/e1000_mac.h | 1 + > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sys/dev/e1000/e1000_mac.c b/sys/dev/e1000/e1000_mac.c > index e0d078d924f9..a13572d8dc18 100644 > --- a/sys/dev/e1000/e1000_mac.c > +++ b/sys/dev/e1000/e1000_mac.c > @@ -38,7 +38,6 @@ > static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); > static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); > static void e1000_config_collision_dist_generic(struct e1000_hw *hw); > -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); > > /** > * e1000_init_mac_ops_generic - Initialize MAC function pointers > @@ -484,7 +483,7 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) > * Sets the receive address array register at index to the address passed > * in by addr. > **/ > -static int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) > +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) > { > u32 rar_low, rar_high; > > diff --git a/sys/dev/e1000/e1000_mac.h b/sys/dev/e1000/e1000_mac.h > index 1f472d42421e..370f7f9d8a1a 100644 > --- a/sys/dev/e1000/e1000_mac.h > +++ b/sys/dev/e1000/e1000_mac.h > @@ -70,6 +70,7 @@ s32 e1000_led_on_generic(struct e1000_hw *hw); > s32 e1000_led_off_generic(struct e1000_hw *hw); > void e1000_update_mc_addr_list_generic(struct e1000_hw *hw, > u8 *mc_addr_list, u32 mc_addr_count); > +int e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); > s32 e1000_set_default_fc_generic(struct e1000_hw *hw); > s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw); > s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw); > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:22:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03C2266A873; Fri, 17 Sep 2021 21:22:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6NP4b4fz4jtc; Fri, 17 Sep 2021 21:22:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FBC51D606; Fri, 17 Sep 2021 21:22:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLMD2b041938; Fri, 17 Sep 2021 21:22:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLMDe0041937; Fri, 17 Sep 2021 21:22:13 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:22:13 GMT Message-Id: <202109172122.18HLMDe0041937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: a6f0cc373f0a - main - e1000: add PCIm function state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:22:14 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1 commit a6f0cc373f0afc24c9c27bbba45a6a7a3ac268d1 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:07 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:21:22 +0000 e1000: add PCIm function state Added define to pcim function state. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (7ee1a3b273c7f321b50e6ba17c3d9537b1b08347) MFC after: 1 week --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 4bd575a81671..5b77bd43af1a 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -346,6 +346,7 @@ #define E1000_STATUS_PCIX_SPEED_66 0x00000000 /* PCI-X bus spd 50-66MHz */ #define E1000_STATUS_PCIX_SPEED_100 0x00004000 /* PCI-X bus spd 66-100MHz */ #define E1000_STATUS_PCIX_SPEED_133 0x00008000 /* PCI-X bus spd 100-133MHz*/ +#define E1000_STATUS_PCIM_STATE 0x40000000 /* PCIm function state */ #define SPEED_10 10 #define SPEED_100 100 From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A91F66AE87; Fri, 17 Sep 2021 21:37:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6jz18jFz4nfT; Fri, 17 Sep 2021 21:37:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04A6D1D5E0; Fri, 17 Sep 2021 21:37:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbQ3r056159; Fri, 17 Sep 2021 21:37:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbQQm056158; Fri, 17 Sep 2021 21:37:26 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:26 GMT Message-Id: <202109172137.18HLbQQm056158@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 09888d4bc1a2 - main - e1000: add missing register defines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09888d4bc1a2c45d121046f79be5c01e4889a67e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:27 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=09888d4bc1a2c45d121046f79be5c01e4889a67e commit 09888d4bc1a2c45d121046f79be5c01e4889a67e Author: Guinan Sun AuthorDate: 2020-07-06 08:12:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:23:00 +0000 e1000: add missing register defines Added defines for the EEC, SHADOWINF and FLFWUPDATE registers needed for the nvmupd_validate_offset function to correctly validate the NVM update offset. Signed-off-by: Jeff Kirsher Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (2c7fe65ab9a31e6ebf438dad7ccc59bcde83a89f) MFC after: 1 week --- sys/dev/e1000/e1000_regs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 2b7696ddea62..fe9834405359 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -169,6 +169,8 @@ #define E1000_EMIDATA 0x11 /* Extended Memory Indirect Data */ /* Shadow Ram Write Register - RW */ #define E1000_SRWR 0x12018 +#define E1000_EEC_REG 0x12010 + #define E1000_I210_FLMNGCTL 0x12038 #define E1000_I210_FLMNGDATA 0x1203C #define E1000_I210_FLMNGCNT 0x12040 @@ -179,6 +181,9 @@ #define E1000_I210_FLA 0x1201C +#define E1000_SHADOWINF 0x12068 +#define E1000_FLFWUPDATE 0x12108 + #define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n)) #define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7106966AD23; Fri, 17 Sep 2021 21:37:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k02H9tz4ncQ; Fri, 17 Sep 2021 21:37:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 200E31D479; Fri, 17 Sep 2021 21:37:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbSp4056183; Fri, 17 Sep 2021 21:37:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbS8S056182; Fri, 17 Sep 2021 21:37:28 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:28 GMT Message-Id: <202109172137.18HLbS8S056182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: e8e3171d992f - main - e1000: increase timeout for ME ULP exit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8e3171d992f3255cc8e5a0f59912d07679cc94c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:28 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e8e3171d992f3255cc8e5a0f59912d07679cc94c commit e8e3171d992f3255cc8e5a0f59912d07679cc94c Author: Guinan Sun AuthorDate: 2020-07-06 08:12:09 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:23:07 +0000 e1000: increase timeout for ME ULP exit Due timing issues in WHL and since recovery by host is not always supported, increased timeout for Manageability Engine(ME) to finish Ultra Low Power(ULP) exit flow for Nahum before timer expiration. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (cf1f3ca45d33e793ca581200b4000c39a798113e) MFC after: 1 week --- sys/dev/e1000/e1000_ich8lan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 1d15881f047d..8ca0fb392805 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1413,6 +1413,7 @@ out: s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) { s32 ret_val = E1000_SUCCESS; + u8 ulp_exit_timeout = 30; u32 mac_reg; u16 phy_reg; int i = 0; @@ -1434,10 +1435,12 @@ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) E1000_WRITE_REG(hw, E1000_H2ME, mac_reg); } - /* Poll up to 300msec for ME to clear ULP_CFG_DONE. */ + if (hw->mac.type == e1000_pch_cnp) + ulp_exit_timeout = 100; + while (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_ULP_CFG_DONE) { - if (i++ == 30) { + if (i++ == ulp_exit_timeout) { ret_val = -E1000_ERR_PHY; goto out; } From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2216066AD8B; Fri, 17 Sep 2021 21:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k25Dhdz4nWm; Fri, 17 Sep 2021 21:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B0C51D731; Fri, 17 Sep 2021 21:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbUcR056231; Fri, 17 Sep 2021 21:37:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbUbn056230; Fri, 17 Sep 2021 21:37:30 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:30 GMT Message-Id: <202109172137.18HLbUbn056230@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: de965d042fa4 - main - e1000: expose FEXTNVM registers and masks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de965d042fa4d341cec3fa7cacac0f30f224bde4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:31 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=de965d042fa4d341cec3fa7cacac0f30f224bde4 commit de965d042fa4d341cec3fa7cacac0f30f224bde4 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:16 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:23:26 +0000 e1000: expose FEXTNVM registers and masks Adding defines for FEXTNVM8 and FEXTNVM12 registers with new masks for future use. Signed-off-by: Nir Efrati Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (6d208ec099cd870a73c6b444b350a82c7a26c5e4) MFC after: 1 week --- sys/dev/e1000/e1000_ich8lan.h | 3 ++- sys/dev/e1000/e1000_regs.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_ich8lan.h b/sys/dev/e1000/e1000_ich8lan.h index 12f912ebc6e0..caff11cbb899 100644 --- a/sys/dev/e1000/e1000_ich8lan.h +++ b/sys/dev/e1000/e1000_ich8lan.h @@ -113,11 +113,12 @@ #define E1000_FEXTNVM7_DISABLE_PB_READ 0x00040000 #define E1000_FEXTNVM7_SIDE_CLK_UNGATE 0x00000004 #define E1000_FEXTNVM7_DISABLE_SMB_PERST 0x00000020 +#define E1000_FEXTNVM8_UNBIND_DPG_FROM_MPHY 0x00000400 #define E1000_FEXTNVM9_IOSFSB_CLKGATE_DIS 0x00000800 #define E1000_FEXTNVM9_IOSFSB_CLKREQ_DIS 0x00001000 #define E1000_FEXTNVM11_DISABLE_PB_READ 0x00000200 #define E1000_FEXTNVM11_DISABLE_MULR_FIX 0x00002000 - +#define E1000_FEXTNVM12_DONT_WAK_DPG_CLKREQ 0x00001000 /* bit24: RXDCTL thresholds granularity: 0 - cache lines, 1 - descriptors */ #define E1000_RXDCTL_THRESH_UNIT_DESC 0x01000000 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index fe9834405359..01009d969620 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -66,8 +66,10 @@ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ +#define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ #define E1000_FEXTNVM9 0x5BB4 /* Future Extended NVM 9 - RW */ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ +#define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A266966AF0A; Fri, 17 Sep 2021 21:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k13Z4Qz4nNr; Fri, 17 Sep 2021 21:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42DB11D5E1; Fri, 17 Sep 2021 21:37:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbTJx056207; Fri, 17 Sep 2021 21:37:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbTU4056206; Fri, 17 Sep 2021 21:37:29 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:29 GMT Message-Id: <202109172137.18HLbTU4056206@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: a8bb4ab7cfb8 - main - e1000: add missed define for VFTA MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8bb4ab7cfb84195ef8af3c788fecdc8830fc960 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:29 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a8bb4ab7cfb84195ef8af3c788fecdc8830fc960 commit a8bb4ab7cfb84195ef8af3c788fecdc8830fc960 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:13 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:23:19 +0000 e1000: add missed define for VFTA VLAN filtering using the VFTA (VLAN Filter Table Array) and should be initialized prior to setting rx mode. Signed-off-by: Sasha Neftin Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (fc9933953c90e99970aa867c38f9c6e6c5d0488d) MFC after: 1 week --- sys/dev/e1000/e1000_defines.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index 5b77bd43af1a..e5435eb56dcd 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1386,6 +1386,7 @@ #define E1000_MDIC_ERROR 0x40000000 #define E1000_MDIC_DEST 0x80000000 +#define E1000_VFTA_BLOCK_SIZE 8 /* SerDes Control */ #define E1000_GEN_CTL_READY 0x80000000 #define E1000_GEN_CTL_ADDRESS_SHIFT 8 From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2007F66AD8D; Fri, 17 Sep 2021 21:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k35vg7z4nWs; Fri, 17 Sep 2021 21:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C87A1D732; Fri, 17 Sep 2021 21:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbVG8056261; Fri, 17 Sep 2021 21:37:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbVF0056260; Fri, 17 Sep 2021 21:37:31 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:31 GMT Message-Id: <202109172137.18HLbVF0056260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 7fb2111413c7 - main - e1000: introduce DPGFR register MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fb2111413c799414c86d7bfdcc72bc1c6302726 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:32 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7fb2111413c799414c86d7bfdcc72bc1c6302726 commit 7fb2111413c799414c86d7bfdcc72bc1c6302726 Author: Guinan Sun AuthorDate: 2020-07-06 08:12:19 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:24:07 +0000 e1000: introduce DPGFR register Defined DPGFR, Dynamic Power Gate Force Control Register. Signed-off-by: Vitaly Lifshits Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (1469e5aceffbdcebe834292aadb40b1bd1602867) MFC after: 1 week --- sys/dev/e1000/e1000_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 01009d969620..27c456a432e8 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -71,6 +71,7 @@ #define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */ #define E1000_FEXTNVM12 0x5BC0 /* Future Extended NVM 12 - RW */ #define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */ +#define E1000_DPGFR 0x00FAC /* Dynamic Power Gate Force Control Register */ #define E1000_FCT 0x00030 /* Flow Control Type - RW */ #define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */ #define E1000_VET 0x00038 /* VLAN Ether Type - RW */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70D7F66AF10; Fri, 17 Sep 2021 21:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k60nx1z4nPF; Fri, 17 Sep 2021 21:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D30D41D47B; Fri, 17 Sep 2021 21:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbXda056321; Fri, 17 Sep 2021 21:37:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbXxw056320; Fri, 17 Sep 2021 21:37:33 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:33 GMT Message-Id: <202109172137.18HLbXxw056320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: f6517a7e69c1 - main - e1000: fix timeout for shadow RAM write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6517a7e69c10c6057d6c990a9f3ea22a2b62398 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:34 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f6517a7e69c10c6057d6c990a9f3ea22a2b62398 commit f6517a7e69c10c6057d6c990a9f3ea22a2b62398 Author: Chengwen Feng AuthorDate: 2021-04-21 09:15:35 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:24:29 +0000 e1000: fix timeout for shadow RAM write This fixes the timed out for shadow RAM write EEWR can't be detected. Fixes: 5a32a257f957 ("e1000: more NICs in base driver") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Acked-by: Haiyue Wang Approved by: imp Obtained from: DPDK (4a8ab48ec47b3616272e50620b8e1a9599358ea6) MFC after: 1 week --- sys/dev/e1000/e1000_i210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index cd85a8c3172a..d3692db11245 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -195,6 +195,8 @@ static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words, } for (i = 0; i < words; i++) { + ret_val = -E1000_ERR_NVM; + eewr = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) | (data[i] << E1000_NVM_RW_REG_DATA) | E1000_NVM_RW_REG_START; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA2FC66AE91; Fri, 17 Sep 2021 21:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k53Tg8z4ng3; Fri, 17 Sep 2021 21:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADA9A1D47A; Fri, 17 Sep 2021 21:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbWuG056289; Fri, 17 Sep 2021 21:37:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbWf4056288; Fri, 17 Sep 2021 21:37:32 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:32 GMT Message-Id: <202109172137.18HLbWf4056288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 9c4a0fabc8b8 - main - e1000: cleanup pre-processor tags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:34 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b commit 9c4a0fabc8b88af0d9fd3f0d67bd080714d1ee4b Author: Guinan Sun AuthorDate: 2020-07-06 08:12:20 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:24:23 +0000 e1000: cleanup pre-processor tags The codes has been exposed correctly, so remove pre-processor tags. Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (a50e998a0fd94e5db508710868a3417b1846425c) MFC after: 1 week --- sys/dev/e1000/e1000_manage.c | 5 +++-- sys/dev/e1000/e1000_regs.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/e1000_manage.c b/sys/dev/e1000/e1000_manage.c index 120431d58b0b..b5ad5815d5ee 100644 --- a/sys/dev/e1000/e1000_manage.c +++ b/sys/dev/e1000/e1000_manage.c @@ -34,6 +34,8 @@ /*$FreeBSD$*/ #include "e1000_api.h" +#include "e1000_manage.h" + /** * e1000_calculate_checksum - Calculate checksum for buffer * @buffer: pointer to EEPROM @@ -455,6 +457,7 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } + /** * e1000_load_firmware - Writes proxy FW code buffer to host interface * and execute. @@ -573,5 +576,3 @@ s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length) return E1000_SUCCESS; } - - diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index 27c456a432e8..c09856e55275 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -381,6 +381,7 @@ #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context Tx - R/clr */ #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context Tx Fail - R/clr */ #define E1000_IAC 0x04100 /* Interrupt Assertion Count */ +/* Interrupt Cause */ #define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Pkt Timer Expire Count */ #define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Abs Timer Expire Count */ #define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Pkt Timer Expire Count */ @@ -503,12 +504,14 @@ #define E1000_WUC 0x05800 /* Wakeup Control - RW */ #define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ #define E1000_WUS 0x05810 /* Wakeup Status - RO */ +/* Management registers */ #define E1000_MANC 0x05820 /* Management Control - RW */ #define E1000_IPAV 0x05838 /* IP Address Valid - RW */ #define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */ #define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */ #define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ #define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */ +/* MSI-X Table Register Descriptions */ #define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */ #define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */ #define E1000_HOST_IF 0x08800 /* Host Interface */ From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED18166B002; Fri, 17 Sep 2021 21:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k82qJVz4nZX; Fri, 17 Sep 2021 21:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 225571D5E3; Fri, 17 Sep 2021 21:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbaEB056369; Fri, 17 Sep 2021 21:37:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbaDj056368; Fri, 17 Sep 2021 21:37:36 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:36 GMT Message-Id: <202109172137.18HLbaDj056368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 089cdb3990f4 - main - e1000: clean LTO warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 089cdb3990f47be3cd34d1a57567a2e89c917929 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:37 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=089cdb3990f47be3cd34d1a57567a2e89c917929 commit 089cdb3990f47be3cd34d1a57567a2e89c917929 Author: Andrzej Ostruszka AuthorDate: 2019-11-07 15:03:15 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:24:54 +0000 e1000: clean LTO warnings During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: 'link' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (link) { Signed-off-by: Andrzej Ostruszka Approved by: imp Obtained from: DPDK (46136031f19107f4e9b6b3a952cb7f57877a7f0f) MFC after: 1 week --- sys/dev/e1000/e1000_82543.c | 2 +- sys/dev/e1000/e1000_ich8lan.c | 2 +- sys/dev/e1000/e1000_phy.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index 42c4726fa8c7..49049b8646cd 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -1062,7 +1062,7 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) { u32 ctrl; s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_82543"); diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 8ca0fb392805..635be03f2900 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -5620,7 +5620,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) { s32 ret_val; - u16 reg_data; + u16 reg_data = 0; DEBUGFUNC("e1000_gig_downshift_workaround_ich8lan"); diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index d84b6120dd31..2eae3acbe500 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1695,7 +1695,7 @@ s32 e1000_copper_link_autoneg(struct e1000_hw *hw) s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) { s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_generic"); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A03E66AF8D; Fri, 17 Sep 2021 21:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6kB5tfRz4njt; Fri, 17 Sep 2021 21:37:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 652DB1D789; Fri, 17 Sep 2021 21:37:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbcxv056423; Fri, 17 Sep 2021 21:37:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbc10056422; Fri, 17 Sep 2021 21:37:38 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:38 GMT Message-Id: <202109172137.18HLbc10056422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 984d1616be88 - main - e1000: Catch up commit with DPDK MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 984d1616be883bc2c351aff9aa69b1abd7d1214c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:39 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=984d1616be883bc2c351aff9aa69b1abd7d1214c commit 984d1616be883bc2c351aff9aa69b1abd7d1214c Author: Kevin Bowling AuthorDate: 2021-09-17 02:30:49 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:26:01 +0000 e1000: Catch up commit with DPDK Various syncs with the e1000 shared code from DPDK: "cid-gigabit.2020.06.05.tar.gz released by ND" Approved by: imp Obtained from: DPDK MFC after: 1 week --- sys/dev/e1000/e1000_82571.c | 2 +- sys/dev/e1000/e1000_82575.c | 2 +- sys/dev/e1000/e1000_api.c | 15 +++++ sys/dev/e1000/e1000_api.h | 1 + sys/dev/e1000/e1000_defines.h | 33 ++++++++++ sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 100 ++++++++++++++++++++++++++++ sys/dev/e1000/e1000_i210.h | 2 + sys/dev/e1000/e1000_nvm.c | 147 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/e1000/e1000_nvm.h | 19 ++++++ sys/dev/e1000/e1000_regs.h | 3 +- 11 files changed, 322 insertions(+), 4 deletions(-) diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 6fefcc774cbb..8db1fcb921a9 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -515,7 +515,7 @@ e1000_get_hw_semaphore_82574(struct e1000_hw *hw) u32 extcnf_ctrl; s32 i = 0; /* XXX assert that mutex is held */ - DEBUGFUNC("e1000_get_hw_semaphore_82573"); + DEBUGFUNC("e1000_get_hw_semaphore_82574"); ASSERT_CTX_LOCK_HELD(hw); extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 172e99b02d5c..29805270f8dc 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1360,7 +1360,7 @@ static s32 e1000_reset_hw_82575(struct e1000_hw *hw) * * This inits the hardware readying it for operation. **/ -STATIC s32 e1000_init_hw_82575(struct e1000_hw *hw) +static s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index 6e0f51ab7ffa..b28ab77f3794 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -1269,6 +1269,21 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size) return e1000_read_pba_length_generic(hw, pba_num_size); } +/** + * e1000_read_pba_num - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + * Currently no func pointer exists and all implementations are handled in the + * generic version of this function. + **/ +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num) +{ + return e1000_read_pba_num_generic(hw, pba_num); +} + /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum * @hw: pointer to the HW structure diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index db4caac37e97..c96030b567db 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -97,6 +97,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw); void e1000_power_up_phy(struct e1000_hw *hw); void e1000_power_down_phy(struct e1000_hw *hw); s32 e1000_read_mac_addr(struct e1000_hw *hw); +s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); void e1000_reload_nvm(struct e1000_hw *hw); diff --git a/sys/dev/e1000/e1000_defines.h b/sys/dev/e1000/e1000_defines.h index e5435eb56dcd..44281a0fadf6 100644 --- a/sys/dev/e1000/e1000_defines.h +++ b/sys/dev/e1000/e1000_defines.h @@ -1083,11 +1083,44 @@ /* NVM Word Offsets */ #define NVM_COMPAT 0x0003 #define NVM_ID_LED_SETTINGS 0x0004 +#define NVM_VERSION 0x0005 #define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */ #define NVM_PHY_CLASS_WORD 0x0007 #define E1000_I210_NVM_FW_MODULE_PTR 0x0010 #define E1000_I350_NVM_FW_MODULE_PTR 0x0051 #define NVM_FUTURE_INIT_WORD1 0x0019 +#define NVM_ETRACK_WORD 0x0042 +#define NVM_ETRACK_HIWORD 0x0043 +#define NVM_COMB_VER_OFF 0x0083 +#define NVM_COMB_VER_PTR 0x003d + +/* NVM version defines */ +#define NVM_MAJOR_MASK 0xF000 +#define NVM_MINOR_MASK 0x0FF0 +#define NVM_IMAGE_ID_MASK 0x000F +#define NVM_COMB_VER_MASK 0x00FF +#define NVM_MAJOR_SHIFT 12 +#define NVM_MINOR_SHIFT 4 +#define NVM_COMB_VER_SHFT 8 +#define NVM_VER_INVALID 0xFFFF +#define NVM_ETRACK_SHIFT 16 +#define NVM_ETRACK_VALID 0x8000 +#define NVM_NEW_DEC_MASK 0x0F00 +#define NVM_HEX_CONV 16 +#define NVM_HEX_TENS 10 + +/* FW version defines */ +/* Offset of "Loader patch ptr" in Firmware Header */ +#define E1000_I350_NVM_FW_LOADER_PATCH_PTR_OFFSET 0x01 +/* Patch generation hour & minutes */ +#define E1000_I350_NVM_FW_VER_WORD1_OFFSET 0x04 +/* Patch generation month & day */ +#define E1000_I350_NVM_FW_VER_WORD2_OFFSET 0x05 +/* Patch generation year */ +#define E1000_I350_NVM_FW_VER_WORD3_OFFSET 0x06 +/* Patch major & minor numbers */ +#define E1000_I350_NVM_FW_VER_WORD4_OFFSET 0x07 + #define NVM_MAC_ADDR 0x0000 #define NVM_SUB_DEV_ID 0x000B #define NVM_SUB_VEN_ID 0x000C diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 59e51e5c322f..90bc652861b5 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -998,7 +998,7 @@ struct e1000_dev_spec_ich8lan { enum e1000_ulp_state ulp_state; bool ulp_capability_disabled; bool during_suspend_flow; - bool during_dpg_exit; + bool smbus_disable; }; struct e1000_dev_spec_82575 { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index d3692db11245..0d810fecf3bd 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -345,6 +345,105 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset, return ret_val; } +/** + * e1000_read_invm_version - Reads iNVM version and image type + * @hw: pointer to the HW structure + * @invm_ver: version structure for the version read + * + * Reads iNVM version and image type. + **/ +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver) +{ + u32 *record = NULL; + u32 *next_record = NULL; + u32 i = 0; + u32 invm_dword = 0; + u32 invm_blocks = E1000_INVM_SIZE - (E1000_INVM_ULT_BYTES_SIZE / + E1000_INVM_RECORD_SIZE_IN_BYTES); + u32 buffer[E1000_INVM_SIZE]; + s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND; + u16 version = 0; + + DEBUGFUNC("e1000_read_invm_version"); + + /* Read iNVM memory */ + for (i = 0; i < E1000_INVM_SIZE; i++) { + invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i)); + buffer[i] = invm_dword; + } + + /* Read version number */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have first version location used */ + if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) { + version = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have second version location used */ + else if ((i == 1) && + ((*record & E1000_INVM_VER_FIELD_TWO) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have odd version location + * used and it is the last one used + */ + else if ((((*record & E1000_INVM_VER_FIELD_ONE) == 0) && + ((*record & 0x3) == 0)) || (((*record & 0x3) != 0) && + (i != 1))) { + version = (*next_record & E1000_INVM_VER_FIELD_TWO) + >> 13; + status = E1000_SUCCESS; + break; + } + /* + * Check if we have even version location + * used and it is the last one used + */ + else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) && + ((*record & 0x3) == 0)) { + version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3; + status = E1000_SUCCESS; + break; + } + } + + if (status == E1000_SUCCESS) { + invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK) + >> E1000_INVM_MAJOR_SHIFT; + invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK; + } + /* Read Image Type */ + for (i = 1; i < invm_blocks; i++) { + record = &buffer[invm_blocks - i]; + next_record = &buffer[invm_blocks - i + 1]; + + /* Check if we have image type in first location used */ + if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) { + invm_ver->invm_img_type = 0; + status = E1000_SUCCESS; + break; + } + /* Check if we have image type in first location used */ + else if ((((*record & 0x3) == 0) && + ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) || + ((((*record & 0x3) != 0) && (i != 1)))) { + invm_ver->invm_img_type = + (*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23; + status = E1000_SUCCESS; + break; + } + } + return status; +} + /** * e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum * @hw: pointer to the HW structure @@ -628,6 +727,7 @@ static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) if (ret_val != E1000_SUCCESS) nvm_word = E1000_INVM_DEFAULT_AL; tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; + phy_word = E1000_PHY_PLL_UNCONF; for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { /* check current state directly from internal PHY */ e1000_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, 0xFC); diff --git a/sys/dev/e1000/e1000_i210.h b/sys/dev/e1000/e1000_i210.h index 9ad9e28c363b..77414b851a76 100644 --- a/sys/dev/e1000/e1000_i210.h +++ b/sys/dev/e1000/e1000_i210.h @@ -44,6 +44,8 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); +s32 e1000_read_invm_version(struct e1000_hw *hw, + struct e1000_fw_version *invm_ver); s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 86a1e772fb13..31bbfcc6981d 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -939,6 +939,41 @@ s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size) return E1000_SUCCESS; } +/** + * e1000_read_pba_num_generic - Read device part number + * @hw: pointer to the HW structure + * @pba_num: pointer to device part number + * + * Reads the product board assembly (PBA) number from the EEPROM and stores + * the value in pba_num. + **/ +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num) +{ + s32 ret_val; + u16 nvm_data; + + DEBUGFUNC("e1000_read_pba_num_generic"); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } else if (nvm_data == NVM_PBA_PTR_GUARD) { + DEBUGOUT("NVM Not Supported\n"); + return -E1000_NOT_IMPLEMENTED; + } + *pba_num = (u32)(nvm_data << 16); + + ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + return ret_val; + } + *pba_num |= nvm_data; + + return E1000_SUCCESS; +} + /** * e1000_read_pba_raw @@ -1241,4 +1276,116 @@ static void e1000_reload_nvm_generic(struct e1000_hw *hw) E1000_WRITE_FLUSH(hw); } +/** + * e1000_get_fw_version - Get firmware version information + * @hw: pointer to the HW structure + * @fw_vers: pointer to output version structure + * + * unsupported/not present features return 0 in version structure + **/ +void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) +{ + u16 eeprom_verh, eeprom_verl, etrack_test, fw_version; + u8 q, hval, rem, result; + u16 comb_verh, comb_verl, comb_offset; + + memset(fw_vers, 0, sizeof(struct e1000_fw_version)); + + /* basic eeprom version numbers, bits used vary by part and by tool + * used to create the nvm images */ + /* Check which data format we have */ + switch (hw->mac.type) { + case e1000_i211: + e1000_read_invm_version(hw, fw_vers); + return; + case e1000_82575: + case e1000_82576: + case e1000_82580: + case e1000_i354: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* Use this format, unless EETRACK ID exists, + * then use alternate format + */ + if ((etrack_test & NVM_MAJOR_MASK) != NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + fw_vers->eep_minor = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + fw_vers->eep_build = (fw_version & NVM_IMAGE_ID_MASK); + goto etrack_id; + } + break; + case e1000_i210: + if (!(e1000_get_flash_presence_i210(hw))) { + e1000_read_invm_version(hw, fw_vers); + return; + } + /* fall through */ + case e1000_i350: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + /* find combo image version */ + hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset); + if ((comb_offset != 0x0) && + (comb_offset != NVM_VER_INVALID)) { + + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset + + 1), 1, &comb_verh); + hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset), + 1, &comb_verl); + + /* get Option Rom version if it exists and is valid */ + if ((comb_verh && comb_verl) && + ((comb_verh != NVM_VER_INVALID) && + (comb_verl != NVM_VER_INVALID))) { + + fw_vers->or_valid = true; + fw_vers->or_major = + comb_verl >> NVM_COMB_VER_SHFT; + fw_vers->or_build = + (comb_verl << NVM_COMB_VER_SHFT) + | (comb_verh >> NVM_COMB_VER_SHFT); + fw_vers->or_patch = + comb_verh & NVM_COMB_VER_MASK; + } + } + break; + default: + hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); + return; + } + hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version); + fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) + >> NVM_MAJOR_SHIFT; + + /* check for old style version format in newer images*/ + if ((fw_version & NVM_NEW_DEC_MASK) == 0x0) { + eeprom_verl = (fw_version & NVM_COMB_VER_MASK); + } else { + eeprom_verl = (fw_version & NVM_MINOR_MASK) + >> NVM_MINOR_SHIFT; + } + /* Convert minor value to hex before assigning to output struct + * Val to be converted will not be higher than 99, per tool output + */ + q = eeprom_verl / NVM_HEX_CONV; + hval = q * NVM_HEX_TENS; + rem = eeprom_verl % NVM_HEX_CONV; + result = hval + rem; + fw_vers->eep_minor = result; + +etrack_id: + if ((etrack_test & NVM_MAJOR_MASK) == NVM_ETRACK_VALID) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verl); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verh); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) + | eeprom_verl; + } else if ((etrack_test & NVM_ETRACK_VALID) == 0) { + hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verh); + hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verl); + fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) | + eeprom_verl; + } +} + diff --git a/sys/dev/e1000/e1000_nvm.h b/sys/dev/e1000/e1000_nvm.h index fc7ceab17e32..86fd5d1e892f 100644 --- a/sys/dev/e1000/e1000_nvm.h +++ b/sys/dev/e1000/e1000_nvm.h @@ -41,6 +41,22 @@ struct e1000_pba { u16 *pba_block; }; +struct e1000_fw_version { + u32 etrack_id; + u16 eep_major; + u16 eep_minor; + u16 eep_build; + + u8 invm_major; + u8 invm_minor; + u8 invm_img_type; + + bool or_valid; + u16 or_major; + u16 or_build; + u16 or_patch; +}; + void e1000_init_nvm_ops_generic(struct e1000_hw *hw); s32 e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c); @@ -51,6 +67,7 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); +s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num); s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size); s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size); @@ -75,6 +92,8 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw); void e1000_stop_nvm(struct e1000_hw *hw); void e1000_release_nvm_generic(struct e1000_hw *hw); +void e1000_get_fw_version(struct e1000_hw *hw, + struct e1000_fw_version *fw_vers); #define E1000_STM_OPCODE 0xDB00 diff --git a/sys/dev/e1000/e1000_regs.h b/sys/dev/e1000/e1000_regs.h index c09856e55275..b3fb854f8adc 100644 --- a/sys/dev/e1000/e1000_regs.h +++ b/sys/dev/e1000/e1000_regs.h @@ -64,6 +64,7 @@ #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ #define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ +#define E1000_FEXTNVM5 0x00014 /* Future Extended NVM 5 - RW */ #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ #define E1000_FEXTNVM8 0x5BB0 /* Future Extended NVM 8 - RW */ @@ -634,7 +635,7 @@ /* ETQF register bit definitions */ #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_QUEUE_ENABLE (1U << 31) #define E1000_ETQF_QUEUE_SHIFT 16 #define E1000_ETQF_QUEUE_MASK 0x00070000 #define E1000_ETQF_ETYPE_MASK 0x0000FFFF From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0098966AE78; Fri, 17 Sep 2021 21:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k73TmJz4nZT; Fri, 17 Sep 2021 21:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED5AF1D5E2; Fri, 17 Sep 2021 21:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbY3U056345; Fri, 17 Sep 2021 21:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbYaw056344; Fri, 17 Sep 2021 21:37:34 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:34 GMT Message-Id: <202109172137.18HLbYaw056344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: ecf2a89a997a - main - e1000: fix multicast setting in VF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ecf2a89a997ad4a14339b6a2f544e44b422620a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:36 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ecf2a89a997ad4a14339b6a2f544e44b422620a0 commit ecf2a89a997ad4a14339b6a2f544e44b422620a0 Author: Yong Wang AuthorDate: 2017-02-21 09:33:23 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:24:44 +0000 e1000: fix multicast setting in VF In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW". And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST". Fix it by moving the second line prior to the first one that mentioned above. Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF") Cc: stable@dpdk.org Signed-off-by: Yong Wang Acked-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (f58ca2f9ef6) MFC after: 1 week --- sys/dev/e1000/e1000_vf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/e1000_vf.c b/sys/dev/e1000/e1000_vf.c index 653ba322a185..4b73bb9709c1 100644 --- a/sys/dev/e1000/e1000_vf.c +++ b/sys/dev/e1000/e1000_vf.c @@ -419,12 +419,13 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count); + msgbuf[0] = E1000_VF_SET_MULTICAST; + if (mc_addr_count > 30) { msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW; mc_addr_count = 30; } - msgbuf[0] = E1000_VF_SET_MULTICAST; msgbuf[0] |= mc_addr_count << E1000_VT_MSGINFO_SHIFT; for (i = 0; i < mc_addr_count; i++) { From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E28D66AEA3; Fri, 17 Sep 2021 21:37:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6k93Jpjz4nX8; Fri, 17 Sep 2021 21:37:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37CB11D788; Fri, 17 Sep 2021 21:37:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbbqt056397; Fri, 17 Sep 2021 21:37:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbbSx056396; Fri, 17 Sep 2021 21:37:37 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:37 GMT Message-Id: <202109172137.18HLbbSx056396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 40fa6e53f53c - main - e1000: prevent ULP flow if cable connected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:38 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=40fa6e53f53cde84f6f5c7330f89e4ae373d7d93 commit 40fa6e53f53cde84f6f5c7330f89e4ae373d7d93 Author: Wenzhuo Lu AuthorDate: 2015-10-16 02:51:03 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:25:38 +0000 e1000: prevent ULP flow if cable connected Enabling ulp on link down when cable is connect caused an infinite loop of linkup/down indications in the NDIS driver. After discussed, correct flow is to enable ULP only when cable is disconnected. Signed-off-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (4bff263d54d299269966365f9697941eecaa241b) MFC after: 1 week --- sys/dev/e1000/e1000_ich8lan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 635be03f2900..dd4e85d64aff 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -1307,6 +1307,10 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) (E1000_READ_REG(hw, E1000_FEXT) & E1000_FEXT_PHY_CABLE_DISCONNECTED) ? "" : "not", i * 50); + if (!(E1000_READ_REG(hw, E1000_FEXT) & + E1000_FEXT_PHY_CABLE_DISCONNECTED)) + return 0; + } ret_val = hw->phy.ops.acquire(hw); From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8360566B08F; Fri, 17 Sep 2021 21:37:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6kG0xptz4ndL; Fri, 17 Sep 2021 21:37:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6EE11D4E0; Fri, 17 Sep 2021 21:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbehu056471; Fri, 17 Sep 2021 21:37:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbet9056470; Fri, 17 Sep 2021 21:37:40 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:40 GMT Message-Id: <202109172137.18HLbet9056470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: e05d9788b7e9 - main - e1000: Consistently use FALLTHROUGH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e05d9788b7e90ffd6405dc59656b52a63ba7ff3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:42 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e05d9788b7e90ffd6405dc59656b52a63ba7ff3e commit e05d9788b7e90ffd6405dc59656b52a63ba7ff3e Author: Kevin Bowling AuthorDate: 2021-09-17 03:13:26 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:36:46 +0000 e1000: Consistently use FALLTHROUGH Approved by: imp MFC after: 1 week --- sys/dev/e1000/e1000_82540.c | 2 +- sys/dev/e1000/e1000_82571.c | 4 ++-- sys/dev/e1000/e1000_82575.c | 6 ++++++ sys/dev/e1000/e1000_ich8lan.c | 16 ++++++++-------- sys/dev/e1000/e1000_nvm.c | 2 +- sys/dev/e1000/e1000_phy.c | 6 +++++- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/sys/dev/e1000/e1000_82540.c b/sys/dev/e1000/e1000_82540.c index 720798260f8a..e60fc8ebf08e 100644 --- a/sys/dev/e1000/e1000_82540.c +++ b/sys/dev/e1000/e1000_82540.c @@ -100,7 +100,7 @@ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) case e1000_82546_rev_3: if (phy->id == M88E1011_I_PHY_ID) break; - /* Fall Through */ + /* FALLTHROUGH */ default: ret_val = -E1000_ERR_PHY; goto out; diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index cae9afcb2d78..ce9ae8791654 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -238,7 +238,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_EECD, eecd); break; } - /* Fall Through */ + /* FALLTHROUGH */ default: nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> @@ -1115,7 +1115,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw) switch (mac->type) { case e1000_82573: e1000_enable_tx_pkt_filtering_generic(hw); - /* fall through */ + /* FALLTHROUGH */ case e1000_82574: case e1000_82583: reg_data = E1000_READ_REG(hw, E1000_GCR); diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 59d8b9c85dc3..a0c057e5f07f 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -1443,13 +1443,19 @@ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) } switch (hw->phy.type) { case e1000_phy_i210: + /* FALLTHROUGH */ case e1000_phy_m88: switch (hw->phy.id) { case I347AT4_E_PHY_ID: + /* FALLTHROUGH */ case M88E1112_E_PHY_ID: + /* FALLTHROUGH */ case M88E1340M_E_PHY_ID: + /* FALLTHROUGH */ case M88E1543_E_PHY_ID: + /* FALLTHROUGH */ case M88E1512_E_PHY_ID: + /* FALLTHROUGH */ case I210_I_PHY_ID: ret_val = e1000_copper_link_setup_m88_gen2(hw); break; diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index 5cd13579d50c..4209595a911c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -365,12 +365,12 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) */ msec_delay(50); - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: if (e1000_phy_is_accessible_pchlan(hw)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: if ((hw->mac.type == e1000_pchlan) && (fwsm & E1000_ICH_FWSM_FW_VALID)) @@ -493,7 +493,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) return ret_val; if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK)) break; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: @@ -796,7 +796,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) case e1000_pch2lan: mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES; mac->ops.rar_set = e1000_rar_set_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pch_lpt: case e1000_pch_spt: case e1000_pch_cnp: @@ -806,7 +806,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; - /* fall-through */ + /* FALLTHROUGH */ case e1000_pchlan: /* check management mode */ mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan; @@ -1761,7 +1761,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) ret_val = e1000_k1_workaround_lv(hw); if (ret_val) return ret_val; - /* fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: if (hw->phy.type == e1000_phy_82578) { ret_val = e1000_link_stall_workaround_hv(hw); @@ -2299,7 +2299,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; break; } - /* Fall-thru */ + /* FALLTHROUGH */ case e1000_pchlan: case e1000_pch2lan: case e1000_pch_lpt: @@ -3479,7 +3479,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct e1000_hw *hw, u32 *bank) return E1000_SUCCESS; } DEBUGOUT("Unable to determine valid NVM bank via EEC - reading flash signature\n"); - /* fall-thru */ + /* FALLTHROUGH */ default: /* set bank to 0 in case flash read fails */ *bank = 0; diff --git a/sys/dev/e1000/e1000_nvm.c b/sys/dev/e1000/e1000_nvm.c index 31bbfcc6981d..8911204f0b91 100644 --- a/sys/dev/e1000/e1000_nvm.c +++ b/sys/dev/e1000/e1000_nvm.c @@ -1321,7 +1321,7 @@ void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers) e1000_read_invm_version(hw, fw_vers); return; } - /* fall through */ + /* FALLTHROUGH */ case e1000_i350: hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test); /* find combo image version */ diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index e5fd942464b6..872a5267bfdb 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1038,7 +1038,7 @@ static s32 e1000_set_master_slave_mode(struct e1000_hw *hw) break; case e1000_ms_auto: phy_data &= ~CR_1000T_MS_ENABLE; - /* fall-through */ + /* FALLTHROUGH */ default: break; } @@ -1098,6 +1098,7 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) phy_data |= I82577_PHY_CTRL2_MANUAL_MDIX; break; case 0: + /* FALLTHROUGH */ default: phy_data |= I82577_PHY_CTRL2_AUTO_MDI_MDIX; break; @@ -1154,6 +1155,7 @@ s32 e1000_copper_link_setup_m88(struct e1000_hw *hw) phy_data |= M88E1000_PSCR_AUTO_X_1000T; break; case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1306,6 +1308,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw *hw) } /* FALLTHROUGH */ case 0: + /* FALLTHROUGH */ default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; break; @@ -1420,6 +1423,7 @@ s32 e1000_copper_link_setup_igp(struct e1000_hw *hw) data |= IGP01E1000_PSCR_FORCE_MDI_MDIX; break; case 0: + /* FALLTHROUGH */ default: data |= IGP01E1000_PSCR_AUTO_MDIX; break; From owner-dev-commits-src-main@freebsd.org Fri Sep 17 21:37:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C4C266AF35; Fri, 17 Sep 2021 21:37:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB6kD2Jgcz4nnd; Fri, 17 Sep 2021 21:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C69D1D78A; Fri, 17 Sep 2021 21:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HLbdUx056447; Fri, 17 Sep 2021 21:37:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HLbdpT056446; Fri, 17 Sep 2021 21:37:39 GMT (envelope-from git) Date: Fri, 17 Sep 2021 21:37:39 GMT Message-Id: <202109172137.18HLbdpT056446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 1bbdc25fc1ed - main - e1000: Use C99 bool types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1bbdc25fc1edb43562bf2a5f30df7381078991d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 21:37:41 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1bbdc25fc1edb43562bf2a5f30df7381078991d4 commit 1bbdc25fc1edb43562bf2a5f30df7381078991d4 Author: Kevin Bowling AuthorDate: 2021-09-17 03:08:08 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 21:29:12 +0000 e1000: Use C99 bool types Approved by: imp MFC after: 1 week --- sys/dev/e1000/e1000_80003es2lan.c | 12 +++--- sys/dev/e1000/e1000_82541.c | 10 ++--- sys/dev/e1000/e1000_82543.c | 22 +++++------ sys/dev/e1000/e1000_82571.c | 60 ++++++++++++++--------------- sys/dev/e1000/e1000_82575.c | 58 ++++++++++++++-------------- sys/dev/e1000/e1000_api.c | 12 +++--- sys/dev/e1000/e1000_api.h | 4 +- sys/dev/e1000/e1000_hw.h | 2 +- sys/dev/e1000/e1000_i210.c | 4 +- sys/dev/e1000/e1000_ich8lan.c | 78 +++++++++++++++++++------------------- sys/dev/e1000/e1000_mac.c | 62 +++++++++++++++--------------- sys/dev/e1000/e1000_manage.c | 28 +++++++------- sys/dev/e1000/e1000_mbx.c | 2 +- sys/dev/e1000/e1000_mbx.h | 2 +- sys/dev/e1000/e1000_osdep.h | 2 - sys/dev/e1000/e1000_phy.c | 80 +++++++++++++++++++-------------------- sys/dev/e1000/e1000_vf.c | 14 +++---- sys/dev/e1000/e1000_vf.h | 2 +- sys/dev/e1000/em_txrx.c | 12 +++--- sys/dev/e1000/if_em.c | 46 +++++++++++----------- sys/dev/e1000/igb_txrx.c | 2 +- 21 files changed, 256 insertions(+), 258 deletions(-) diff --git a/sys/dev/e1000/e1000_80003es2lan.c b/sys/dev/e1000/e1000_80003es2lan.c index db6f1aeb65fb..ac35b4eabf28 100644 --- a/sys/dev/e1000/e1000_80003es2lan.c +++ b/sys/dev/e1000/e1000_80003es2lan.c @@ -219,14 +219,14 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); /* Adaptive IFS not supported */ - mac->adaptive_ifs = FALSE; + mac->adaptive_ifs = false; /* Function pointers */ @@ -891,8 +891,8 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) reg_data &= ~0x00100000; E1000_WRITE_REG_ARRAY(hw, E1000_FFLT, 0x0001, reg_data); - /* default to TRUE to enable the MDIC W/A */ - hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; + /* default to true to enable the MDIC W/A */ + hw->dev_spec._80003es2lan.mdic_wa_enable = true; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET >> @@ -900,7 +900,7 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) - hw->dev_spec._80003es2lan.mdic_wa_enable = FALSE; + hw->dev_spec._80003es2lan.mdic_wa_enable = false; } /* Clear all of the statistics registers (clear on read). It is diff --git a/sys/dev/e1000/e1000_82541.c b/sys/dev/e1000/e1000_82541.c index aaa3de7f02ce..7bb2e8ea9449 100644 --- a/sys/dev/e1000/e1000_82541.c +++ b/sys/dev/e1000/e1000_82541.c @@ -230,7 +230,7 @@ static s32 e1000_init_mac_params_82541(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Function Pointers */ @@ -611,11 +611,11 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; if (!link) { - ret_val = e1000_config_dsp_after_link_change_82541(hw, FALSE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, false); goto out; /* No link detected */ } - mac->get_link_status = FALSE; + mac->get_link_status = false; /* * Check if there was DownShift, must be checked @@ -632,7 +632,7 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw) goto out; } - ret_val = e1000_config_dsp_after_link_change_82541(hw, TRUE); + ret_val = e1000_config_dsp_after_link_change_82541(hw, true); /* * Auto-Neg is enabled. Auto Speed Detection takes care @@ -937,7 +937,7 @@ out: * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_82543.c b/sys/dev/e1000/e1000_82543.c index 49049b8646cd..9a93090c2d33 100644 --- a/sys/dev/e1000/e1000_82543.c +++ b/sys/dev/e1000/e1000_82543.c @@ -256,7 +256,7 @@ static s32 e1000_init_mac_params_82543(struct e1000_hw *hw) /* Set tbi compatibility */ if ((hw->mac.type != e1000_82543) || (hw->phy.media_type == e1000_media_type_fiber)) - e1000_set_tbi_compatibility_82543(hw, FALSE); + e1000_set_tbi_compatibility_82543(hw, false); return E1000_SUCCESS; } @@ -286,7 +286,7 @@ void e1000_init_function_pointers_82543(struct e1000_hw *hw) static bool e1000_tbi_compatibility_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_compatibility_enabled_82543"); @@ -338,7 +338,7 @@ out: bool e1000_tbi_sbp_enabled_82543(struct e1000_hw *hw) { struct e1000_dev_spec_82543 *dev_spec = &hw->dev_spec._82543; - bool state = FALSE; + bool state = false; DEBUGFUNC("e1000_tbi_sbp_enabled_82543"); @@ -379,7 +379,7 @@ static void e1000_set_tbi_sbp_82543(struct e1000_hw *hw, bool state) * @hw: pointer to the HW structure * * Returns the current status of whether PHY initialization is disabled. - * True if PHY initialization is disabled else FALSE. + * True if PHY initialization is disabled else false. **/ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) { @@ -389,7 +389,7 @@ static bool e1000_init_phy_disabled_82543(struct e1000_hw *hw) DEBUGFUNC("e1000_init_phy_disabled_82543"); if (hw->mac.type != e1000_82543) { - ret_val = FALSE; + ret_val = false; goto out; } @@ -913,7 +913,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); E1000_WRITE_FLUSH(hw); - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); /* * Delay to allow any outstanding PCI transactions to complete before @@ -1217,7 +1217,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) if (!link) goto out; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; e1000_check_downshift_generic(hw); @@ -1299,7 +1299,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * If we previously were in the mode, * turn it off. */ - e1000_set_tbi_sbp_82543(hw, FALSE); + e1000_set_tbi_sbp_82543(hw, false); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl &= ~E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1313,7 +1313,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw) * will look like CRC errors to the hardware. */ if (!e1000_tbi_sbp_enabled_82543(hw)) { - e1000_set_tbi_sbp_82543(hw, TRUE); + e1000_set_tbi_sbp_82543(hw, true); rctl = E1000_READ_REG(hw, E1000_RCTL); rctl |= E1000_RCTL_SBP; E1000_WRITE_REG(hw, E1000_RCTL, rctl); @@ -1356,7 +1356,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) (!(status & E1000_STATUS_LU)) && (!(rxcw & E1000_RXCW_C))) { if (!mac->autoneg_failed) { - mac->autoneg_failed = TRUE; + mac->autoneg_failed = true; ret_val = 0; goto out; } @@ -1387,7 +1387,7 @@ static s32 e1000_check_for_fiber_link_82543(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw); E1000_WRITE_REG(hw, E1000_CTRL, (ctrl & ~E1000_CTRL_SLU)); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } out: diff --git a/sys/dev/e1000/e1000_82571.c b/sys/dev/e1000/e1000_82571.c index 8db1fcb921a9..cae9afcb2d78 100644 --- a/sys/dev/e1000/e1000_82571.c +++ b/sys/dev/e1000/e1000_82571.c @@ -285,7 +285,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) struct e1000_mac_info *mac = &hw->mac; u32 swsm = 0; u32 swsm2 = 0; - bool force_clear_smbi = FALSE; + bool force_clear_smbi = false; DEBUGFUNC("e1000_init_mac_params_82571"); @@ -327,9 +327,9 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -369,7 +369,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are * enabled. */ @@ -388,7 +388,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) mac->ops.blink_led = e1000_blink_led_generic; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; break; } @@ -407,13 +407,13 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw) /* Only do this for the first interface on this card */ E1000_WRITE_REG(hw, E1000_SWSM2, swsm2 | E1000_SWSM2_LOCK); - force_clear_smbi = TRUE; + force_clear_smbi = true; } else { - force_clear_smbi = FALSE; + force_clear_smbi = false; } break; default: - force_clear_smbi = TRUE; + force_clear_smbi = true; break; } @@ -563,7 +563,7 @@ e1000_put_hw_semaphore_82574(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82574 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. * LPLU will not be activated unless the @@ -593,7 +593,7 @@ static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw, bool active) * @active: boolean used to enable/disable lplu * * The low power link up (lplu) state is set to the power management level D3 - * when active is TRUE, else clear lplu for D3. LPLU + * when active is true, else clear lplu for D3. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is * maintained. @@ -860,7 +860,7 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When activating LPLU * this function also disables smart speed and vice versa. LPLU will not be @@ -1051,7 +1051,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) if (ret_val) return ret_val; - e1000_set_laa_state_82571(hw, TRUE); + e1000_set_laa_state_82571(hw, true); } /* Reinitialize the 82571 serdes link state machine */ @@ -1327,8 +1327,8 @@ static void e1000_clear_vfta_82571(struct e1000_hw *hw) * e1000_check_mng_mode_82574 - Check manageability is enabled * @hw: pointer to the HW structure * - * Reads the NVM Initialization Control Word 2 and returns TRUE - * (>0) if any manageability is enabled, else FALSE (0). + * Reads the NVM Initialization Control Word 2 and returns true + * (>0) if any manageability is enabled, else false (0). **/ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) { @@ -1339,7 +1339,7 @@ static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &data); if (ret_val) - return FALSE; + return false; return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; } @@ -1392,18 +1392,18 @@ bool e1000_check_phy_82574(struct e1000_hw *hw) ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER, &receive_errors); if (ret_val) - return FALSE; + return false; if (receive_errors == E1000_RECEIVE_ERROR_MAX) { ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS, &status_1kbt); if (ret_val) - return FALSE; + return false; if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) == E1000_IDLE_ERROR_COUNT_MASK) - return TRUE; + return true; } - return FALSE; + return false; } @@ -1556,10 +1556,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) */ mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("AN_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1576,10 +1576,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) (ctrl & ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("FORCED_UP -> AN_PROG\n"); } else { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } break; @@ -1593,7 +1593,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) mac->serdes_link_state = e1000_serdes_link_autoneg_complete; DEBUGOUT("AN_PROG -> AN_UP\n"); - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; } else { /* Autoneg completed, but failed. */ mac->serdes_link_state = @@ -1619,7 +1619,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) } mac->serdes_link_state = e1000_serdes_link_forced_up; - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; DEBUGOUT("AN_PROG -> FORCED_UP\n"); } break; @@ -1635,13 +1635,13 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("DOWN -> AN_PROG\n"); break; } } else { if (!(rxcw & E1000_RXCW_SYNCH)) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); } else { @@ -1657,7 +1657,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) continue; if (rxcw & E1000_RXCW_IV) { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; mac->serdes_link_state = e1000_serdes_link_down; DEBUGOUT("ANYSTATE -> DOWN\n"); @@ -1671,7 +1671,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) E1000_WRITE_REG(hw, E1000_TXCW, txcw); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; DEBUGOUT("ANYSTATE -> AN_PROG\n"); } } @@ -1728,7 +1728,7 @@ bool e1000_get_laa_state_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_get_laa_state_82571"); if (hw->mac.type != e1000_82571) - return FALSE; + return false; return hw->dev_spec._82571.laa_is_present; } diff --git a/sys/dev/e1000/e1000_82575.c b/sys/dev/e1000/e1000_82575.c index 29805270f8dc..59d8b9c85dc3 100644 --- a/sys/dev/e1000/e1000_82575.c +++ b/sys/dev/e1000/e1000_82575.c @@ -128,7 +128,7 @@ static const u16 e1000_82580_rxpbs_table[] = { static bool e1000_sgmii_uses_mdio_82575(struct e1000_hw *hw) { u32 reg = 0; - bool ext_mdio = FALSE; + bool ext_mdio = false; DEBUGFUNC("e1000_sgmii_uses_mdio_82575"); @@ -348,16 +348,16 @@ static s32 e1000_init_mac_params_82575(struct e1000_hw *hw) /* Enable EEE default settings for EEE supported devices */ if (mac->type >= e1000_i350) - dev_spec->eee_disable = FALSE; + dev_spec->eee_disable = false; /* Allow a single clear of the SW semaphore on I210 and newer */ if (mac->type >= e1000_i210) - dev_spec->clear_semaphore_once = TRUE; + dev_spec->clear_semaphore_once = true; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC supported; valid only if manageability features are enabled. */ mac->arc_subsystem_valid = !!(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK); @@ -716,7 +716,7 @@ static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) DEBUGFUNC("e1000_phy_hw_reset_sgmii_82575"); /* - * This isn't a TRUE "hard" reset, but is the only reset + * This isn't a true "hard" reset, but is the only reset * available to us at this time. */ @@ -746,7 +746,7 @@ out: /** * e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -832,7 +832,7 @@ out: /** * e1000_set_d0_lplu_state_82580 - Set Low Power Linkup D0 state * @hw: pointer to the HW structure - * @active: TRUE to enable LPLU, FALSE to disable + * @active: true to enable LPLU, false to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -883,7 +883,7 @@ static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1139,7 +1139,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw) /* Determine if a swap needs to happen. */ if (port && (hw->dev_spec._82575.media_port != port)) { hw->dev_spec._82575.media_port = port; - hw->dev_spec._82575.media_changed = TRUE; + hw->dev_spec._82575.media_changed = true; } if (port == E1000_MEDIA_PORT_COPPER) { @@ -1217,7 +1217,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, * The link up bit determines when link is up on autoneg. */ if (pcs & E1000_PCS_LSTS_LINK_OK) { - mac->serdes_has_link = TRUE; + mac->serdes_has_link = true; /* Detect and store PCS speed */ if (pcs & E1000_PCS_LSTS_SPEED_1000) @@ -1246,7 +1246,7 @@ static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, } } else { - mac->serdes_has_link = FALSE; + mac->serdes_has_link = false; *speed = 0; *duplex = 0; } @@ -1527,13 +1527,13 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { case E1000_CTRL_EXT_LINK_MODE_SGMII: /* sgmii mode lets the phy handle forcing speed/duplex */ - pcs_autoneg = TRUE; + pcs_autoneg = true; /* autoneg time out should be disabled for SGMII mode */ reg &= ~(E1000_PCS_LCTL_AN_TIMEOUT); break; case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ - pcs_autoneg = FALSE; + pcs_autoneg = false; /* FALLTHROUGH */ default: if (hw->mac.type == e1000_82575 || @@ -1545,7 +1545,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_hw *hw) } if (data & E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT) - pcs_autoneg = FALSE; + pcs_autoneg = false; } /* @@ -1637,8 +1637,8 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) u32 link_mode = 0; /* Set internal phy as default */ - dev_spec->sgmii_active = FALSE; - dev_spec->module_plugged = FALSE; + dev_spec->sgmii_active = false; + dev_spec->module_plugged = false; /* Get CSR setting */ ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -1657,7 +1657,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) /* Get phy control interface type set (MDIO vs. I2C)*/ if (e1000_sgmii_uses_mdio_82575(hw)) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; break; } /* fall through for I2C based SGMII */ @@ -1675,7 +1675,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw *hw) if (link_mode == E1000_CTRL_EXT_LINK_MODE_SGMII) { hw->phy.media_type = e1000_media_type_copper; - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; } break; @@ -1746,14 +1746,14 @@ static s32 e1000_set_sfp_media_type_82575(struct e1000_hw *hw) /* Check if there is some SFP module plugged and powered */ if ((tranceiver_type == E1000_SFF_IDENTIFIER_SFP) || (tranceiver_type == E1000_SFF_IDENTIFIER_SFF)) { - dev_spec->module_plugged = TRUE; + dev_spec->module_plugged = true; if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e100_base_fx) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_internal_serdes; } else if (eth_flags->e1000_base_t) { - dev_spec->sgmii_active = TRUE; + dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_copper; } else { hw->phy.media_type = e1000_media_type_unknown; @@ -2224,11 +2224,11 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) DEBUGFUNC("e1000_reset_hw_82580"); - hw->dev_spec._82575.global_device_reset = FALSE; + hw->dev_spec._82575.global_device_reset = false; /* 82580 does not reliably do global_device_reset due to hw errata */ if (hw->mac.type == e1000_82580) - global_device_reset = FALSE; + global_device_reset = false; /* Get current control state. */ ctrl = E1000_READ_REG(hw, E1000_CTRL); @@ -2252,7 +2252,7 @@ static s32 e1000_reset_hw_82580(struct e1000_hw *hw) /* Determine whether or not a global dev reset is requested */ if (global_device_reset && hw->mac.ops.acquire_swfw_sync(hw, swmbsw_mask)) - global_device_reset = FALSE; + global_device_reset = false; if (global_device_reset && !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STAT_DEV_RST_SET)) @@ -2572,7 +2572,7 @@ s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg"); - return __e1000_access_emi_reg(hw, addr, data, TRUE); + return __e1000_access_emi_reg(hw, addr, data, true); } /** @@ -2930,7 +2930,7 @@ s32 e1000_get_eee_status_i354(struct e1000_hw *hw, bool *status) goto out; *status = phy_data & (E1000_PCS_STATUS_TX_LPI_RCVD | - E1000_PCS_STATUS_RX_LPI_RCVD) ? TRUE : FALSE; + E1000_PCS_STATUS_RX_LPI_RCVD) ? true : false; out: return ret_val; @@ -3032,7 +3032,7 @@ s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset, u32 retry = 1; u16 swfw_mask = 0; - bool nack = TRUE; + bool nack = true; DEBUGFUNC("e1000_read_i2c_byte_generic"); @@ -3299,7 +3299,7 @@ static s32 e1000_get_i2c_ack(struct e1000_hw *hw) u32 i = 0; u32 i2cctl = E1000_READ_REG(hw, E1000_I2CPARAMS); u32 timeout = 10; - bool ack = TRUE; + bool ack = true; DEBUGFUNC("e1000_get_i2c_ack"); diff --git a/sys/dev/e1000/e1000_api.c b/sys/dev/e1000/e1000_api.c index b28ab77f3794..5c778a48bba0 100644 --- a/sys/dev/e1000/e1000_api.c +++ b/sys/dev/e1000/e1000_api.c @@ -421,10 +421,10 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) /** * e1000_setup_init_funcs - Initializes function pointers * @hw: pointer to the HW structure - * @init_device: TRUE will initialize the rest of the function pointers - * getting the device ready for use. FALSE will only set + * @init_device: true will initialize the rest of the function pointers + * getting the device ready for use. false will only set * MAC type and the function pointers for the other init - * functions. Passing FALSE will not generate any hardware + * functions. Passing false will not generate any hardware * reads or writes. * * This function must be called by a driver in order to use the rest @@ -656,7 +656,7 @@ bool e1000_check_mng_mode(struct e1000_hw *hw) if (hw->mac.ops.check_mng_mode) return hw->mac.ops.check_mng_mode(hw); - return FALSE; + return false; } /** @@ -1186,7 +1186,7 @@ s32 e1000_phy_commit(struct e1000_hw *hw) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D0 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D0 + * and SmartSpeed is disabled when active is true, else clear lplu for D0 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is @@ -1208,7 +1208,7 @@ s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active) * Success returns 0, Failure returns 1 * * The low power link up (lplu) state is set to the power management level D3 - * and SmartSpeed is disabled when active is TRUE, else clear lplu for D3 + * and SmartSpeed is disabled when active is true, else clear lplu for D3 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU * is used during Dx states where the power conservation is most important. * During driver activity, SmartSpeed should be enabled so performance is diff --git a/sys/dev/e1000/e1000_api.h b/sys/dev/e1000/e1000_api.h index c96030b567db..48cf33213043 100644 --- a/sys/dev/e1000/e1000_api.h +++ b/sys/dev/e1000/e1000_api.h @@ -140,11 +140,11 @@ u32 e1000_translate_register_82542(u32 reg); * Typical use: * ... * if (TBI_ACCEPT) { - * accept_frame = TRUE; + * accept_frame = true; * e1000_tbi_adjust_stats(adapter, MacAddress); * frame_length--; * } else { - * accept_frame = FALSE; + * accept_frame = false; * } * ... */ diff --git a/sys/dev/e1000/e1000_hw.h b/sys/dev/e1000/e1000_hw.h index 90bc652861b5..6ee252e147a4 100644 --- a/sys/dev/e1000/e1000_hw.h +++ b/sys/dev/e1000/e1000_hw.h @@ -275,7 +275,7 @@ enum e1000_mac_type { e1000_i211, e1000_vfadapt, e1000_vfadapt_i350, - e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ + e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ }; enum e1000_media_type { diff --git a/sys/dev/e1000/e1000_i210.c b/sys/dev/e1000/e1000_i210.c index 0d810fecf3bd..da2e786130c8 100644 --- a/sys/dev/e1000/e1000_i210.c +++ b/sys/dev/e1000/e1000_i210.c @@ -552,14 +552,14 @@ out: bool e1000_get_flash_presence_i210(struct e1000_hw *hw) { u32 eec = 0; - bool ret_val = FALSE; + bool ret_val = false; DEBUGFUNC("e1000_get_flash_presence_i210"); eec = E1000_READ_REG(hw, E1000_EECD); if (eec & E1000_EECD_FLASH_DETECTED_I210) - ret_val = TRUE; + ret_val = true; return ret_val; } diff --git a/sys/dev/e1000/e1000_ich8lan.c b/sys/dev/e1000/e1000_ich8lan.c index dd4e85d64aff..5cd13579d50c 100644 --- a/sys/dev/e1000/e1000_ich8lan.c +++ b/sys/dev/e1000/e1000_ich8lan.c @@ -242,7 +242,7 @@ static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) } if (ret_val) - return FALSE; + return false; out: if (hw->mac.type >= e1000_pch_lpt) { /* Only unforce SMBus if ME is not active */ @@ -260,7 +260,7 @@ out: } } - return TRUE; + return true; } /** @@ -324,7 +324,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1000_hw *hw) /* Gate automatic PHY configuration by hardware on managed and * non-managed 82579 and newer adapters. */ - e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + e1000_gate_hw_phy_config_ich8lan(hw, true); /* It is not possible to be certain of the current state of ULP * so forcibly disable it. @@ -439,7 +439,7 @@ out: if ((hw->mac.type == e1000_pch2lan) && !(fwsm & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } return ret_val; @@ -699,7 +699,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) /* Clear shadow ram */ for (i = 0; i < nvm->word_size; i++) { - dev_spec->shadow_ram[i].modified = FALSE; + dev_spec->shadow_ram[i].modified = false; dev_spec->shadow_ram[i].value = 0xFFFF; } @@ -743,13 +743,13 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) if (mac->type == e1000_ich8lan) mac->rar_entry_count--; /* Set if part includes ASF firmware */ - mac->asf_firmware_present = TRUE; + mac->asf_firmware_present = true; /* FWSM register */ - mac->has_fwsm = TRUE; + mac->has_fwsm = true; /* ARC subsystem not supported */ - mac->arc_subsystem_valid = FALSE; + mac->arc_subsystem_valid = false; /* Adaptive IFS supported */ - mac->adaptive_ifs = TRUE; + mac->adaptive_ifs = true; /* Function pointers */ @@ -833,7 +833,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_hw *hw) /* Enable PCS Lock-loss workaround for ICH8 */ if (mac->type == e1000_ich8lan) - e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE); + e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, true); return E1000_SUCCESS; } @@ -880,7 +880,7 @@ s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, data, TRUE); + return __e1000_access_emi_reg_locked(hw, addr, data, true); } /** @@ -895,7 +895,7 @@ s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data) { DEBUGFUNC("e1000_read_emi_reg_locked"); - return __e1000_access_emi_reg_locked(hw, addr, &data, FALSE); + return __e1000_access_emi_reg_locked(hw, addr, &data, false); } /** @@ -1112,7 +1112,7 @@ static u64 e1000_ltr2ns(u16 ltr) * GbE MAC in the Lynx Point PCH based on Rx buffer size and link speed * when link is up (which must not exceed the maximum latency supported * by the platform), otherwise specify there is no LTR requirement. - * Unlike TRUE-PCIe devices which set the LTR maximum snoop/no-snoop + * Unlike true-PCIe devices which set the LTR maximum snoop/no-snoop * latencies in the LTR Extended Capability Structure in the PCIe Extended * Capability register set, on this device LTR is set by writing the * equivalent snoop/no-snoop latencies in the LTRV register in the MAC and @@ -1410,8 +1410,8 @@ out: * If not on an ME enabled system, un-configure the ULP mode by software. * * During nominal operation, this function is called when link is acquired - * to disable ULP mode (force=FALSE); otherwise, for example when unloading - * the driver or during Sx->S0 transitions, this is called with force=TRUE + * to disable ULP mode (force=false); otherwise, for example when unloading + * the driver or during Sx->S0 transitions, this is called with force=true * to forcibly disable ULP. */ s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force) @@ -1745,7 +1745,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; } - if (hw->dev_spec.ich8lan.disable_k1_off == TRUE) + if (hw->dev_spec.ich8lan.disable_k1_off == true) fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE; E1000_WRITE_REG(hw, E1000_FEXTNVM6, fextnvm6); @@ -1754,7 +1754,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) if (!link) return E1000_SUCCESS; /* No link detected */ - mac->get_link_status = FALSE; + mac->get_link_status = false; switch (hw->mac.type) { case e1000_pch2lan: @@ -2209,7 +2209,7 @@ release: static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) { u32 fwsm; - bool blocked = FALSE; + bool blocked = false; int i = 0; DEBUGFUNC("e1000_check_reset_block_ich8lan"); @@ -2217,11 +2217,11 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) do { fwsm = E1000_READ_REG(hw, E1000_FWSM); if (!(fwsm & E1000_ICH_FWSM_RSPCIPHY)) { - blocked = TRUE; + blocked = true; msec_delay(10); continue; } - blocked = FALSE; + blocked = false; } while (blocked && (i++ < 30)); return blocked ? E1000_BLK_PHY_RESET : E1000_SUCCESS; } @@ -2435,7 +2435,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (BM_CS_STATUS_LINK_UP | BM_CS_STATUS_RESOLVED | BM_CS_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } if (hw->phy.type == e1000_phy_82577) { @@ -2451,7 +2451,7 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link) if (status_reg == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE | HV_M_STATUS_SPEED_1000)) - k1_enable = FALSE; + k1_enable = false; } /* Link stall fix for link up */ @@ -2688,7 +2688,7 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) /* Configure the K1 Si workaround during phy reset assuming there is * link so that it disables K1 if link is in 1Gbps. */ - ret_val = e1000_k1_gig_workaround_hv(hw, TRUE); + ret_val = e1000_k1_gig_workaround_hv(hw, true); if (ret_val) return ret_val; @@ -3033,7 +3033,7 @@ static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) /** * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware * @hw: pointer to the HW structure - * @gate: boolean set to TRUE to gate, FALSE to ungate + * @gate: boolean set to true to gate, false to ungate * * Gate/ungate the automatic PHY configuration via hardware; perform * the configuration via software instead. @@ -3136,14 +3136,14 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) return ret_val; /* Configure the LCD with the OEM bits in NVM */ - ret_val = e1000_oem_bits_config_ich8lan(hw, TRUE); + ret_val = e1000_oem_bits_config_ich8lan(hw, true); if (hw->mac.type == e1000_pch2lan) { /* Ungate automatic PHY configuration on non-managed 82579 */ if (!(E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID)) { msec_delay(10); - e1000_gate_hw_phy_config_ich8lan(hw, FALSE); + e1000_gate_hw_phy_config_ich8lan(hw, false); } /* Set EEE LPI Update Timer to 200usec */ *** 1089 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Sep 17 22:13:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA8AF66BC51; Fri, 17 Sep 2021 22:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB7Ws5c9Dz3Dw6; Fri, 17 Sep 2021 22:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A213D1DD71; Fri, 17 Sep 2021 22:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HMDjYY010022; Fri, 17 Sep 2021 22:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HMDjpL010021; Fri, 17 Sep 2021 22:13:45 GMT (envelope-from git) Date: Fri, 17 Sep 2021 22:13:45 GMT Message-Id: <202109172213.18HMDjpL010021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4b977e6dda92 - main - nvme/nda: Fail all nvme I/Os after controller fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b977e6dda92fe093ea300f1a91dbcf877b64fa0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 22:13:46 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4b977e6dda92fe093ea300f1a91dbcf877b64fa0 commit 4b977e6dda92fe093ea300f1a91dbcf877b64fa0 Author: Warner Losh AuthorDate: 2021-09-17 20:56:58 +0000 Commit: Warner Losh CommitDate: 2021-09-17 22:09:21 +0000 nvme/nda: Fail all nvme I/Os after controller fails Once the controller has failed, fail all I/O w/o sending it to the device. The reset of the nvme driver won't schedule any I/O to the failed device, and the controller is in an indeterminate state and can't accept I/O. Fail both at the top end of the sim and the bottom end. Don't bother queueing up the I/O for failure in a different task. Reviewed by: chuck Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31341 --- sys/dev/nvme/nvme_qpair.c | 8 +++----- sys/dev/nvme/nvme_sim.c | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index eea87e299d3d..71718acff66f 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -1078,12 +1078,10 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) if (qpair->ctrlr->is_failed) { /* - * The controller has failed. Post the request to a - * task where it will be aborted, so that we do not - * invoke the request's callback in the context - * of the submission. + * The controller has failed, so fail the request. */ - nvme_ctrlr_post_failed_request(qpair->ctrlr, req); + nvme_qpair_manual_complete_request(qpair, req, + NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST); } else { /* * Put the request on the qpair's request queue to be diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index efec8d34868a..06e645ebdf90 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -258,6 +258,10 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) break; case XPT_NVME_IO: /* Execute the requested I/O operation */ case XPT_NVME_ADMIN: /* or Admin operation */ + if (ctrlr->is_failed) { + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + break; + } nvme_sim_nvmeio(sim, ccb); return; /* no done */ default: From owner-dev-commits-src-main@freebsd.org Fri Sep 17 23:07:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5851366CD85; Fri, 17 Sep 2021 23:07:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HB8kK1mSkz3hS4; Fri, 17 Sep 2021 23:07:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1835B1EBD0; Fri, 17 Sep 2021 23:07:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18HN7qc5076218; Fri, 17 Sep 2021 23:07:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18HN7q26076217; Fri, 17 Sep 2021 23:07:52 GMT (envelope-from git) Date: Fri, 17 Sep 2021 23:07:52 GMT Message-Id: <202109172307.18HN7q26076217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 007c2463d6d0 - main - calendar.freebsd: Fix off-by-one error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 007c2463d6d017ad5321d5cd2bc500e577d22196 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 23:07:53 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=007c2463d6d017ad5321d5cd2bc500e577d22196 commit 007c2463d6d017ad5321d5cd2bc500e577d22196 Author: Kevin Bowling AuthorDate: 2021-09-17 23:05:27 +0000 Commit: Kevin Bowling CommitDate: 2021-09-17 23:07:23 +0000 calendar.freebsd: Fix off-by-one error --- usr.bin/calendar/calendars/calendar.freebsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index c813f99b3664..10c361fac8da 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -96,8 +96,8 @@ 02/23 Vinícius Zavam born in Fortaleza, Ceará, Brazil, 1986 02/24 Johan Karlsson born in Mariannelund, Sweden, 1974 02/24 Colin Percival born in Burnaby, Canada, 1981 -02/24 Kevin Bowling born in Scottsdale, Arizona, United States, 1989 02/24 Brandon Bergren born in Edmond, Oklahoma, United States, 1984 +02/25 Kevin Bowling born in Scottsdale, Arizona, United States, 1989 02/26 Pietro Cerutti born in Faido, Switzerland, 1984 02/28 Daichi GOTO born in Shimizu Suntou, Shizuoka, Japan, 1980 02/28 Ruslan Makhmatkhanov born in Rostov-on-Don, USSR, 1984 From owner-dev-commits-src-main@freebsd.org Sat Sep 18 01:43:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3417466ED57 for ; Sat, 18 Sep 2021 01:43:42 +0000 (UTC) (envelope-from me@cameronkatri.com) Received: from cameronkatri.com (cameronkatri.com [206.189.178.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBDB52LW2z4tsK for ; Sat, 18 Sep 2021 01:43:41 +0000 (UTC) (envelope-from me@cameronkatri.com) Received: from FreeBSDY540 (c-73-84-80-103.hsd1.fl.comcast.net [73.84.80.103]) by cameronkatri.com (Postfix) with ESMTPSA id 2FBCD41448 for ; Fri, 17 Sep 2021 21:43:35 -0400 (EDT) Date: Fri, 17 Sep 2021 21:43:34 -0400 From: Cameron Katri To: dev-commits-src-main@freebsd.org Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain Message-ID: <20210918014334.zkjlq7q65nnotm4k@FreeBSDY540> References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zud3myv4n2jc6ejy" Content-Disposition: inline In-Reply-To: <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> X-Rspamd-Queue-Id: 4HBDB52LW2z4tsK X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.59 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[cameronkatri.com:s=20201109]; FREEFALL_USER(0.00)[me]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[cameronkatri.com:+]; DMARC_POLICY_ALLOW(-0.50)[cameronkatri.com,reject]; NEURAL_HAM_SHORT(-0.99)[-0.994]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:14061, ipnet:206.189.176.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main]; RECEIVED_SPAMHAUS_PBL(0.00)[73.84.80.103:received] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 01:43:42 -0000 --zud3myv4n2jc6ejy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 11, 2021 at 10:43:40AM -0400, Shawn Webb wrote: > On Mon, Sep 06, 2021 at 09:24:02AM +0000, Alex Richardson wrote: > > The branch main has been updated by arichardson: > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D021385aba56279febcfdcc64= d23673a0106ae45d > >=20 > > commit 021385aba56279febcfdcc64d23673a0106ae45d > > Author: Alex Richardson > > AuthorDate: 2021-09-06 08:49:49 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-09-06 08:49:49 +0000 > >=20 > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolc= hain > > =20 > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > > Having the LLVM binutils instead of the elftoolchain ones allows us= to use > > features such as LTO that depend on binutils that understand LLVM I= R. > > Another benefit will be an improved user-experience when compiling = with > > AddressSanitizer, since ASAN does not symbolize backtraces correctl= y if > > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/= 000062.html > > for more details. > > =20 > > This is currently off by default but will be turned on by default a= t some > > point in the near future. >=20 > Hey Alex, >=20 > It appears when MK_LLVM_BINUTILS is set, a strip binary/link doesn't > get installed. So /usr/bin/strip doesn't exist. This causes a problem > when building packages since even ports-mgmt/pkg relies on strip. >=20 > I'm working on a candidate patch to fix this right now. But if you > beat me to the punch, all the better. ;-) >=20 > Thanks, >=20 > --=20 > Shawn Webb > Cofounder / Security Engineer > HardenedBSD >=20 > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/0= 3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc Hello, I just noticed that strings is still the elftoolchain version, and llvm-readelf is not connected to the buildsystem at all. - Cameron Katri --=20 Cameron Katri Email: me@cameronkatri.com PGP Fingerprint: 7D3B36CEA40FCC2181FB6DCDBAFFD97826540F1C --zud3myv4n2jc6ejy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEfTs2zqQPzCGB+23Nuv/ZeCZUDxwFAmFFREYACgkQuv/ZeCZU DxyJGgf/Qc02c5g0AMIsjxC8eDnRTMSzx+oPkxp5hPWSZkaOOb+Kx/8r0pDrx0gl yBTQFbTOsdHPICjgrFThP/ltpRiWdLlPafs4iYw8e0KkDodb/penrtvz7/3s6zc1 sIvg02Nh1fQSeCCdKGB3XSbWQhIJCh3qsH0SD3bw0w61D6L8fAu4vqkHK+ZIhMFa ew93UY031UbWCZFAKXuiGx2v81XN1N9oVfw1mVG/RQBjb138lPCnqn7RraPB+HCA kh563sf18Uiqfdiu6cd12WDN1pWK7IozztqtwlM1Yc3NaK/Zt8TeThuV5IYqeLSW RsMB0Dg08JWp5/MwPwH+P/oEdx9rZQ== =W8Ba -----END PGP SIGNATURE----- --zud3myv4n2jc6ejy-- From owner-dev-commits-src-main@freebsd.org Sat Sep 18 10:18:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93E88675014; Sat, 18 Sep 2021 10:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBRbw3QcYz3MTN; Sat, 18 Sep 2021 10:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 563CF27CB6; Sat, 18 Sep 2021 10:18:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IAIK7c065959; Sat, 18 Sep 2021 10:18:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IAIK0I065958; Sat, 18 Sep 2021 10:18:20 GMT (envelope-from git) Date: Sat, 18 Sep 2021 10:18:20 GMT Message-Id: <202109181018.18IAIK0I065958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 5d8e32a66c17 - main - vfs: retire VNODE_REFCOUNT_FENCE_* macros MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d8e32a66c1700323c570d25b03672f35f4e0110 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 10:18:20 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5d8e32a66c1700323c570d25b03672f35f4e0110 commit 5d8e32a66c1700323c570d25b03672f35f4e0110 Author: Mateusz Guzik AuthorDate: 2021-09-18 08:14:35 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 10:16:00 +0000 vfs: retire VNODE_REFCOUNT_FENCE_* macros They are unused as of last year. --- sys/kern/vfs_subr.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 23f6ec9cf3fd..33a556fbfa2b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -121,22 +121,6 @@ static int v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo, daddr_t startlbn, daddr_t endlbn); static void vnlru_recalc(void); -/* - * These fences are intended for cases where some synchronization is - * needed between access of v_iflags and lockless vnode refcount (v_holdcnt - * and v_usecount) updates. Access to v_iflags is generally synchronized - * by the interlock, but we have some internal assertions that check vnode - * flags without acquiring the lock. Thus, these fences are INVARIANTS-only - * for now. - */ -#ifdef INVARIANTS -#define VNODE_REFCOUNT_FENCE_ACQ() atomic_thread_fence_acq() -#define VNODE_REFCOUNT_FENCE_REL() atomic_thread_fence_rel() -#else -#define VNODE_REFCOUNT_FENCE_ACQ() -#define VNODE_REFCOUNT_FENCE_REL() -#endif - /* * Number of vnodes in existence. Increased whenever getnewvnode() * allocates a new vnode, decreased in vdropl() for VIRF_DOOMED vnode. From owner-dev-commits-src-main@freebsd.org Sat Sep 18 10:18:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3B7967510B; Sat, 18 Sep 2021 10:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBRbx4rCSz3M7F; Sat, 18 Sep 2021 10:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E09127EFA; Sat, 18 Sep 2021 10:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IAILeb065983; Sat, 18 Sep 2021 10:18:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IAILYX065982; Sat, 18 Sep 2021 10:18:21 GMT (envelope-from git) Date: Sat, 18 Sep 2021 10:18:21 GMT Message-Id: <202109181018.18IAILYX065982@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a2cb65b8fe97 - main - cache: count vnodes in cache_purgevfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2cb65b8fe975a8f228258e3057b62e068dbf8e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 10:18:21 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a2cb65b8fe975a8f228258e3057b62e068dbf8e2 commit a2cb65b8fe975a8f228258e3057b62e068dbf8e2 Author: Mateusz Guzik AuthorDate: 2021-09-18 08:30:15 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 10:16:50 +0000 cache: count vnodes in cache_purgevfs --- sys/kern/vfs_cache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 732dbbe53cef..3c79395f5d92 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -237,7 +237,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, removecnp, hit, "struct vnode *", "struct componentname *"); SDT_PROBE_DEFINE2(vfs, namecache, removecnp, miss, "struct vnode *", "struct componentname *"); -SDT_PROBE_DEFINE1(vfs, namecache, purge, done, "struct vnode *"); +SDT_PROBE_DEFINE3(vfs, namecache, purge, done, "struct vnode *", "size_t", "size_t"); SDT_PROBE_DEFINE1(vfs, namecache, purge, batch, "int"); SDT_PROBE_DEFINE1(vfs, namecache, purge_negative, done, "struct vnode *"); SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *"); @@ -3012,13 +3012,15 @@ void cache_purgevfs(struct mount *mp) { struct vnode *vp, *mvp; + size_t visited, purged; - SDT_PROBE1(vfs, namecache, purgevfs, done, mp); + visited = purged = 0; /* * Somewhat wasteful iteration over all vnodes. Would be better to * support filtering and avoid the interlock to begin with. */ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) { + visited++; if (!cache_has_entries(vp)) { VI_UNLOCK(vp); continue; @@ -3026,8 +3028,11 @@ cache_purgevfs(struct mount *mp) vholdl(vp); VI_UNLOCK(vp); cache_purge(vp); + purged++; vdrop(vp); } + + SDT_PROBE3(vfs, namecache, purgevfs, done, mp, visited, purged); } /* From owner-dev-commits-src-main@freebsd.org Sat Sep 18 10:18:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41727674D76; Sat, 18 Sep 2021 10:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBRby5xYBz3MRy; Sat, 18 Sep 2021 10:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AE15279F8; Sat, 18 Sep 2021 10:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IAIMhS066007; Sat, 18 Sep 2021 10:18:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IAIMfG066006; Sat, 18 Sep 2021 10:18:22 GMT (envelope-from git) Date: Sat, 18 Sep 2021 10:18:22 GMT Message-Id: <202109181018.18IAIMfG066006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f902e4bb04ad - main - lockmgr: fix lock profiling of face adaptive spinning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f902e4bb04ad717935a97ce1ae59e2dd389d940d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 10:18:23 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f902e4bb04ad717935a97ce1ae59e2dd389d940d commit f902e4bb04ad717935a97ce1ae59e2dd389d940d Author: Mateusz Guzik AuthorDate: 2021-09-11 18:23:51 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 10:16:58 +0000 lockmgr: fix lock profiling of face adaptive spinning --- sys/kern/kern_lock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index bec49f29d162..2eb4feb7c4b5 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -631,6 +631,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, if (lockmgr_slock_try(lk, &x, flags, false)) break; + lock_profile_obtain_lock_failed(&lk->lock_object, false, + &contested, &waittime); + if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { if (lockmgr_slock_adaptive(&lda, lk, &x, flags)) continue; @@ -639,8 +642,6 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, false, - &contested, &waittime); /* * If the lock is expected to not sleep just give up @@ -845,6 +846,10 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, break; continue; } + + lock_profile_obtain_lock_failed(&lk->lock_object, false, + &contested, &waittime); + if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { if (lockmgr_xlock_adaptive(&lda, lk, &x)) continue; @@ -852,8 +857,6 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); #endif - lock_profile_obtain_lock_failed(&lk->lock_object, false, - &contested, &waittime); /* * If the lock is expected to not sleep just give up From owner-dev-commits-src-main@freebsd.org Sat Sep 18 13:50:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DCE1677A83; Sat, 18 Sep 2021 13:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBXJx5Lkdz3HQR; Sat, 18 Sep 2021 13:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BCAA2BB8; Sat, 18 Sep 2021 13:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IDofxD053269; Sat, 18 Sep 2021 13:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IDoffo053268; Sat, 18 Sep 2021 13:50:41 GMT (envelope-from git) Date: Sat, 18 Sep 2021 13:50:41 GMT Message-Id: <202109181350.18IDoffo053268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8e496ea1df1f - main - pf: always log nat rule and do it pre-rewrite MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e496ea1df1f00ea7832eb41754dbbb56dd244c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 13:50:42 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8e496ea1df1f00ea7832eb41754dbbb56dd244c8 commit 8e496ea1df1f00ea7832eb41754dbbb56dd244c8 Author: Franco Fichtner AuthorDate: 2021-09-18 11:42:43 +0000 Commit: Kristof Provost CommitDate: 2021-09-18 11:43:41 +0000 pf: always log nat rule and do it pre-rewrite See also https://github.com/opnsense/core/issues/5005 Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D31504 --- sys/netpfil/pf/pf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 221e0c87c11f..1d492370953a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3629,6 +3629,11 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, KASSERT(sk != NULL, ("%s: null sk", __func__)); KASSERT(nk != NULL, ("%s: null nk", __func__)); + if (nr->log) { + PFLOG_PACKET(kif, m, af, direction, PFRES_MATCH, nr, a, + ruleset, pd, 1); + } + if (pd->ip_sum) bip_sum = *pd->ip_sum; @@ -3857,10 +3862,10 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, int direction, /* apply actions for last matching pass/block rule */ pf_rule_to_actions(r, &pd->act); - if (r->log || (nr != NULL && nr->log)) { + if (r->log) { if (rewrite) m_copyback(m, off, hdrlen, pd->hdr.any); - PFLOG_PACKET(kif, m, af, direction, reason, r->log ? r : nr, a, + PFLOG_PACKET(kif, m, af, direction, reason, r, a, ruleset, pd, 1); } From owner-dev-commits-src-main@freebsd.org Sat Sep 18 14:42:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 432A9677E40; Sat, 18 Sep 2021 14:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBYSP1Dstz3lvf; Sat, 18 Sep 2021 14:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A66E38CB; Sat, 18 Sep 2021 14:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IEgCdL024465; Sat, 18 Sep 2021 14:42:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IEgCqN024464; Sat, 18 Sep 2021 14:42:12 GMT (envelope-from git) Date: Sat, 18 Sep 2021 14:42:12 GMT Message-Id: <202109181442.18IEgCqN024464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 50b07c1f7131 - main - unix: Fix a use-after-free in unp_drop() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50b07c1f7131fd535bbe1b53a3a2e4dfcdcc2e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 14:42:13 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=50b07c1f7131fd535bbe1b53a3a2e4dfcdcc2e51 commit 50b07c1f7131fd535bbe1b53a3a2e4dfcdcc2e51 Author: Mark Johnston AuthorDate: 2021-09-18 14:38:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-18 14:38:39 +0000 unix: Fix a use-after-free in unp_drop() We need to load the socket pointer after locking the PCB, otherwise the socket may have been detached and freed by the time that unp_drop() sets so_error. This previously went unnoticed as the socket zone was _NOFREE. Reported by: pho MFC after: 1 week --- sys/kern/uipc_usrreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 5add930bfa8e..0ee29143c731 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1971,7 +1971,7 @@ unp_shutdown(struct unpcb *unp) static void unp_drop(struct unpcb *unp) { - struct socket *so = unp->unp_socket; + struct socket *so; struct unpcb *unp2; /* @@ -1981,6 +1981,7 @@ unp_drop(struct unpcb *unp) */ UNP_PCB_LOCK(unp); + so = unp->unp_socket; if (so) so->so_error = ECONNRESET; if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) { From owner-dev-commits-src-main@freebsd.org Sat Sep 18 19:15:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7AD367B5C0; Sat, 18 Sep 2021 19:15:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBgWg4Mpcz4SYM; Sat, 18 Sep 2021 19:15:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72B2E77A5; Sat, 18 Sep 2021 19:15:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IJFR8T084509; Sat, 18 Sep 2021 19:15:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IJFR7w084508; Sat, 18 Sep 2021 19:15:27 GMT (envelope-from git) Date: Sat, 18 Sep 2021 19:15:27 GMT Message-Id: <202109181915.18IJFR7w084508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0d9e99ce3b10 - main - vfs: add the missing vnode interlock in vfs_mountroot_shuffle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 19:15:27 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f commit 0d9e99ce3b1071c76ff5a2d9d4158341c0371c2f Author: Mateusz Guzik AuthorDate: 2021-09-18 08:12:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 19:13:51 +0000 vfs: add the missing vnode interlock in vfs_mountroot_shuffle Around v_mountedhere assignment. --- sys/kern/vfs_mountroot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index e2a687511e11..5cf222901420 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -367,10 +367,12 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) error = vinvalbuf(vp, V_SAVE, 0, 0); if (!error) { cache_purge(vp); + VI_LOCK(vp); mporoot->mnt_vnodecovered = vp; vp->v_mountedhere = mporoot; strlcpy(mporoot->mnt_stat.f_mntonname, fspath, MNAMELEN); + VI_UNLOCK(vp); VOP_UNLOCK(vp); } else vput(vp); From owner-dev-commits-src-main@freebsd.org Sat Sep 18 19:15:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C739A67B90C; Sat, 18 Sep 2021 19:15:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBgWh5BLTz4SQ1; Sat, 18 Sep 2021 19:15:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93CCB77A6; Sat, 18 Sep 2021 19:15:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18IJFSFZ084540; Sat, 18 Sep 2021 19:15:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18IJFSwE084539; Sat, 18 Sep 2021 19:15:28 GMT (envelope-from git) Date: Sat, 18 Sep 2021 19:15:28 GMT Message-Id: <202109181915.18IJFSwE084539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 7b2ac8eb9be7 - main - vfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b2ac8eb9be76c96356b6e9a7c06a8080ea841ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 19:15:28 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7b2ac8eb9be76c96356b6e9a7c06a8080ea841ae commit 7b2ac8eb9be76c96356b6e9a7c06a8080ea841ae Author: Mateusz Guzik AuthorDate: 2021-09-18 08:13:33 +0000 Commit: Mateusz Guzik CommitDate: 2021-09-18 19:13:51 +0000 vfs: add missing VIRF_MOUNTPOINT in vfs_mountroot_shuffle Reported by: mav --- sys/kern/vfs_mountroot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 5cf222901420..54d5a442c9ee 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -369,6 +369,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) cache_purge(vp); VI_LOCK(vp); mporoot->mnt_vnodecovered = vp; + vn_irflag_set_locked(vp, VIRF_MOUNTPOINT); vp->v_mountedhere = mporoot; strlcpy(mporoot->mnt_stat.f_mntonname, fspath, MNAMELEN); From owner-dev-commits-src-main@freebsd.org Sat Sep 18 20:10:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C02E867BF34; Sat, 18 Sep 2021 20:10:36 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBhlJ4kkcz4jHt; Sat, 18 Sep 2021 20:10:36 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 7E81C2B959; Sat, 18 Sep 2021 20:10:36 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-qk1-f178.google.com with SMTP id y144so28786551qkb.6; Sat, 18 Sep 2021 13:10:36 -0700 (PDT) X-Gm-Message-State: AOAM532yPCx3zaydJR0iZWU2IQiwS66RLsXLj7Rrtaoo5ss//bHBDTHk XDZZLDCuw1Ox7ZRCHONe3/IuRvl0P2ihzX2KJiA= X-Google-Smtp-Source: ABdhPJw1wC0ATl7ICJ3McCUYmSLwdmRBvjiuR8jXvJG9aPCAjGB2AGRaBrIJeqridJLW3uxGoVopKuWvUMrP8XvuopI= X-Received: by 2002:a25:3b04:: with SMTP id i4mr22207227yba.524.1631995835966; Sat, 18 Sep 2021 13:10:35 -0700 (PDT) MIME-Version: 1.0 References: <202109181018.18IAIMfG066006@gitrepo.freebsd.org> In-Reply-To: <202109181018.18IAIMfG066006@gitrepo.freebsd.org> From: Mitchell Horne Date: Sat, 18 Sep 2021 17:10:25 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: f902e4bb04ad - main - lockmgr: fix lock profiling of face adaptive spinning To: Mateusz Guzik Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 20:10:36 -0000 On Sat, Sep 18, 2021 at 7:18 AM Mateusz Guzik wrote: > > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f902e4bb04ad717935a97ce1ae59e2dd389d940d > > commit f902e4bb04ad717935a97ce1ae59e2dd389d940d > Author: Mateusz Guzik > AuthorDate: 2021-09-11 18:23:51 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-09-18 10:16:58 +0000 > > lockmgr: fix lock profiling of face adaptive spinning In what way was it broken? Mitchell > --- > sys/kern/kern_lock.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c > index bec49f29d162..2eb4feb7c4b5 100644 > --- a/sys/kern/kern_lock.c > +++ b/sys/kern/kern_lock.c > @@ -631,6 +631,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, > if (lockmgr_slock_try(lk, &x, flags, false)) > break; > > + lock_profile_obtain_lock_failed(&lk->lock_object, false, > + &contested, &waittime); > + > if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { > if (lockmgr_slock_adaptive(&lda, lk, &x, flags)) > continue; > @@ -639,8 +642,6 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, > #ifdef HWPMC_HOOKS > PMC_SOFT_CALL( , , lock, failed); > #endif > - lock_profile_obtain_lock_failed(&lk->lock_object, false, > - &contested, &waittime); > > /* > * If the lock is expected to not sleep just give up > @@ -845,6 +846,10 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, > break; > continue; > } > + > + lock_profile_obtain_lock_failed(&lk->lock_object, false, > + &contested, &waittime); > + > if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) { > if (lockmgr_xlock_adaptive(&lda, lk, &x)) > continue; > @@ -852,8 +857,6 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, > #ifdef HWPMC_HOOKS > PMC_SOFT_CALL( , , lock, failed); > #endif > - lock_profile_obtain_lock_failed(&lk->lock_object, false, > - &contested, &waittime); > > /* > * If the lock is expected to not sleep just give up From owner-dev-commits-src-main@freebsd.org Sat Sep 18 21:41:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4928A67D3A0; Sat, 18 Sep 2021 21:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBkmh1Vc4z55cZ; Sat, 18 Sep 2021 21:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0953011460; Sat, 18 Sep 2021 21:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18ILftTd080045; Sat, 18 Sep 2021 21:41:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ILftR3080044; Sat, 18 Sep 2021 21:41:55 GMT (envelope-from git) Date: Sat, 18 Sep 2021 21:41:55 GMT Message-Id: <202109182141.18ILftR3080044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: ad6dc3652023 - main - nfscl: Use vfs.nfs.maxalloclen to limit Deallocate RPC RTT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad6dc365202390edffb14d725155e230b96f59ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2021 21:41:56 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ad6dc365202390edffb14d725155e230b96f59ae commit ad6dc365202390edffb14d725155e230b96f59ae Author: Rick Macklem AuthorDate: 2021-09-18 21:38:43 +0000 Commit: Rick Macklem CommitDate: 2021-09-18 21:38:43 +0000 nfscl: Use vfs.nfs.maxalloclen to limit Deallocate RPC RTT Unlike Copy, the NFSv4.2 Allocate and Deallocate operations do not allow a reply with partial completion. As such, the only way to limit the time the operation takes to provide a reasonable RPC RTT is to limit the size of the allocation/deallocation in the NFSv4.2 client. This patch uses the sysctl vfs.nfs.maxalloclen to set the limit on the size of the Deallocate operation. There is no way to know how long a server will take to do an deallocate operation, but 64Mbytes results in a reasonable RPC RTT for the slow hardware I test on. For an 8Gbyte deallocation, the elapsed time for doing it in 64Mbyte chunks was the same (within margin of variability) as the elapsed time taken for a single large deallocation operation for a FreeBSD server with a UFS file system. --- sys/fs/nfsclient/nfs_clvnops.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 85b5dd9cfbb1..0b60100d1fc9 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3702,12 +3702,15 @@ nfs_deallocate(struct vop_deallocate_args *ap) struct thread *td = curthread; struct nfsvattr nfsva; struct nfsmount *nmp; - off_t tlen; + struct nfsnode *np; + off_t tlen, mlen; int attrflag, error, ret; + bool clipped; error = 0; attrflag = 0; nmp = VFSTONFS(vp->v_mount); + np = VTONFS(vp); mtx_lock(&nmp->nm_mtx); if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && (nmp->nm_privflag & NFSMNTP_NODEALLOCATE) == 0) { @@ -3721,8 +3724,18 @@ nfs_deallocate(struct vop_deallocate_args *ap) *ap->a_len = 0; return (0); } + clipped = false; if ((uint64_t)*ap->a_offset + tlen > nmp->nm_maxfilesize) tlen = nmp->nm_maxfilesize - *ap->a_offset; + if ((uint64_t)*ap->a_offset < np->n_size) { + /* Limit the len to nfs_maxalloclen before EOF. */ + mlen = omin((off_t)np->n_size - *ap->a_offset, tlen); + if ((uint64_t)mlen > nfs_maxalloclen) { + NFSCL_DEBUG(4, "dealloc: tlen maxalloclen\n"); + tlen = nfs_maxalloclen; + clipped = true; + } + } if (error == 0) error = ncl_vinvalbuf(vp, V_SAVE, td, 1); if (error == 0) { @@ -3741,7 +3754,10 @@ nfs_deallocate(struct vop_deallocate_args *ap) nfsva.na_size - *ap->a_offset, tlen); } - *ap->a_len = 0; + if (clipped && tlen < *ap->a_len) + *ap->a_len -= tlen; + else + *ap->a_len = 0; } else if (error == NFSERR_NOTSUPP) { mtx_lock(&nmp->nm_mtx); nmp->nm_privflag |= NFSMNTP_NODEALLOCATE; From owner-dev-commits-src-main@freebsd.org Sun Sep 19 00:03:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34F2B67F2B0; Sun, 19 Sep 2021 00:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HBnvX6McKz4RD4; Sun, 19 Sep 2021 00:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA60313681; Sun, 19 Sep 2021 00:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18J034Qq070413; Sun, 19 Sep 2021 00:03:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18J034X8070412; Sun, 19 Sep 2021 00:03:04 GMT (envelope-from git) Date: Sun, 19 Sep 2021 00:03:04 GMT Message-Id: <202109190003.18J034X8070412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: d7770a5495b1 - main - Eliminate snaplk / bufwait LOR when creating UFS snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7770a5495b19a987dddc77cabcdeadf18413b4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 00:03:05 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=d7770a5495b19a987dddc77cabcdeadf18413b4d commit d7770a5495b19a987dddc77cabcdeadf18413b4d Author: Kirk McKusick AuthorDate: 2021-09-18 23:51:07 +0000 Commit: Kirk McKusick CommitDate: 2021-09-19 00:02:30 +0000 Eliminate snaplk / bufwait LOR when creating UFS snapshots Each vnode has an embedded lock that controls access to its contents. However vnodes describing a UFS snapshot all share a single snapshot lock to coordinate their access and update. As part of creating a new UFS snapshot, it has to have its individual vnode lock replaced with the filesystem's snapshot lock. The lock order for regular vnodes with respect to buffer locks is that they must first acquire the vnode lock, then a buffer lock. The order for the snapshot lock is reversed: a buffer lock must be acquired before the snapshot lock. When creating a new snapshot, the snapshot file must retain its vnode lock until it has allocated all the blocks that it needs before switching to the snapshot lock. This update moves one final piece of the initial snapshot block allocation so that it is done before the newly created snapshot is switched to use the snapshot lock. Reported by: Witness code MFC after: 1 week Sponsored by: Netflix --- sys/ufs/ffs/ffs_snapshot.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 6da84fb46bb0..baad50cab2ba 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -650,6 +650,27 @@ loop: BLK_NOCOPY, 0); vput(xvp); } + /* + * Preallocate all the direct blocks in the snapshot inode so + * that we never have to write the inode itself to commit an + * update to the contents of the snapshot. Note that once + * created, the size of the snapshot will never change, so + * there will never be a need to write the inode except to + * update the non-integrity-critical time fields and + * allocated-block count. + */ + for (blockno = 0; blockno < UFS_NDADDR; blockno++) { + if (DIP(ip, i_db[blockno]) != 0) + continue; + error = UFS_BALLOC(vp, lblktosize(fs, blockno), + fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); + if (error) + goto resumefs; + error = readblock(vp, bp, blockno); + bawrite(bp); + if (error != 0) + goto resumefs; + } /* * Acquire a lock on the snapdata structure, creating it if necessary. */ @@ -691,27 +712,6 @@ loop: sn->sn_listsize = blkp - snapblklist; VI_UNLOCK(devvp); } - /* - * Preallocate all the direct blocks in the snapshot inode so - * that we never have to write the inode itself to commit an - * update to the contents of the snapshot. Note that once - * created, the size of the snapshot will never change, so - * there will never be a need to write the inode except to - * update the non-integrity-critical time fields and - * allocated-block count. - */ - for (blockno = 0; blockno < UFS_NDADDR; blockno++) { - if (DIP(ip, i_db[blockno]) != 0) - continue; - error = UFS_BALLOC(vp, lblktosize(fs, blockno), - fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); - if (error) - goto resumefs; - error = readblock(vp, bp, blockno); - bawrite(bp); - if (error != 0) - goto resumefs; - } /* * Record snapshot inode. Since this is the newest snapshot, * it must be placed at the end of the list. From owner-dev-commits-src-main@freebsd.org Sun Sep 19 08:37:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A9B16AF546; Sun, 19 Sep 2021 08:37:23 +0000 (UTC) (envelope-from herbert@gojira.at) Received: from mail.bsd4all.net (mail.bsd4all.net [94.130.200.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail.bsd4all.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC1Jx4mJNz4pSJ; Sun, 19 Sep 2021 08:37:21 +0000 (UTC) (envelope-from herbert@gojira.at) Date: Sun, 19 Sep 2021 10:34:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gojira.at; s=mail202005; t=1632040634; bh=rjjS9omAeRTKnIdzQi4iSJa1fRHWABd+ER8AB0iBrTs=; h=Date:Message-ID:From:To:Subject:MIME-Version:Content-Type; b=JiUWZ24b4H7kZZwZQUz/mW+DXyg9A0vAL74xeBHp2nwXXZpElM8pwtrI3LZTLpbAP foNr7hUIfmbLLhyXJ9rX9g1JdI8+YeuPaUp0IgyUvJyfJRtFgciPVeTmfP1tTs9lqG eAWuYlbxy6Md3D5O6IQqRuN1qPAXqviu9AR4HGvn9YCDjfz/2pq2Ss/ECIjHERTtQ3 6x82B1JP0bgMXyUA8KlOSKygGebh9KpWRGuK3MM1Gq6Eud5v4UzlF+7+2+9xbHQf28 Ga5z4b/kZTZ9HvJlQKomxp/+6M8iZfZLftwdy6inbwWdTz7SJpuLtRQ/+FHRu2xATn gs0d6xZHznE8w== Message-ID: <87sfy1rmj7.wl-herbert@gojira.at> From: "Herbert J. Skuhra" To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain In-Reply-To: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/28.0 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4HC1Jx4mJNz4pSJ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gojira.at header.s=mail202005 header.b=JiUWZ24b; dmarc=none; spf=pass (mx1.freebsd.org: domain of herbert@gojira.at designates 94.130.200.20 as permitted sender) smtp.mailfrom=herbert@gojira.at X-Spamd-Result: default: False [-2.50 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gojira.at:s=mail202005]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:94.130.200.20:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[gojira.at]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_TRACE(0.00)[gojira.at:+]; NEURAL_HAM_SHORT(-1.00)[-0.995]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:94.130.0.0/16, country:DE]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 08:37:23 -0000 On Mon, 06 Sep 2021 11:24:02 +0200, Alex Richardson wrote: > > The branch main has been updated by arichardson: > > URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d > > commit 021385aba56279febcfdcc64d23673a0106ae45d > Author: Alex Richardson > AuthorDate: 2021-09-06 08:49:49 +0000 > Commit: Alex Richardson > CommitDate: 2021-09-06 08:49:49 +0000 > > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain > > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > Having the LLVM binutils instead of the elftoolchain ones allows us to use > features such as LTO that depend on binutils that understand LLVM IR. > Another benefit will be an improved user-experience when compiling with > AddressSanitizer, since ASAN does not symbolize backtraces correctly if > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html > for more details. > > This is currently off by default but will be turned on by default at some > point in the near future. > > Reviewed By: emaste > > Differential Revision: https://reviews.freebsd.org/D31060 > --- > Makefile.inc1 | 4 +++- > lib/Makefile | 5 ++++- > lib/clang/Makefile | 4 +++- > lib/clang/libllvm/Makefile | 6 +++--- > share/mk/src.opts.mk | 8 ++++++++ > tools/build/options/WITH_LLVM_BINUTILS | 2 ++ > usr.bin/Makefile | 16 +++++++++++----- > usr.bin/clang/Makefile | 13 +++++++++---- > usr.bin/clang/llvm-ar/Makefile | 7 +++++++ > usr.bin/clang/llvm-nm/Makefile | 7 +++++++ > usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ > usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ > usr.bin/clang/llvm-size/Makefile | 7 +++++++ > usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ > 14 files changed, 85 insertions(+), 15 deletions(-) > > diff --git a/Makefile.inc1 b/Makefile.inc1 > index b59c1913f8ce..478824675382 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ > TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ > MK_LLDB=no \ > + MK_LLVM_BINUTILS=no \ > MK_TESTS=no > > # kernel-tools stage > @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree > > # We need to build tblgen when we're building clang or lld, either as > # bootstrap tools, or as the part of the normal build. > +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). > .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ > ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ > - ${MK_LLDB} != "no" > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > _clang_tblgen= \ > lib/clang/libllvmminimal \ > usr.bin/clang/llvm-tblgen > diff --git a/lib/Makefile b/lib/Makefile > index 674368a19ffd..1e375bb456e6 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp > SUBDIR.${MK_BSNMP}+= libbsnmp > > .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) > -SUBDIR.${MK_CLANG}+= clang > +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ > + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" > +SUBDIR+= clang > +.endif > .endif > > SUBDIR.${MK_CUSE}+= libcuse > diff --git a/lib/clang/Makefile b/lib/clang/Makefile > index bc09ea62dc67..df4aa01a2653 100644 > --- a/lib/clang/Makefile > +++ b/lib/clang/Makefile > @@ -4,10 +4,12 @@ > > # These have to be built in order. > SUBDIR= libllvm > +.if ${MK_CLANG} != "no" > SUBDIR+= libclang > +SUBDIR+= headers > +.endif > .if ${MK_LLDB} != "no" > SUBDIR+= liblldb > .endif > -SUBDIR+= headers > > .include > diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile > index 09d6336c01d9..7eaedf65dcb3 100644 > --- a/lib/clang/libllvm/Makefile > +++ b/lib/clang/libllvm/Makefile > @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp > SRCS_MIN+= Object/IRSymtab.cpp > SRCS_MIN+= Object/MachOObjectFile.cpp > SRCS_MIW+= Object/MachOUniversal.cpp > -SRCS_EXT+= Object/MachOUniversalWriter.cpp > +SRCS_MIW+= Object/MachOUniversalWriter.cpp > SRCS_MIW+= Object/Minidump.cpp > SRCS_MIN+= Object/ModuleSymbolTable.cpp > SRCS_EXT+= Object/Object.cpp > @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp > SRCS_MIN+= Support/Error.cpp > SRCS_MIN+= Support/ErrorHandling.cpp > SRCS_MIN+= Support/FileCollector.cpp > -SRCS_EXL+= Support/FileOutputBuffer.cpp > +SRCS_MIW+= Support/FileOutputBuffer.cpp > SRCS_MIN+= Support/FileUtilities.cpp > SRCS_MIN+= Support/FoldingSet.cpp > SRCS_MIN+= Support/FormatVariadic.cpp > @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp > SRCS_MIN+= Support/ManagedStatic.cpp > SRCS_MIN+= Support/MathExtras.cpp > SRCS_MIN+= Support/MemAlloc.cpp > -SRCS_XDL+= Support/Memory.cpp > +SRCS_MIW+= Support/Memory.cpp > SRCS_MIN+= Support/MemoryBuffer.cpp > SRCS_MIN+= Support/MemoryBufferRef.cpp > SRCS_MIN+= Support/NativeFormatting.cpp > diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk > index 32346e31a752..5363cb6e78f9 100644 > --- a/share/mk/src.opts.mk > +++ b/share/mk/src.opts.mk > @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ > LOADER_FIREWIRE \ > LOADER_VERBOSE \ > LOADER_VERIEXEC_PASS_MANIFEST \ > + LLVM_BINUTILS \ > MALLOC_PRODUCTION \ > OFED_EXTRA \ > OPENLDAP \ > @@ -459,6 +460,7 @@ MK_CLANG:= no > MK_INCLUDES:= no > MK_LLD:= no > MK_LLDB:= no > +MK_LLVM_BINUTILS:= no > .endif > > .if ${MK_CLANG} == "no" > @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no > MK_LLVM_COV:= no > .endif > > +.if ${MK_LLVM_BINUTILS} == "yes" > +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be > +# enabled if MK_LLVM_BINUTILS is set. > +MK_LLVM_CXXFILT:= yes > +.endif > + > .if ${MK_LOADER_VERIEXEC} == "no" > MK_LOADER_VERIEXEC_PASS_MANIFEST := no > .endif > diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS > new file mode 100644 > index 000000000000..8fa2c55f31a9 > --- /dev/null > +++ b/tools/build/options/WITH_LLVM_BINUTILS > @@ -0,0 +1,2 @@ > +.\" $FreeBSD$ > +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. > diff --git a/usr.bin/Makefile b/usr.bin/Makefile > index f1b07a7007be..e8be161db01a 100644 > --- a/usr.bin/Makefile > +++ b/usr.bin/Makefile > @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm > SUBDIR.${MK_BLUETOOTH}+= bluetooth > SUBDIR.${MK_BSD_CPIO}+= cpio > SUBDIR.${MK_CALENDAR}+= calendar > -SUBDIR.${MK_CLANG}+= clang > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ > + ${MK_LLD} != "no" || ${MK_LLDB} != "no" > +SUBDIR+= clang > +.endif > SUBDIR.${MK_DIALOG}+= dpv > SUBDIR.${MK_EE}+= ee > SUBDIR.${MK_FILE}+= file > @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua > SUBDIR.${MK_TESTS}+= tests > SUBDIR.${MK_TEXTPROC}+= ul > SUBDIR.${MK_TFTP}+= tftp > +.if ${MK_LLVM_BINUTILS} == "no" > +# Only build the elftoolchain tools if we aren't using the LLVM ones. > SUBDIR.${MK_TOOLCHAIN}+= addr2line > SUBDIR.${MK_TOOLCHAIN}+= ar > +SUBDIR.${MK_TOOLCHAIN}+= nm > +SUBDIR.${MK_TOOLCHAIN}+= objcopy > +SUBDIR.${MK_TOOLCHAIN}+= readelf > +SUBDIR.${MK_TOOLCHAIN}+= size > +.endif > SUBDIR.${MK_TOOLCHAIN}+= c89 > SUBDIR.${MK_TOOLCHAIN}+= c99 > SUBDIR.${MK_TOOLCHAIN}+= ctags > .if ${MK_LLVM_CXXFILT} == "no" > SUBDIR.${MK_TOOLCHAIN}+= cxxfilt > .endif > -SUBDIR.${MK_TOOLCHAIN}+= objcopy > SUBDIR.${MK_TOOLCHAIN}+= file2c > SUBDIR.${MK_TOOLCHAIN}+= gprof > SUBDIR.${MK_TOOLCHAIN}+= indent > SUBDIR.${MK_TOOLCHAIN}+= lex > SUBDIR.${MK_TOOLCHAIN}+= mkstr > -SUBDIR.${MK_TOOLCHAIN}+= nm > -SUBDIR.${MK_TOOLCHAIN}+= readelf > SUBDIR.${MK_TOOLCHAIN}+= rpcgen > SUBDIR.${MK_TOOLCHAIN}+= unifdef > -SUBDIR.${MK_TOOLCHAIN}+= size > SUBDIR.${MK_TOOLCHAIN}+= xstr > SUBDIR.${MK_TOOLCHAIN}+= yacc > SUBDIR.${MK_VI}+= vi > diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile > index 1c53e94965f7..7fc31e8df194 100644 > --- a/usr.bin/clang/Makefile > +++ b/usr.bin/clang/Makefile > @@ -7,12 +7,20 @@ SUBDIR+= clang > .endif > > .if !defined(TOOLS_PREFIX) > +# LLVM binutils are needed to support features such as LTO, so we build them > +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them > +# as the default binutils (ar,nm,addr2line, etc.). > +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" > SUBDIR+= llvm-ar > SUBDIR+= llvm-nm > +SUBDIR+= llvm-objcopy > SUBDIR+= llvm-objdump > +SUBDIR+= llvm-size > +SUBDIR+= llvm-strings > SUBDIR+= llvm-symbolizer > +.endif Update tools/build/mk/OptionalObsoleteFiles.inc? # make delete-old >>> Removing old files (only deletes safe to delete libs) remove /usr/bin/llvm-objcopy? n remove /usr/bin/llvm-size? n remove /usr/bin/llvm-strings? n remove /usr/share/man/man1/llvm-objcopy.1.gz? n remove /usr/share/man/man1/llvm-size.1.gz? n remove /usr/share/man/man1/llvm-strings.1.gz? n -- Herbert From owner-dev-commits-src-main@freebsd.org Sun Sep 19 10:00:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D361766828E; Sun, 19 Sep 2021 10:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC39N56Ndz3kg6; Sun, 19 Sep 2021 10:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FD541B50C; Sun, 19 Sep 2021 10:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JA0uvj071412; Sun, 19 Sep 2021 10:00:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JA0uHK071411; Sun, 19 Sep 2021 10:00:56 GMT (envelope-from git) Date: Sun, 19 Sep 2021 10:00:56 GMT Message-Id: <202109191000.18JA0uHK071411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: e19d93b19dce - main - sctp: fix FCFS stream scheduler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e19d93b19dce276bdf178bb6a449728238d1c6f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 10:00:56 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e19d93b19dce276bdf178bb6a449728238d1c6f8 commit e19d93b19dce276bdf178bb6a449728238d1c6f8 Author: Michael Tuexen AuthorDate: 2021-09-19 09:56:26 +0000 Commit: Michael Tuexen CommitDate: 2021-09-19 09:56:26 +0000 sctp: fix FCFS stream scheduler Reported by: syzbot+c6793f0f0ce698bce230@syzkaller.appspotmail.com MFC after: 1 week --- sys/netinet/sctp_ss_functions.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 5557015cd2a9..0a5a788428bc 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -809,23 +809,22 @@ sctp_ss_fcfs_init(struct sctp_tcb *stcb, struct sctp_association *asoc, static void sctp_ss_fcfs_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, - int clear_values, int holds_lock) + int clear_values SCTP_UNUSED, int holds_lock) { struct sctp_stream_queue_pending *sp; - if (clear_values) { - if (holds_lock == 0) { - SCTP_TCB_SEND_LOCK(stcb); - } - while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { - sp = TAILQ_FIRST(&asoc->ss_data.out.list); - TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); - sp->ss_next.tqe_next = NULL; - sp->ss_next.tqe_prev = NULL; - } - if (holds_lock == 0) { - SCTP_TCB_SEND_UNLOCK(stcb); - } + if (holds_lock == 0) { + SCTP_TCB_SEND_LOCK(stcb); + } + while (!TAILQ_EMPTY(&asoc->ss_data.out.list)) { + sp = TAILQ_FIRST(&asoc->ss_data.out.list); + TAILQ_REMOVE(&asoc->ss_data.out.list, sp, ss_next); + sp->ss_next.tqe_next = NULL; + sp->ss_next.tqe_prev = NULL; + } + asoc->ss_data.last_out_stream = NULL; + if (holds_lock == 0) { + SCTP_TCB_SEND_UNLOCK(stcb); } return; } From owner-dev-commits-src-main@freebsd.org Sun Sep 19 11:53:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45979669D8F; Sun, 19 Sep 2021 11:53:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC5gS1HFVz4l4x; Sun, 19 Sep 2021 11:53:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C6B91CBC2; Sun, 19 Sep 2021 11:53:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JBrd3E021236; Sun, 19 Sep 2021 11:53:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JBrdOc021235; Sun, 19 Sep 2021 11:53:39 GMT (envelope-from git) Date: Sun, 19 Sep 2021 11:53:39 GMT Message-Id: <202109191153.18JBrdOc021235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: b8ff849cbddf - main - sh: improve command completion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8ff849cbddfee3404d6550cf98f53d6bb617707 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 11:53:40 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=b8ff849cbddfee3404d6550cf98f53d6bb617707 commit b8ff849cbddfee3404d6550cf98f53d6bb617707 Author: Piotr Pawel Stefaniak AuthorDate: 2021-09-18 11:26:51 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-19 11:51:45 +0000 sh: improve command completion When multiple matches are found, we keep the provided string on the input line and print unique matches as suggestions. But the multiple matches might be the same command found in different directories, so we should deduplicate the matches first and then decide whether to autocomplete the command or not, based on the number of unique matches. --- bin/sh/histedit.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index b680a99c4ace..1a1e11e6f885 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -590,7 +590,7 @@ static char char *free_path = NULL, *path; const char *dirname; char **matches = NULL; - size_t i = 0, size = 16, j, k; + size_t i = 0, size = 16, uniq; size_t curpos = end - start; if (start > 0 || memchr("/.~", text[0], 3) != NULL) @@ -639,6 +639,21 @@ static char } out: free(free_path); + if (i == 0) { + free(matches); + return (NULL); + } + uniq = 1; + if (i > 1) { + qsort_s(matches + 1, i, sizeof(matches[0]), comparator, + (void *)(intptr_t)curpos); + for (size_t k = 2; k <= i; k++) + if (strcmp(matches[uniq] + curpos, matches[k] + curpos) == 0) + free(matches[k]); + else + matches[++uniq] = matches[k]; + } + matches[uniq + 1] = NULL; /* * matches[0] is special: it's not a real matching file name but a common * prefix for all matching names. It can't be null, unlike any other @@ -648,30 +663,13 @@ out: * string in matches[0] which is the reason to copy the full name of the * only match. */ - if (i == 0) { - free(matches); - return (NULL); - } else if (i == 1) { - matches[0] = strdup(matches[1]); - matches[2] = NULL; - if (matches[0] != NULL) - return (matches); - } else - matches[0] = strdup(text); + matches[0] = strdup(uniq == 1 ? matches[1] : text); if (matches[0] == NULL) { - for (j = 1; j <= i; j++) - free(matches[j]); + for (size_t k = 1; k <= uniq; k++) + free(matches[k]); free(matches); return (NULL); } - qsort_s(matches + 1, i, sizeof(matches[0]), comparator, - (void *)(intptr_t)curpos); - for (j = 1, k = 2; k <= i; k++) - if (strcmp(matches[j] + curpos, matches[k] + curpos) == 0) - free(matches[k]); - else - matches[++j] = matches[k]; - matches[j + 1] = NULL; return (matches); } From owner-dev-commits-src-main@freebsd.org Sun Sep 19 11:53:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91364669E13; Sun, 19 Sep 2021 11:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC5gT2Zqwz4lJH; Sun, 19 Sep 2021 11:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EA201CD61; Sun, 19 Sep 2021 11:53:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JBrfVA021260; Sun, 19 Sep 2021 11:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JBrfTA021259; Sun, 19 Sep 2021 11:53:41 GMT (envelope-from git) Date: Sun, 19 Sep 2021 11:53:41 GMT Message-Id: <202109191153.18JBrfTA021259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: da0c0e012157 - main - fstyp: bump WARNS to default and work around warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da0c0e0121574a1d82f417cc7e245ecd5506325c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 11:53:41 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=da0c0e0121574a1d82f417cc7e245ecd5506325c commit da0c0e0121574a1d82f417cc7e245ecd5506325c Author: Piotr Pawel Stefaniak AuthorDate: 2021-08-17 15:46:08 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-19 11:52:12 +0000 fstyp: bump WARNS to default and work around warnings Differential Revision: https://reviews.freebsd.org/D31588 --- usr.sbin/fstyp/Makefile | 2 -- usr.sbin/fstyp/apfs.c | 2 ++ usr.sbin/fstyp/fstyp.c | 4 ++-- usr.sbin/fstyp/hammer.c | 3 +++ usr.sbin/fstyp/hfsplus.c | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index 384e2f7dee60..161cd0cf3764 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -12,8 +12,6 @@ SRCS += zfs.c MAN= fstyp.8 -WARNS?= 2 - .if ${MK_ICONV} == "yes" CFLAGS+= -DWITH_ICONV .endif diff --git a/usr.sbin/fstyp/apfs.c b/usr.sbin/fstyp/apfs.c index 049a9f862f2b..7f8543a5a108 100644 --- a/usr.sbin/fstyp/apfs.c +++ b/usr.sbin/fstyp/apfs.c @@ -100,6 +100,8 @@ fstyp_apfs(FILE *fp, char *label, size_t size) retval = 0; /* No label support yet. */ + (void)size; + (void)label; fail: free(csb); diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index b39277914aed..91c36d9d9191 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -61,7 +61,7 @@ static struct { const char *name; fstyp_function function; bool unmountable; - char *precache_encoding; + const char *precache_encoding; } fstypes[] = { { "apfs", &fstyp_apfs, true, NULL }, { "befs", &fstyp_befs, false, NULL }, @@ -206,7 +206,7 @@ main(int argc, char **argv) #ifdef WITH_ICONV /* Cache iconv conversion data before entering capability mode. */ if (show_label) { - for (i = 0; i < nitems(fstypes); i++) { + for (i = 0; i < (int)nitems(fstypes); i++) { iconv_t cd; if (fstypes[i].precache_encoding == NULL) diff --git a/usr.sbin/fstyp/hammer.c b/usr.sbin/fstyp/hammer.c index 6fdad1d642a4..777f5d312371 100644 --- a/usr.sbin/fstyp/hammer.c +++ b/usr.sbin/fstyp/hammer.c @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include "fstyp.h" +extern int fsvtyp_hammer(const char *blkdevs, char *label, size_t size); +extern int fsvtyp_hammer_partial(const char *blkdevs, char *label, size_t size); + static hammer_volume_ondisk_t read_ondisk(FILE *fp) { diff --git a/usr.sbin/fstyp/hfsplus.c b/usr.sbin/fstyp/hfsplus.c index 71287465e4ff..3a94faf7766f 100644 --- a/usr.sbin/fstyp/hfsplus.c +++ b/usr.sbin/fstyp/hfsplus.c @@ -118,6 +118,8 @@ fstyp_hfsp(FILE *fp, char *label, size_t size) retval = 0; /* No label support yet. */ + (void)size; + (void)label; fail: free(hdr); From owner-dev-commits-src-main@freebsd.org Sun Sep 19 11:53:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0D47669FC9; Sun, 19 Sep 2021 11:53:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC5gV5n3Qz4lTp; Sun, 19 Sep 2021 11:53:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56E991CD62; Sun, 19 Sep 2021 11:53:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JBrgNK021284; Sun, 19 Sep 2021 11:53:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JBrgLr021283; Sun, 19 Sep 2021 11:53:42 GMT (envelope-from git) Date: Sun, 19 Sep 2021 11:53:42 GMT Message-Id: <202109191153.18JBrgLr021283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 97c31821eb0b - main - ls(1): Allow LSCOLORS to specify an underline MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97c31821eb0b1180778ad2da660a1778c2cb4b62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 11:53:43 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=97c31821eb0b1180778ad2da660a1778c2cb4b62 commit 97c31821eb0b1180778ad2da660a1778c2cb4b62 Author: Cameron Katri AuthorDate: 2021-09-19 11:36:41 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-09-19 11:52:12 +0000 ls(1): Allow LSCOLORS to specify an underline Allows capitalizing the background color character to enable an underline instead of bold, capitalizing the foreground color char will still do bold. Differential Revision: https://reviews.freebsd.org/D30547 --- bin/ls/extern.h | 1 + bin/ls/ls.1 | 19 +++++++++++-------- bin/ls/ls.c | 2 ++ bin/ls/print.c | 21 ++++++++++++++++----- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/bin/ls/extern.h b/bin/ls/extern.h index 8dab2bcc9d8c..247c2c4a1d5b 100644 --- a/bin/ls/extern.h +++ b/bin/ls/extern.h @@ -66,6 +66,7 @@ extern char *ansi_bgcol; extern char *ansi_coloff; extern char *attrs_off; extern char *enter_bold; +extern char *enter_underline; extern int colorflag; extern bool explicitansi; diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 8510ca609cda..ef412dd2927d 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -740,6 +740,7 @@ where is the foreground color and .Ar b is the background color. +When the background color is capitalized, the text will underlined. .Pp The color designators are as follows: .Pp @@ -761,23 +762,25 @@ cyan .It Sy h light grey .It Sy A -bold black, usually shows up as dark grey +bold or underlined black, usually shows up as dark grey .It Sy B -bold red +bold or underlined red .It Sy C -bold green +bold or underlined green .It Sy D -bold brown, usually shows up as yellow +bold or underlined brown, usually shows up as yellow .It Sy E -bold blue +bold or underlined blue .It Sy F -bold magenta +bold or underlined magenta .It Sy G -bold cyan +bold or underlined cyan .It Sy H -bold light grey; looks like bright white +bold or underlined light grey; looks like bright white .It Sy x default foreground or background +.It Sy X +default foreground or background, with an underline or bold .El .Pp Note that the above are standard diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 92575711251d..8a30dd326b4e 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -159,6 +159,7 @@ char *ansi_fgcol; /* ANSI sequence to set foreground colour */ char *ansi_coloff; /* ANSI sequence to reset colours */ char *attrs_off; /* ANSI sequence to turn off attributes */ char *enter_bold; /* ANSI sequence to set color to bold mode */ +char *enter_underline; /* ANSI sequence to enter underline mode */ #endif static int rval; @@ -485,6 +486,7 @@ main(int argc, char *argv[]) ansi_bgcol = tgetstr("AB", &bp); attrs_off = tgetstr("me", &bp); enter_bold = tgetstr("md", &bp); + enter_underline = tgetstr("us", &bp); /* To switch colours off use 'op' if * available, otherwise use 'oc', or diff --git a/bin/ls/print.c b/bin/ls/print.c index 9a537418f7b9..bbe5c6f8a6f6 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -106,7 +106,8 @@ static const char *defcolors = "exfxcxdxbxegedabagacad"; /* colors for file types */ static struct { int num[2]; - int bold; + bool bold; + bool underline; } colors[C_NUMCOLORS]; #endif @@ -548,6 +549,8 @@ printcolor_termcap(Colors c) if (colors[c].bold) tputs(enter_bold, 1, putch); + if (colors[c].underline) + tputs(enter_underline, 1, putch); if (colors[c].num[0] != -1) { ansiseq = tgoto(ansi_fgcol, 0, colors[c].num[0]); @@ -569,6 +572,8 @@ printcolor_ansi(Colors c) if (colors[c].bold) printf("1"); + if (colors[c].underline) + printf(";4"); if (colors[c].num[0] != -1) printf(";3%d", colors[c].num[0]); if (colors[c].num[1] != -1) @@ -666,7 +671,8 @@ parsecolors(const char *cs) cs = ""; /* LSCOLORS not set */ len = strlen(cs); for (i = 0; i < (int)C_NUMCOLORS; i++) { - colors[i].bold = 0; + colors[i].bold = false; + colors[i].underline = false; if (len <= 2 * (size_t)i) { c[0] = defcolors[2 * i]; @@ -689,10 +695,15 @@ parsecolors(const char *cs) colors[i].num[j] = c[j] - 'a'; else if (c[j] >= 'A' && c[j] <= 'H') { colors[i].num[j] = c[j] - 'A'; - colors[i].bold = 1; - } else if (tolower((unsigned char)c[j]) == 'x') + if (j == 1) + colors[i].underline = true; + else + colors[i].bold = true; + } else if (tolower((unsigned char)c[j]) == 'x') { + if (j == 1 && c[j] == 'X') + colors[i].underline = true; colors[i].num[j] = -1; - else { + } else { warnx("invalid character '%c' in LSCOLORS" " env var", c[j]); colors[i].num[j] = -1; From owner-dev-commits-src-main@freebsd.org Sun Sep 19 13:58:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C968266BB90; Sun, 19 Sep 2021 13:58:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HC8Rt4kccz3mvF; Sun, 19 Sep 2021 13:58:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x135.google.com with SMTP id y28so54443493lfb.0; Sun, 19 Sep 2021 06:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KPBGb51m44Ri6kXs0efNUNg3SLGcHfKF+lvNP9svil0=; b=mGkakUQEzZeRmHKOphYmMfO0CnVYwDYVyaMOOrDQZNEXjcacLSrEPwqaWxjMpcUh7T zk/F1VLOIUd5AoLpMQozhBqqasOXD09pH4uwrXFwy1SNWabHx9Tr/SwjMSA09fs2f7qw HMOs5rd+h1PEnZhGTkjm/tlGxyw9gKa3NeQsLSU8sQwbSYqjLnapEVRhYGcsr2ww8Qwt hxOBd1k58JZJrioDQKeEHe+i8R8NDJ6W7Fl2hS3jGOMtWTb0vi0iFzQPLTiXNhdUkadl 6IBiMVdkSDGEZZHys+t2DrkdmkjMplk8iKSlsZNFey2Bz4mYxqpoj3m8V2yvBll0Hokz ks9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KPBGb51m44Ri6kXs0efNUNg3SLGcHfKF+lvNP9svil0=; b=bQD6bvKV8Gj8/yzSRJ4kAG8vsYaG8CdMNjmNivTttH8UZ292Z8HZY0bEiEsaiRSaGW aWUODVFmj/BrMJt56FAfJkFubIiAFtCJ9Fu2eOsICFH4qJ1WaFdLfhR4i1sDrt+lqWDM j+J1Dlz1pp1LlaTY+5QHfINUIsPbh7SQ1aJFYk6de3z68JtaZ202qTVhQ96Uufn4IOUR pACZKjs1JWA7j2rQIVnnVrg+sS8LyTulYGwgeR4VO+3CYeF5wYti+IunxX5KKQgVtyNs R+zE49BY1OU5q3oD0Zts3bBujBEpRq04mPGzk7G9S/IkdZeFLzSJAqYbud0WvlC6zh/k f8lQ== X-Gm-Message-State: AOAM531PaksPEQpxm7AN8pTMmy5qZj44/N7w7+fdV8VG8NMpVrAAW0JA pO78b6BNE+7Ys2//jeZ3bh7wwJl+4ZwmyYVudpO/q6/6 X-Google-Smtp-Source: ABdhPJz0WSjLviFMbTYhobSwbzS10IsVtSfTAn7K2FusAJqrBiPzJp+uW3IQAkgi90RvDE9aRInt1QcaphSoYNqR280= X-Received: by 2002:a05:6512:110a:: with SMTP id l10mr3005475lfg.550.1632059929359; Sun, 19 Sep 2021 06:58:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:2115:0:0:0:0 with HTTP; Sun, 19 Sep 2021 06:58:48 -0700 (PDT) In-Reply-To: References: <202109181018.18IAIMfG066006@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sun, 19 Sep 2021 15:58:48 +0200 Message-ID: Subject: Re: git: f902e4bb04ad - main - lockmgr: fix lock profiling of face adaptive spinning To: Mitchell Horne Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4HC8Rt4kccz3mvF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 13:58:50 -0000 On 9/18/21, Mitchell Horne wrote: > On Sat, Sep 18, 2021 at 7:18 AM Mateusz Guzik wrote: >> >> The branch main has been updated by mjg: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=f902e4bb04ad717935a97ce1ae59e2dd389d940d >> >> commit f902e4bb04ad717935a97ce1ae59e2dd389d940d >> Author: Mateusz Guzik >> AuthorDate: 2021-09-11 18:23:51 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-09-18 10:16:58 +0000 >> >> lockmgr: fix lock profiling of face adaptive spinning > > In what way was it broken? > If there was only spinning the time would fail to register. > Mitchell > >> --- >> sys/kern/kern_lock.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c >> index bec49f29d162..2eb4feb7c4b5 100644 >> --- a/sys/kern/kern_lock.c >> +++ b/sys/kern/kern_lock.c >> @@ -631,6 +631,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, >> struct lock_object *ilk, >> if (lockmgr_slock_try(lk, &x, flags, false)) >> break; >> >> + lock_profile_obtain_lock_failed(&lk->lock_object, false, >> + &contested, &waittime); >> + >> if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) >> { >> if (lockmgr_slock_adaptive(&lda, lk, &x, flags)) >> continue; >> @@ -639,8 +642,6 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, >> struct lock_object *ilk, >> #ifdef HWPMC_HOOKS >> PMC_SOFT_CALL( , , lock, failed); >> #endif >> - lock_profile_obtain_lock_failed(&lk->lock_object, false, >> - &contested, &waittime); >> >> /* >> * If the lock is expected to not sleep just give up >> @@ -845,6 +846,10 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, >> struct lock_object *ilk, >> break; >> continue; >> } >> + >> + lock_profile_obtain_lock_failed(&lk->lock_object, false, >> + &contested, &waittime); >> + >> if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) >> { >> if (lockmgr_xlock_adaptive(&lda, lk, &x)) >> continue; >> @@ -852,8 +857,6 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, >> struct lock_object *ilk, >> #ifdef HWPMC_HOOKS >> PMC_SOFT_CALL( , , lock, failed); >> #endif >> - lock_profile_obtain_lock_failed(&lk->lock_object, false, >> - &contested, &waittime); >> >> /* >> * If the lock is expected to not sleep just give up > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Sun Sep 19 17:55:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 971A166EAB0; Sun, 19 Sep 2021 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCFhd3vCCz3rQ2; Sun, 19 Sep 2021 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65BDE2166B; Sun, 19 Sep 2021 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JHtDeu099695; Sun, 19 Sep 2021 17:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JHtDFk099694; Sun, 19 Sep 2021 17:55:13 GMT (envelope-from git) Date: Sun, 19 Sep 2021 17:55:13 GMT Message-Id: <202109191755.18JHtDFk099694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4bda16ff184b - main - freebsd32: Provide an ANSI definition for freebsd32_recvmsg() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4bda16ff184bfca5ee4bf9709a06323d9cf5945b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 17:55:13 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4bda16ff184bfca5ee4bf9709a06323d9cf5945b commit 4bda16ff184bfca5ee4bf9709a06323d9cf5945b Author: Mark Johnston AuthorDate: 2021-09-19 17:41:43 +0000 Commit: Mark Johnston CommitDate: 2021-09-19 17:53:57 +0000 freebsd32: Provide an ANSI definition for freebsd32_recvmsg() Fix style in the freebsd32_sendmsg() definition. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/compat/freebsd32/freebsd32_misc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index f4b1edb6c7b0..be942f9fafd3 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1411,13 +1411,7 @@ exit: } int -freebsd32_recvmsg(td, uap) - struct thread *td; - struct freebsd32_recvmsg_args /* { - int s; - struct msghdr32 *msg; - int flags; - } */ *uap; +freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; @@ -1562,8 +1556,7 @@ out: } int -freebsd32_sendmsg(struct thread *td, - struct freebsd32_sendmsg_args *uap) +freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; struct msghdr32 m32; From owner-dev-commits-src-main@freebsd.org Sun Sep 19 17:55:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2BBD66E8EB; Sun, 19 Sep 2021 17:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCFhf4ZcLz3rZd; Sun, 19 Sep 2021 17:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EE272166C; Sun, 19 Sep 2021 17:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JHtE98099719; Sun, 19 Sep 2021 17:55:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JHtEo2099718; Sun, 19 Sep 2021 17:55:14 GMT (envelope-from git) Date: Sun, 19 Sep 2021 17:55:14 GMT Message-Id: <202109191755.18JHtEo2099718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fea1a98ead91 - main - freebsd32: Fix a double copyin in sendmsg() and recvmsg() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fea1a98ead918b39280b586773a923e76194400b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 17:55:14 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fea1a98ead918b39280b586773a923e76194400b commit fea1a98ead918b39280b586773a923e76194400b Author: Mark Johnston AuthorDate: 2021-09-19 17:45:09 +0000 Commit: Mark Johnston CommitDate: 2021-09-19 17:54:16 +0000 freebsd32: Fix a double copyin in sendmsg() and recvmsg() freebsd32_sendmsg() and freebsd32_recvmsg() both copyin the message header twice, once directly and once in freebsd32_copyinmsghdr(). The iovec length from the former is used when copying in msg_iov, but the rest of the kernel uses the iovec length from the latter. When kern_sendit() and kern_recvit() iterate over the iovec to compute the residual for I/O, they can therefore end up walking past the end of the copied in iovec, either resulting in a system call error, userspace memory corruption from uiomove() with invalid iovecs, or a kernel page fault if the copied-in iovec is followed by an unmapped KVA region. Reported by: syzbot+7cc64cd0c49605acd421@syzkaller.appspotmail.com Reviewed by: kib, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32010 --- sys/compat/freebsd32/freebsd32_misc.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index be942f9fafd3..08941ebc5be9 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1414,19 +1414,15 @@ int freebsd32_recvmsg(struct thread *td, struct freebsd32_recvmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *uiov, *iov; struct mbuf *control = NULL; struct mbuf **controlp; - int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); + error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); @@ -1559,19 +1555,15 @@ int freebsd32_sendmsg(struct thread *td, struct freebsd32_sendmsg_args *uap) { struct msghdr msg; - struct msghdr32 m32; struct iovec *iov; struct mbuf *control = NULL; struct sockaddr *to = NULL; int error; - error = copyin(uap->msg, &m32, sizeof(m32)); - if (error) - return (error); error = freebsd32_copyinmsghdr(uap->msg, &msg); if (error) return (error); - error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov, + error = freebsd32_copyiniov((void *)msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); if (error) return (error); From owner-dev-commits-src-main@freebsd.org Sun Sep 19 18:08:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65E3566EC38; Sun, 19 Sep 2021 18:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCFzw2J67z3wTl; Sun, 19 Sep 2021 18:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F4B1217D1; Sun, 19 Sep 2021 18:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JI8SVB014636; Sun, 19 Sep 2021 18:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JI8SHe014635; Sun, 19 Sep 2021 18:08:28 GMT (envelope-from git) Date: Sun, 19 Sep 2021 18:08:28 GMT Message-Id: <202109191808.18JI8SHe014635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: e8144a13e075 - main - ciss(4): Properly handle data underrun. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8144a13e075ff13c1f162690c7f14dd3f0a4862 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 18:08:28 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e8144a13e075ff13c1f162690c7f14dd3f0a4862 commit e8144a13e075ff13c1f162690c7f14dd3f0a4862 Author: Alexander Motin AuthorDate: 2021-09-19 17:45:51 +0000 Commit: Alexander Motin CommitDate: 2021-09-19 18:08:22 +0000 ciss(4): Properly handle data underrun. For SCSI data underrun is a part of normal life. It should not be reported as error. This fixes MODE SENSE used by modern CAM. MFC after: 1 month --- sys/dev/ciss/ciss.c | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 74baf164b860..36d1225fbe4a 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -2331,13 +2331,15 @@ _ciss_report_request(struct ciss_request *cr, int *command_status, int *scsi_sta if (command_status != NULL) *command_status = ce->command_status; if (scsi_status != NULL) { - if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { + if (ce->command_status == CISS_CMD_STATUS_DATA_UNDERRUN) { + *scsi_status = SCSI_STATUS_OK; + } else if (ce->command_status == CISS_CMD_STATUS_TARGET_STATUS) { *scsi_status = ce->scsi_status; } else { *scsi_status = -1; } } - if (bootverbose) + if (bootverbose && ce->command_status != CISS_CMD_STATUS_DATA_UNDERRUN) ciss_printf(cr->cr_sc, "command status 0x%x (%s) scsi status 0x%x\n", ce->command_status, ciss_name_command_status(ce->command_status), ce->scsi_status); @@ -3311,28 +3313,17 @@ ciss_cam_complete(struct ciss_request *cr) * Extract status values from request. */ ciss_report_request(cr, &command_status, &scsi_status); - csio->scsi_status = scsi_status; - - /* - * Handle specific SCSI status values. - */ - switch(scsi_status) { - /* no status due to adapter error */ - case -1: - debug(0, "adapter error"); - csio->ccb_h.status |= CAM_REQ_CMP_ERR; - break; - - /* no status due to command completed OK */ - case SCSI_STATUS_OK: /* CISS_SCSI_STATUS_GOOD */ + switch(command_status) { + case CISS_CMD_STATUS_DATA_UNDERRUN: + csio->resid = ce->residual_count; + /* FALLTHROUGH */ + case CISS_CMD_STATUS_SUCCESS: + csio->scsi_status = scsi_status; debug(2, "SCSI_STATUS_OK"); csio->ccb_h.status |= CAM_REQ_CMP; break; - - /* check condition, sense data included */ - case SCSI_STATUS_CHECK_COND: /* CISS_SCSI_STATUS_CHECK_CONDITION */ - debug(0, "SCSI_STATUS_CHECK_COND sense size %d resid %d\n", - ce->sense_length, ce->residual_count); + case CISS_CMD_STATUS_TARGET_STATUS: + csio->scsi_status = scsi_status; bzero(&csio->sense_data, SSD_FULL_SIZE); bcopy(&ce->sense_info[0], &csio->sense_data, ce->sense_length); if (csio->sense_len > ce->sense_length) @@ -3341,22 +3332,11 @@ ciss_cam_complete(struct ciss_request *cr) csio->sense_resid = 0; csio->resid = ce->residual_count; csio->ccb_h.status |= CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; -#ifdef CISS_DEBUG - { - struct scsi_sense_data *sns = (struct scsi_sense_data *)&ce->sense_info[0]; - debug(0, "sense key %x", scsi_get_sense_key(sns, csio->sense_len - - csio->sense_resid, /*show_errors*/ 1)); - } -#endif break; - - case SCSI_STATUS_BUSY: /* CISS_SCSI_STATUS_BUSY */ - debug(0, "SCSI_STATUS_BUSY"); - csio->ccb_h.status |= CAM_SCSI_BUSY; + case CISS_CMD_STATUS_DATA_OVERRUN: + csio->ccb_h.status |= CAM_DATA_RUN_ERR; break; - default: - debug(0, "unknown status 0x%x", csio->scsi_status); csio->ccb_h.status |= CAM_REQ_CMP_ERR; break; } From owner-dev-commits-src-main@freebsd.org Sun Sep 19 18:08:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CEF266EE81; Sun, 19 Sep 2021 18:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCFzx3Rmfz4QrM; Sun, 19 Sep 2021 18:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50EA7217D2; Sun, 19 Sep 2021 18:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JI8Tio014660; Sun, 19 Sep 2021 18:08:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JI8TI6014659; Sun, 19 Sep 2021 18:08:29 GMT (envelope-from git) Date: Sun, 19 Sep 2021 18:08:29 GMT Message-Id: <202109191808.18JI8TI6014659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 5f8cb13cfb0c - main - ciss(4): Fix typo. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 18:08:29 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6 commit 5f8cb13cfb0c91a4ec1a9648a3ae245b1dff36f6 Author: Alexander Motin AuthorDate: 2021-09-19 18:01:40 +0000 Commit: Alexander Motin CommitDate: 2021-09-19 18:08:22 +0000 ciss(4): Fix typo. --- sys/dev/ciss/ciss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 36d1225fbe4a..d87f32610b20 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -1283,7 +1283,7 @@ ciss_identify_adapter(struct ciss_softc *sc) "\20\1ultra2\2ultra3\10fibre1\11fibre2\n"); ciss_printf(sc, " server name '%.16s'\n", sc->ciss_cfg->server_name); ciss_printf(sc, " heartbeat 0x%x\n", sc->ciss_cfg->heartbeat); - ciss_printf(sc, " max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); + ciss_printf(sc, " max logical volumes: %d\n", sc->ciss_cfg->max_logical_supported); ciss_printf(sc, " max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported); ciss_printf(sc, " max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical); ciss_printf(sc, " JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ? From owner-dev-commits-src-main@freebsd.org Sun Sep 19 18:31:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61C7866F594; Sun, 19 Sep 2021 18:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCGVj2LKrz4X5b; Sun, 19 Sep 2021 18:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 312AA22068; Sun, 19 Sep 2021 18:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JIVfe5053295; Sun, 19 Sep 2021 18:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JIVfIW053294; Sun, 19 Sep 2021 18:31:41 GMT (envelope-from git) Date: Sun, 19 Sep 2021 18:31:41 GMT Message-Id: <202109191831.18JIVfIW053294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bd3a668087ef - main - vm_page_startup: correct calculation of the starting page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd3a668087efb02e8e84315f7cc29d3813270dff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 18:31:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd3a668087efb02e8e84315f7cc29d3813270dff commit bd3a668087efb02e8e84315f7cc29d3813270dff Author: Konstantin Belousov AuthorDate: 2021-09-17 18:48:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-19 18:27:55 +0000 vm_page_startup: correct calculation of the starting page Also avoid unneded calculations when phys segment end is the phys_avail[] start. Submitted by: alc Reviewed by: markj MFC after: 1 week Fixes: 181bfb42fd01bfa9f46 Differential revision: https://reviews.freebsd.org/D32009 --- sys/vm/vm_page.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index d2e94ced6766..25e6dce32aa6 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -775,27 +775,25 @@ vm_page_startup(vm_offset_t vaddr) * phys_avail's ranges to the free lists. */ for (i = 0; phys_avail[i + 1] != 0; i += 2) { - if (seg->end < phys_avail[i] || + if (seg->end <= phys_avail[i] || seg->start >= phys_avail[i + 1]) continue; startp = MAX(seg->start, phys_avail[i]); - m = seg->first_page + atop(seg->start - startp); endp = MIN(seg->end, phys_avail[i + 1]); pagecount = (u_long)atop(endp - startp); if (pagecount == 0) continue; + m = seg->first_page + atop(startp - seg->start); vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); vm_phys_enqueue_contig(m, pagecount); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, pagecount); vm_cnt.v_page_count += (u_int)pagecount; - - vmd = VM_DOMAIN(seg->domain); vmd->vmd_page_count += (u_int)pagecount; - vmd->vmd_segs |= 1UL << m->segind; + vmd->vmd_segs |= 1UL << segind; } } From owner-dev-commits-src-main@freebsd.org Sun Sep 19 22:26:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7C0D672A32; Sun, 19 Sep 2021 22:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCMjS5zYbz4h45; Sun, 19 Sep 2021 22:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A967B25026; Sun, 19 Sep 2021 22:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18JMQKXk061693; Sun, 19 Sep 2021 22:26:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18JMQKbU061692; Sun, 19 Sep 2021 22:26:20 GMT (envelope-from git) Date: Sun, 19 Sep 2021 22:26:20 GMT Message-Id: <202109192226.18JMQKbU061692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 5a01dea7e8c9 - main - style: Fix leading whitespace in bcache.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a01dea7e8c9640605e5731a9fc7f600c07ace61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2021 22:26:21 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=5a01dea7e8c9640605e5731a9fc7f600c07ace61 commit 5a01dea7e8c9640605e5731a9fc7f600c07ace61 Author: Colin Percival AuthorDate: 2021-09-19 22:24:00 +0000 Commit: Colin Percival CommitDate: 2021-09-19 22:24:00 +0000 style: Fix leading whitespace in bcache.c MFC after: 2 weeks X-MFC-with: Further bcache changes to come --- stand/common/bcache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stand/common/bcache.c b/stand/common/bcache.c index 526f9fe3fa5c..0eeb7e74ee96 100644 --- a/stand/common/bcache.c +++ b/stand/common/bcache.c @@ -246,12 +246,12 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, } } - if (complete) { /* whole set was in cache, return it */ + if (complete) { /* whole set was in cache, return it */ if (bc->ra < BCACHE_READAHEAD) bc->ra <<= 1; /* increase read ahead */ bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); goto done; - } + } /* * Fill in any misses. From check we have i pointing to first missing @@ -351,7 +351,7 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t size, result = 0; } - done: +done: if (result == 0) { if (rsize != NULL) *rsize = size;