From owner-svn-src-head@freebsd.org Fri Aug 28 16:40:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 845033B73B3; Fri, 28 Aug 2020 16:40:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-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 4BdQM631W1z3bLV; Fri, 28 Aug 2020 16:40:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C6B7175DE; Fri, 28 Aug 2020 16:40:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07SGeYr0058101; Fri, 28 Aug 2020 16:40:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07SGeXTb058099; Fri, 28 Aug 2020 16:40:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202008281640.07SGeXTb058099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 28 Aug 2020 16:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364920 - in head/sys: dev/speaker sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/speaker sys X-SVN-Commit-Revision: 364920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 16:40:34 -0000 Author: imp Date: Fri Aug 28 16:40:33 2020 New Revision: 364920 URL: https://svnweb.freebsd.org/changeset/base/364920 Log: Remove splclock(). It's not useful to keep. splclock is used in one driver (spkr) to control access to timer_spkr_* routines. However, nothing else does. So it shows no useful locking info to someone that would want to lock spkr. NOTE: I think there's races with timer_spkr_{acquire,release} since there's no interlock in those routines, despite there being a spin lock to protect the clock. Current other users appear to use no extra locking protocol, though they themselves appear to be at least attempting to make sure that only a single thread calls these routines. I suspect the right answer is to update these routines to take/release the clock spin lock since they are short and to the point, but that's beyond the scope of this commit. Modified: head/sys/dev/speaker/spkr.c head/sys/sys/systm.h Modified: head/sys/dev/speaker/spkr.c ============================================================================== --- head/sys/dev/speaker/spkr.c Fri Aug 28 15:35:45 2020 (r364919) +++ head/sys/dev/speaker/spkr.c Fri Aug 28 16:40:33 2020 (r364920) @@ -65,7 +65,7 @@ static void playstring(char *cp, size_t slen); static void tone(unsigned int thz, unsigned int centisecs) { - int sps, timo; + int timo; if (thz <= 0) return; @@ -75,14 +75,10 @@ tone(unsigned int thz, unsigned int centisecs) #endif /* DEBUG */ /* set timer to generate clicks at given frequency in Hertz */ - sps = splclock(); - if (timer_spkr_acquire()) { /* enter list of waiting procs ??? */ - splx(sps); return; } - splx(sps); disable_intr(); timer_spkr_setfreq(thz); enable_intr(); @@ -95,9 +91,7 @@ tone(unsigned int thz, unsigned int centisecs) timo = centisecs * hz / 100; if (timo > 0) tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", timo); - sps = splclock(); timer_spkr_release(); - splx(sps); } /* Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Aug 28 15:35:45 2020 (r364919) +++ head/sys/sys/systm.h Fri Aug 28 16:40:33 2020 (r364920) @@ -497,7 +497,6 @@ void kern_reboot(int) __dead2; void shutdown_nice(int); /* Stubs for obsolete functions that used to be for interrupt management */ -static __inline intrmask_t splclock(void) { return 0; } static __inline intrmask_t splhigh(void) { return 0; } static __inline intrmask_t splimp(void) { return 0; } static __inline intrmask_t splnet(void) { return 0; }