Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5374064pxb; Mon, 15 Feb 2021 18:21:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5CFk+gpK13zfBkYjGXLksszkaQCrZ7MDxZGV8KxifQqSQF0fTA66aQ96WYkkzXtl53VDl X-Received: by 2002:a17:906:b001:: with SMTP id v1mr18347708ejy.217.1613442090080; Mon, 15 Feb 2021 18:21:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613442090; cv=none; d=google.com; s=arc-20160816; b=yIfIpi0CfAHvoCRCrFkUKIziyXFrqcHYuGnP/1lfetEcvh/Pxlvn83XPvWJDt9sory VHLMwT8wyM2JsX/4v4Bm6+qa0AlmWihp/fZKB+uw2hVENcp40aA8sD5kRLXN3wv/hM5G 3r3/E4uENRuRkvPfhFFsP1s6YrbGvUGYtbY2Enz2nXcym/Vdb0S+9e+xOo7j166GipwU yljp0De/xB0YgzlPceX+x0eKno55LFk9kbBmWr8HGS4PqXjnDqtcDMGHkdBH2wQDKtew 5mzt7kq8bcQK61LNlKklYNEaKbKLmnluezLtHHkXfyq7RBDl2MtjUY6tANCG0xsTLIUw EorA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lb/pFWHszNknFvlysVhnuzVrA5hrw2/iv1f49uuCHHc=; b=dHQgHzrQSmxDvohtxzNH2kCLzvLP3aGylaYvu/DOESbvk+bsMWxe81LkyeixCA4Mfb KPfnGzaiFzkAqt95uILXDuEKnWjEAExJwIp6yX/lER7wt0tWTbB5MxSxOEvNeOaOeGhP yhq6bPjuQkITSNU4dcunqDr0izN4C0ROkGzAqOBF6gj2HRlmBSV4ckiJlTnY0QxZ1Ksu ixcS1D4S3YHXv9/Q1n6MmIMU2ewrAnnvuPU0JU9GgK95QEDXJrjyIKKL7BuP/lJbLzZp 3jwKE6GUWnWmUEVQFs0H0xOdAKWq80+Iv4mepjbxIVtsC9VOHMqG6unWJuBXNr5Ijepb QDKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JI8bTZ/Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si12851561edz.497.2021.02.15.18.21.06; Mon, 15 Feb 2021 18:21:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JI8bTZ/Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhBPCRF (ORCPT + 99 others); Mon, 15 Feb 2021 21:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbhBPCQv (ORCPT ); Mon, 15 Feb 2021 21:16:51 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670E5C061574; Mon, 15 Feb 2021 18:16:11 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id w18so5242357pfu.9; Mon, 15 Feb 2021 18:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lb/pFWHszNknFvlysVhnuzVrA5hrw2/iv1f49uuCHHc=; b=JI8bTZ/ZGvq50e31unyKdwZwCoOB4y8l9dgZK/MuqjfNS6yi/nhSsRotwpkjqroAOQ 7ZizadhCd0etnXIkksrH6rBq1MPC5tg8tKoHMMHhha1LV6RDNUSxMocBxKX+6yCBlB9i CF2WblOFfA4PuN39N3WBdcIJX4KtMTduaEG6IXYuRwMeZRSmjGcIlDaA+PVs1qZ8DFOX F05hvCPi8IwGPxfPLvPw+juA884nIzZhOfS+Ha+VGwQa4X0cyPhF9Eqs5rt4f9VawxwV 1FGYJoJilbIXAYyAAbgXEpC2arpzt44bEoS6FWlXno5q/jhS+2VjSfeBfgP10ihDRUt9 MeAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lb/pFWHszNknFvlysVhnuzVrA5hrw2/iv1f49uuCHHc=; b=uYSrq4iHd+Gzp7CR73f6QzE++8cs3O84cHgTzwEwX2fgmQl6JQGs77mMh4gRMSb2Mv B+5aNKlrE22JKGP03JCwrUeoMh6EhLM+li57qnoF6F9AfScVXK8S8Pxcyo/+nMOcto2Y py1q7z0CMfukDgEHxDskjbzlnB4+smRkcdId1tLGIE9Gn77S9qnbL4H7W6pPzVUXvmOl BT95fUn5PZuXhyrtM+YgrqOwMRIN8NGjGN9wd9kyTm7qighs0zUezJ/5dejEHf6Sd+E9 17thaTR2IcyPsyi//GHYw0cCQV/hrqkr/NWolp6y2Fpmx/ClBchBSyqxepFRowWObDcy 0GAw== X-Gm-Message-State: AOAM532R5A0y9JsyBodO0wfGHIE9elUc96aGZfxYQ9uMRM+fYP8ftck0 3NQ/CEFFnBX+DyZnzukG2HeyK5MxjGLV/A== X-Received: by 2002:a62:c719:0:b029:1ec:c587:3c5a with SMTP id w25-20020a62c7190000b02901ecc5873c5amr1320838pfg.27.1613441770889; Mon, 15 Feb 2021 18:16:10 -0800 (PST) Received: from shinobu ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id b17sm18608375pfl.190.2021.02.15.18.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 18:16:10 -0800 (PST) Date: Tue, 16 Feb 2021 11:16:03 +0900 From: William Breathitt Gray To: Jonathan Cameron Cc: kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de Subject: Re: [PATCH v8 21/22] counter: 104-quad-8: Replace mutex with spinlock Message-ID: References: <20210214181946.1d2f7e78@archlinux> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HfLQjWKfp3+aIQDU" Content-Disposition: inline In-Reply-To: <20210214181946.1d2f7e78@archlinux> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --HfLQjWKfp3+aIQDU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 14, 2021 at 06:19:46PM +0000, Jonathan Cameron wrote: > On Fri, 12 Feb 2021 21:13:45 +0900 > William Breathitt Gray wrote: >=20 > > This patch replaces the mutex I/O lock with a spinlock. This is in > > preparation for a subsequent patch adding IRQ support for 104-QUAD-8 > > devices; we can't sleep in an interrupt context, so we'll need to use a > > spinlock instead. > >=20 > > Cc: Syed Nayyar Waris > > Signed-off-by: William Breathitt Gray >=20 > Why do these need to be raw_spin_locks? > Normally only need to do that if in code related to interrupt chips etc, > not their use. >=20 > Jonathan This lock can be taken in an interrupt context in a subsequent patch: counter_push_event() called by quad8_irq_handler() can end up calling the Counter component callbacks which take this lock. We can't use a mutex nor a regular spinlock because those can sleep on RT setups [1] which would result in a deadlock due to the interrupt context here -- so therefore we're left with using raw_spin_lock. [1] https://lwn.net/Articles/367219/ William Breathitt Gray --HfLQjWKfp3+aIQDU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAmArKuMACgkQhvpINdm7 VJKp3BAAlS2Vs6gAvh5SArki6q5IaQsXcy9P9ApPJpGXN1aw41Ww/OOyJ8HutGNE jzKXcr4QxWrtrHBeM4S9hz9R4Wo3M+LbGSu8HUz/MY5DyGGglcI6PAb5LDoQS7vQ 4/N1ymMuu5Pmht/uA4ZWA6ZeU54Y0Dor+IXmit1BPBwo7ooYctbNvh+vdoNlZSxg 0sWQPD9m95Vd3FwCuhQ4vzyZXy/FEr5PFiyy0fwa+5Wndof9DbA+5VYcrRBZdB7v a1xiIT8B+0eq7eElaAYM3clZdJwF9utTYMi6oqkrZCU6iMYLZD+W0BhyOcxA4LTO s7KjhqBwS7sDObxEx0JD5OHh+mGU8h7QzZ3hF9o2git8cL3Y22bKMMamTnJRGWay vlU5B7KF8l6Rg8Hf8cfspWC6cwp0iXhA/fNCIjxVDikQr/GxqdkMDHvIxzz7KID5 YCWz1UCBRxOe9hBOBPSa7p/QbPKnk2DFP3RSgwEknaRZag0/6PO4aou0yxFSsGJO f0bI3cp64xK5sE74Mv5T0OFNPdcgtftKi1hES711uJZwyWdoIdz7T4mikmVt2r7D 0N1oeEckjiFzF4wzvMU4KX2NImw/8ef0Dz/XTvSvI6Ae1FVnshCj7sZ4RfrO9W/L 4x84eyP5JTdZeLHhH7M8Fuw2XOYmF/+8Jeye5Os7njSB4+DU6Ig= =Zljx -----END PGP SIGNATURE----- --HfLQjWKfp3+aIQDU--