From owner-svn-src-all@freebsd.org Tue Sep 3 14:08:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88D48DD7C7; Tue, 3 Sep 2019 14:07:16 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N80M4tYcz4QQY; Tue, 3 Sep 2019 14:07:15 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 069E81B37D; Tue, 3 Sep 2019 14:06:34 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 6735D2BE0; Sun, 21 Apr 2019 20:55:37 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E3A989A39; Sun, 21 Apr 2019 20:55:37 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0C1F32BDF; Sun, 21 Apr 2019 20:55:37 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 39FBB2BDD for ; Sun, 21 Apr 2019 20:55:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3B1689A36; Sun, 21 Apr 2019 20:55:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B38562C39; Sun, 21 Apr 2019 20:55:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3LKtXi7078132; Sun, 21 Apr 2019 20:55:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3LKtX9T078131; Sun, 21 Apr 2019 20:55:33 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201904212055.x3LKtX9T078131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r346500 - stable/12/sys/arm/arm X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/arm X-SVN-Commit-Revision: 346500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 2E3A989A39 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] Status: O X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:08:11 -0000 X-Original-Date: Sun, 21 Apr 2019 20:55:33 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:08:11 -0000 Author: ian Date: Sun Apr 21 20:55:33 2019 New Revision: 346500 URL: https://svnweb.freebsd.org/changeset/base/346500 Log: MFC r346312: Only set up the interrupts that will actually be used in arm generic_timer. The code previously set up interrupt handlers for all the interrupt resources available, including for timers that are not in use. That could lead to interrupt storms. For example, if boot firmware enabled the virtual timer but the kernel is using the physical timer, it could get flooded with interrupts on the virtual timer which it cannot shut off. By only setting up an interrupt handler for the hardware that will actually be used, any interrupts from other timer units will remain masked in the interrupt controller. Differential Revision: https://reviews.freebsd.org/D19871 Modified: stable/12/sys/arm/arm/generic_timer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/arm/generic_timer.c ============================================================================== --- stable/12/sys/arm/arm/generic_timer.c Sun Apr 21 20:53:15 2019 (r346499) +++ stable/12/sys/arm/arm/generic_timer.c Sun Apr 21 20:55:33 2019 (r346500) @@ -396,7 +396,7 @@ arm_tmr_attach(device_t dev) pcell_t clock; #endif int error; - int i; + int i, first_timer, last_timer; sc = device_get_softc(dev); if (arm_tmr_sc) @@ -436,17 +436,25 @@ arm_tmr_attach(device_t dev) return (ENXIO); } -#ifdef __arm__ - sc->physical = true; -#else /* __aarch64__ */ - /* If we do not have a virtual timer use the physical. */ - sc->physical = (sc->res[2] == NULL) ? true : false; +#ifdef __aarch64__ + /* Use the virtual timer if we have one. */ + if (sc->res[2] != NULL) { + sc->physical = false; + first_timer = 2; + last_timer = 2; + } else #endif + /* Otherwise set up the secure and non-secure physical timers. */ + { + sc->physical = true; + first_timer = 0; + last_timer = 1; + } arm_tmr_sc = sc; /* Setup secure, non-secure and virtual IRQs handler */ - for (i = 0; i < 3; i++) { + for (i = first_timer; i <= last_timer; i++) { /* If we do not have the interrupt, skip it. */ if (sc->res[i] == NULL) continue;