From owner-svn-src-all@freebsd.org Thu Jun 18 21:42:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4989B334E33; Thu, 18 Jun 2020 21:42:55 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49nwQl10R2z46vL; Thu, 18 Jun 2020 21:42:55 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DA031081F; Thu, 18 Jun 2020 21:42:55 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05ILgspG091827; Thu, 18 Jun 2020 21:42:54 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ILgsae091825; Thu, 18 Jun 2020 21:42:54 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202006182142.05ILgsae091825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Thu, 18 Jun 2020 21:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362343 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 362343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2020 21:42:55 -0000 Author: kaktus Date: Thu Jun 18 21:42:54 2020 New Revision: 362343 URL: https://svnweb.freebsd.org/changeset/base/362343 Log: hw.bus.info: rework handler hw.bus.info was added in r68522 as a node, but there was never anything connected "behind" it. Its only purpose is to return a struct u_businfo. The only in-base consumer are devinfo(3)/devinfo(8). Rewrite the handler as SYSCTL_PROC and mark it as MPSAFE and read-only as there never was a writable path. Reviewed by: kib Approved by: kib (mentor) Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D25321 Modified: head/sys/kern/subr_bus.c head/sys/sys/sysctl.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Jun 18 20:49:56 2020 (r362342) +++ head/sys/kern/subr_bus.c Thu Jun 18 21:42:54 2020 (r362343) @@ -5454,7 +5454,7 @@ print_devclass_list(void) */ static int -sysctl_bus(SYSCTL_HANDLER_ARGS) +sysctl_bus_info(SYSCTL_HANDLER_ARGS) { struct u_businfo ubus; @@ -5463,7 +5463,8 @@ sysctl_bus(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, &ubus, sizeof(ubus))); } -SYSCTL_NODE(_hw_bus, OID_AUTO, info, CTLFLAG_RW | CTLFLAG_NEEDGIANT, sysctl_bus, +SYSCTL_PROC(_hw_bus, OID_AUTO, info, CTLTYPE_STRUCT | CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, 0, sysctl_bus_info, "S,u_businfo", "bus-related data"); static int @@ -5555,7 +5556,8 @@ bus_data_generation_check(int generation) void bus_data_generation_update(void) { - bus_data_generation++; + + atomic_add_int(&bus_data_generation, 1); } int Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Jun 18 20:49:56 2020 (r362342) +++ head/sys/sys/sysctl.h Thu Jun 18 21:42:54 2020 (r362343) @@ -1122,7 +1122,6 @@ SYSCTL_DECL(_dev); SYSCTL_DECL(_hw); SYSCTL_DECL(_hw_bus); SYSCTL_DECL(_hw_bus_devices); -SYSCTL_DECL(_hw_bus_info); SYSCTL_DECL(_machdep); SYSCTL_DECL(_machdep_mitigations); SYSCTL_DECL(_user);