From nobody Fri Oct 07 11:41:37 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MkRGn3czLz4V8PY; Fri, 7 Oct 2022 11:41: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 4MkRGn369Gz3gWp; Fri, 7 Oct 2022 11:41:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665142897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XH099HNvTdIfcJiHdQwYl6S616DNLL7i8Rg87A/5dCs=; b=Kf+b+4A9YaTzZT6bA0VNPVia7o/pnYXXRBU47fldYe8snnq9NL4t/uoW3e9dCbPdyB8Wcu iscarbgrKZXs1P+3A1P/cAWNQVcqayqvaay+EvShCNKoqW3C36QT8/D0pDsGzPdhZy1T6M V5AYKrXo+fgnZYMh3SZojuBVBzFf99b9F9/wacifpoOtBSWUPo+x+MtoMKFJ1jJaBZBKMF gi6I10++Y8UujsB6IFvmD4bM4dt3Q5F9+nv3YpWRj50RymZAyPiMInW6SWNmNxBRz1AXvN DuH/MAwEXYRhDa9+2/ZGWJzEBY+k5CoLvu4/A6JeRDIQ+3msE5E7iRrMur3Jrg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MkRGn2C9Dzb43; Fri, 7 Oct 2022 11:41: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 297Bfbmg071384; Fri, 7 Oct 2022 11:41:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 297Bfb1B071383; Fri, 7 Oct 2022 11:41:37 GMT (envelope-from git) Date: Fri, 7 Oct 2022 11:41:37 GMT Message-Id: <202210071141.297Bfb1B071383@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: 8758aabb169d - main - usb(4): Make the enumeration thread nice time a variable. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org 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: 8758aabb169d98f08c20f2a1fce5184434b1ddf6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665142897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XH099HNvTdIfcJiHdQwYl6S616DNLL7i8Rg87A/5dCs=; b=ZzblWid+7MyERWosaWnXSZXN3XS2hbEzICLXzjLqBlqZ6ylQAKN9lsmFEBCqVUywW5mfE+ yi2IDueb8dsznlVZO1Tn42vGjprqKn78MJ25OsxP1a7pdEnXMYUT1Ti5jjisO0xh3LsWDp h4PurJGDZ5nuPdq82DiU1kv0Lmkp/tvsQc0tzsQfsQ5vqA6asBqGT11KEcTl9gtV7+kcL5 fp5uTQ+jjVf2jM4RH9FsPvHCR37/Hr47q/Vky30q5zwWOZW+kwJUx9zHQ0gW2BqPJrrWjH 6xdRFmjqyKXz1JcQClJD7QaMF0A3lKHOmWjbSUMRcFDWeIKpah5T6M6V8lwrQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665142897; a=rsa-sha256; cv=none; b=PgsA9P3lwUppwYiZfq5zyTRVS72llbxalUGj8ePM4X2p6KekgMVIJu+hSlDlNeUWu6+whB 46obhKUnYEkysK2VglwyqFK0zqRsPj2DOmwKuumh8ouzpViwXa5wyuuJjdivREK/D1dgm8 zNcLxBGKATwhTTtbpqFO1h96StFalirwA0MEr2cKF5WcdEDKByI/DLJW+sB+g1Tg0vsFni Yt4wMidNstzysN9OKgJVk0pA8cajvzEr5cORB9t7oa/JaaVpA7wflWe5+nX4b6xKifZvK8 U5bQims8oyaZ2TTmnO6Qz5xFfshQ7eS7WQIemE2y1sd/RV9XvOvD95iE7a6X7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8758aabb169d98f08c20f2a1fce5184434b1ddf6 commit 8758aabb169d98f08c20f2a1fce5184434b1ddf6 Author: Hans Petter Selasky AuthorDate: 2022-10-07 11:28:38 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-07 11:41:00 +0000 usb(4): Make the enumeration thread nice time a variable. Depends on "options USB_DEBUG". Suggested by: koobs@ MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/controller/usb_controller.c | 2 +- sys/dev/usb/usb.h | 1 + sys/dev/usb/usb_debug.c | 7 ++++++- sys/dev/usb/usb_debug.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c index 959f54a4583f..783c9c32dab2 100644 --- a/sys/dev/usb/controller/usb_controller.c +++ b/sys/dev/usb/controller/usb_controller.c @@ -416,7 +416,7 @@ usb_bus_explore(struct usb_proc_msg *pm) #endif /* Nice the enumeration a bit, to avoid looping too fast. */ - usb_pause_mtx(&bus->bus_mtx, USB_MS_TO_TICKS(16)); + usb_pause_mtx(&bus->bus_mtx, USB_MS_TO_TICKS(usb_enum_nice_time)); } /*------------------------------------------------------------------------* diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index ad0381366f98..0bef7a10bc6c 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -123,6 +123,7 @@ MALLOC_DECLARE(M_USBDEV); #define USB_RESUME_WAIT 50 /* ms */ #define USB_RESUME_RECOVERY 50 /* ms */ #define USB_EXTRA_POWER_UP_TIME 20 /* ms */ +#define USB_ENUM_NICE_TIME 16 /* ms */ #define USB_MIN_POWER 100 /* mA */ #define USB_MAX_POWER 500 /* mA */ diff --git a/sys/dev/usb/usb_debug.c b/sys/dev/usb/usb_debug.c index 5e521f7ec3a5..6ad8dce9a037 100644 --- a/sys/dev/usb/usb_debug.c +++ b/sys/dev/usb/usb_debug.c @@ -2,7 +2,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008-2022 Hans Petter Selasky * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -123,6 +123,10 @@ SYSCTL_PROC(_hw_usb_timings, OID_AUTO, extra_power_up_time, CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_extra_power_up_time, sizeof(usb_extra_power_up_time), usb_timings_sysctl_handler, "IU", "Extra PowerUp Time"); +SYSCTL_PROC(_hw_usb_timings, OID_AUTO, enum_nice_time, + CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, &usb_enum_nice_time, + sizeof(usb_enum_nice_time), usb_timings_sysctl_handler, "IU", + "Enumeration thread nice time"); #endif /*------------------------------------------------------------------------* @@ -245,6 +249,7 @@ unsigned int usb_resume_delay = USB_RESUME_DELAY; unsigned int usb_resume_wait = USB_RESUME_WAIT; unsigned int usb_resume_recovery = USB_RESUME_RECOVERY; unsigned int usb_extra_power_up_time = USB_EXTRA_POWER_UP_TIME; +unsigned int usb_enum_nice_time = USB_ENUM_NICE_TIME; /*------------------------------------------------------------------------* * usb_timings_sysctl_handler diff --git a/sys/dev/usb/usb_debug.h b/sys/dev/usb/usb_debug.h index 9bcbaec70ef4..c9df04111b60 100644 --- a/sys/dev/usb/usb_debug.h +++ b/sys/dev/usb/usb_debug.h @@ -74,6 +74,7 @@ extern unsigned int usb_resume_delay; extern unsigned int usb_resume_wait; extern unsigned int usb_resume_recovery; extern unsigned int usb_extra_power_up_time; +extern unsigned int usb_enum_nice_time; #else #define usb_port_reset_delay USB_PORT_RESET_DELAY #define usb_port_root_reset_delay USB_PORT_ROOT_RESET_DELAY @@ -85,6 +86,7 @@ extern unsigned int usb_extra_power_up_time; #define usb_resume_wait USB_RESUME_WAIT #define usb_resume_recovery USB_RESUME_RECOVERY #define usb_extra_power_up_time USB_EXTRA_POWER_UP_TIME +#define usb_enum_nice_time USB_ENUM_NICE_TIME #endif #endif /* _USB_DEBUG_H_ */