From owner-svn-src-head@freebsd.org Sun Nov 3 22:48:01 2019 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 4FDBD1AA676 for ; Sun, 3 Nov 2019 22:48:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475rg46S89z4t6k for ; Sun, 3 Nov 2019 22:48:00 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572821279; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=kiPpHX5no+Ne1u1b4u88fzRluOErREfPq1hEEiDoRIYMIMyUh4pPoBEAJguWcb6fgLHXsPvLNt1Ov 5b29LipZ1qEIGZ5TSl7mapgiZDiBje/lM5Wggc3lZTJJMTXnuqOm2q+CwNWgC/2ZKrnSIY8SrJqjNm EqEJkZW4Dh3bV8wBwMttcqJ5NAZGB1jgBtZNTSATJ+ATmxBiMkizqpfxhry1cL886o0C60t2/uhyW+ AxWoYHQUeP9TGmgVRdY729cM1dShgB1iIxx8YEKWVIUx06olWH5+bPYhZmTDEte5T1gL8ozrOV35uw qEm9Bq9JFn+Zpsxs2ttrkJBis00e5TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=wYH1OUZ4LmWdsJoZ82b4+pyeA6hILXZNYw/hfWN+Gvk=; b=PCNPjBvgZVGIQt2vDJ2nhZhxD0m1mgtVLiiOHrxZb0u/SjTCrdHC5frcgNSevlVDx0Mt3+YzclYPJ gwj7Z848C2GOvv8d58rygdaJe8qoJuIofTcJHHgOP2wg/4BeQ72wol3CqHE0/69W/2vUZXkJx/F7EX Ia56f4Mso6qf3jUHIG4FFA3+KFig+tHmLbf/g5XcWOS/s5LnybCWNmJa9eV9r0g2FsGLr8m2E08xxp QkMH9vGWvci/Z5zAeXHPAL60pOH18VSxN8iaib5ZmCITk6MRqL+jRPkHqtC/omo4Mnf8GInN0k3xfa vgdvsd3KdYTdQ3myBpCMViO+jR8whIQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=wYH1OUZ4LmWdsJoZ82b4+pyeA6hILXZNYw/hfWN+Gvk=; b=sE9fklTfrF8j+HKAs92KUC4Sn5/Af8dWJpC36rLOEx1+MaaxN12WutluqhnZ6EaVQwUQHww+g8toF LqYSpyh06CRETXkgchRsaOajqmlnkCSmAGq3kDv59vjkMJQVJZbtXHgk3UTv6UNDoIZyLvyL5zMnVL xq6ufiR6aLKR+CUQkj+cqi0owNAFNOFpl6sQ21ZEG5rUfZiSu4NU+SVhGQRJWGEqakaC2dwyTp0OxZ AMR50RLfJyQeq5sP71g/5vrDj6tuN4MFHwc+aWGG9UWB5KI6eoq8Lj2ruxW0+0RCy/Sy1eDgCnDx5l PHq4qsIDBjvnEZ2dtggUN978L3FZ/tw== X-MHO-RoutePath: aGlwcGll X-MHO-User: fa5cfedc-fe8b-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id fa5cfedc-fe8b-11e9-b80b-052b4a66b6b2; Sun, 03 Nov 2019 22:47:58 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xA3MluBA085719; Sun, 3 Nov 2019 15:47:56 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r354322 - head/sys/dev/ichiic From: Ian Lepore To: Vladimir Kondratyev , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 03 Nov 2019 15:47:56 -0700 In-Reply-To: <201911032117.xA3LHpKK078186@repo.freebsd.org> References: <201911032117.xA3LHpKK078186@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 475rg46S89z4t6k X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Sun, 03 Nov 2019 22:48:01 -0000 On Sun, 2019-11-03 at 21:17 +0000, Vladimir Kondratyev wrote: > Author: wulf > Date: Sun Nov 3 21:17:50 2019 > New Revision: 354322 > URL: https://svnweb.freebsd.org/changeset/base/354322 > > Log: > [ig4] Convert ithread interrupt handler to filter based one. > This doesn't seem like a very good idea. I2c comms is way too slow to benefit from handling the interrupt in the primary interrupt context. All it will accomplish is to make other (perhaps more time-critical) interrupts wait for service while this handler runs (although, admittedly, this handler doesn't do much more than a couple register accesses and a wakeup()). -- Ian > Modified: > head/sys/dev/ichiic/ig4_iic.c > > Modified: head/sys/dev/ichiic/ig4_iic.c > ===================================================================== > ========= > --- head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:01 2019 (r354 > 321) > +++ head/sys/dev/ichiic/ig4_iic.c Sun Nov 3 21:17:50 2019 (r354 > 322) > @@ -122,7 +122,7 @@ static const struct ig4_hw ig4iic_hw[] = { > }; > > static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); > -static void ig4iic_intr(void *cookie); > +static driver_filter_t ig4iic_intr; > static void ig4iic_dump(ig4iic_softc_t *sc); > > static int ig4_dump; > @@ -297,12 +297,12 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) > * When polling is not requested let the interrupt do > its work. > */ > if (!DO_POLL(sc)) { > - mtx_lock(&sc->io_lock); > + mtx_lock_spin(&sc->io_lock); > set_intr_mask(sc, intr | IG4_INTR_ERR_MASK); > - mtx_sleep(sc, &sc->io_lock, 0, "i2cwait", > + msleep_spin(sc, &sc->io_lock, "i2cwait", > (hz + 99) / 100); /* sleep up to 10ms > */ > set_intr_mask(sc, 0); > - mtx_unlock(&sc->io_lock); > + mtx_unlock_spin(&sc->io_lock); > count_us += 10000; > } else { > DELAY(25); > @@ -1010,7 +1010,7 @@ ig4iic_attach(ig4iic_softc_t *sc) > { > int error; > > - mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); > + mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_SPIN); > sx_init(&sc->call_lock, "IG4 call lock"); > > ig4iic_get_config(sc); > @@ -1037,7 +1037,7 @@ ig4iic_attach(ig4iic_softc_t *sc) > goto done; > } > error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | > INTR_MPSAFE, > - NULL, ig4iic_intr, sc, &sc- > >intr_handle); > + ig4iic_intr, NULL, sc, &sc- > >intr_handle); > if (error) { > device_printf(sc->dev, > "Unable to setup irq: error %d\n", > error); > @@ -1127,19 +1127,23 @@ int ig4iic_resume(ig4iic_softc_t *sc) > /* > * Interrupt Operation, see ig4_var.h for locking semantics. > */ > -static void > +static int > ig4iic_intr(void *cookie) > { > ig4iic_softc_t *sc = cookie; > + int retval = FILTER_STRAY; > > - mtx_lock(&sc->io_lock); > + mtx_lock_spin(&sc->io_lock); > /* Ignore stray interrupts */ > if (sc->intr_mask != 0 && reg_read(sc, IG4_REG_INTR_STAT) != 0) > { > /* Interrupt bits are cleared in wait_intr() loop */ > set_intr_mask(sc, 0); > wakeup(sc); > + retval = FILTER_HANDLED; > } > - mtx_unlock(&sc->io_lock); > + mtx_unlock_spin(&sc->io_lock); > + > + return (retval); > } > > #define REGDUMP(sc, reg) \