Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7183956pxb; Thu, 18 Feb 2021 03:52:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1ygBNOHjdEen3lXsPyKMEzYkED3UVHn9iiAdzXDrh8X8e019bqgblbKYnuntQuoi06gtc X-Received: by 2002:a17:907:20ae:: with SMTP id pw14mr3578145ejb.454.1613649172631; Thu, 18 Feb 2021 03:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613649172; cv=none; d=google.com; s=arc-20160816; b=twjrRj8yC2KDNFYHaowSbpBAx9v4JehIJQHxuyy0i6jSIocg0kOTJQwfU4n9Z0xtuN JZtLIKQ9h9wLEkzXvVF1ZqF4ru6ifPjjhLmTDPRD1LQJF2IgWypNDkwc3yyWglGNk/po ID0+0FTpLWrPXOxa6qxnnsnymVWMNHQ7pR06soFJc+87pVY/xsR0gQ4gSWH8rCQnI4wW hdmR+1fiagprwrVe3tfplNnuoFMwRygRaAIKrRhH5IeUGND4gdjypKzoAFncpHGXAkKb 5d4h1JnklVL9LeiXsRUfmiRNAF9lj4jIbVHyz4XVOfDqRavGrGRkt4AB2o7qjt9yUr2E hc9A== 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=HqYkgCpjSPW+7F/Sy105/jMqMoKMqyjH6uBkL+9+REE=; b=m+TtKRZOy00PJy8kMnlv5VigsvuHSCho/3sVEgt3InIzDrvsh/6Q+XO6OwS+/YYpu0 WBaC5/WP89roJmfqSoJTOB7swzGgdXgg8gSVMe4zXGyg036zzclh+Ta/2kcSrpJ9XKJU S4ogPWFOchLmAG1Wa/5hRe1+zTfys7Ui3NfPx6clkj6Ysd9OkywOcoqAlV/K9o6iI6+c myzP3O7xpNXB4AVA+ZfG2k4Hh8Hd2bS3fnyFOBsbQ2wdL4Ou3sdYshQdgD94jYc6CTXR dfSXhYoZrD5nnLFDwH+tPrpTFX2KTTQUZ/YOvLppzQGq0KD8wK+OSSIXHD09eXIwsyMm 3Jpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bjHLCgEv; 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 p24si3519482ejy.672.2021.02.18.03.52.29; Thu, 18 Feb 2021 03:52:52 -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=bjHLCgEv; 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 S231244AbhBRLs6 (ORCPT + 99 others); Thu, 18 Feb 2021 06:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbhBRKRC (ORCPT ); Thu, 18 Feb 2021 05:17:02 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C9FC06178C; Thu, 18 Feb 2021 02:16:17 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id w19so1488424qki.13; Thu, 18 Feb 2021 02:16:17 -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=HqYkgCpjSPW+7F/Sy105/jMqMoKMqyjH6uBkL+9+REE=; b=bjHLCgEvzSj1u5NBEHNFSvRURMSBA4NFzeJ0zvH7t4X/PKfX7qN1JrT6++1lT0JoWJ LmEcbURYbtwaqEE4L2B7KodzoBozVMmIpnDfLqFdaQcr+31EeeryX2MK/SJixTVmnsIN 4i2LYzoQNoIzJZpEHmbGcpkw4xJcAPSWy2Wg/KDKP/LYgDrP20fk3GNMOdmEBaUaRUTW bjWNVnO3HUAaNZzZJXPn9miGyjJswC7r8OWuzBweHmqOgGjSuiyjU164ExByIH7agxLh HbwZ0wpm28/Iyn67JrpBVzb2bIEeEiGpraeSIvW0EK+CZMg8gjIsUjboZh6eYIFdcoP7 9eTw== 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=HqYkgCpjSPW+7F/Sy105/jMqMoKMqyjH6uBkL+9+REE=; b=ZkYxkHvISGfnLttdkrcthVqz4uXdtrYE4op78uFByOAo5xC4D5xjJQ4USEnUnPui2y wckuAaYHj1ePq26aKKB5LJ8mCMXuoxdsSobwOXfTyhP96PYWESZdTdPQUzIg46TrGGGK X4x8ddaTm/kRTTLrpzgZNHDs2TCTFomqy7SsTI+u8xigjziL/ElMxF24yCPbQxMmmNrI bMP49MFpQiouHQNUfIqQV4iAqPjzhqvlOcChT30gYQQLxoU3ZwjqaWYfTuqdZJ+xPHxd Fu1dsFKVo/O/tgX1pcbcHXa5Pana13LFCiv93L8vuPt2ojOcndPQCGlBGmy7/YqQsjlh MkxA== X-Gm-Message-State: AOAM531gWxpm0oiIyrMsrnbsCqrYqnVWw82XxOufsVVRGXlcE4BtWKu2 sdZSoFG4/kgdTzHgxwkJ180= X-Received: by 2002:a37:4fd2:: with SMTP id d201mr3494806qkb.232.1613643376916; Thu, 18 Feb 2021 02:16:16 -0800 (PST) Received: from shinobu ([193.27.12.132]) by smtp.gmail.com with ESMTPSA id v1sm3757790qki.49.2021.02.18.02.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:16:15 -0800 (PST) Date: Thu, 18 Feb 2021 19:16:08 +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> <20210216192720.75082d22@archlinux> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+eKruDaQgZ0deyTo" Content-Disposition: inline In-Reply-To: <20210216192720.75082d22@archlinux> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+eKruDaQgZ0deyTo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 16, 2021 at 07:27:20PM +0000, Jonathan Cameron wrote: > On Tue, 16 Feb 2021 11:16:03 +0900 > William Breathitt Gray wrote: >=20 > > 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 u= se a > > > > spinlock instead. > > > >=20 > > > > Cc: Syed Nayyar Waris > > > > Signed-off-by: William Breathitt Gray =20 > > >=20 > > > Why do these need to be raw_spin_locks? > > > Normally only need to do that if in code related to interrupt chips e= tc, > > > not their use. > > >=20 > > > Jonathan =20 > >=20 > > 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] >=20 > But on RT setups the interrupts become threads and are preemptable etc, > so that shouldn't matter. There are a few corner cases that cause > trouble, but in most normal drivers you should be fine with a > spin_lock. >=20 > Jonathan Thinking this over again I realize you're probably right. A simple spin_lock should be fine for these drivers, so I'll switch over to that instead of the raw_spin_lock for this driver and the Counter interface code. William Breathitt Gray > > which would result in a deadlock due to the interrupt context here -- so > > therefore we're left with using raw_spin_lock. > >=20 > > [1] https://lwn.net/Articles/367219/ > >=20 > > William Breathitt Gray >=20 --+eKruDaQgZ0deyTo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAmAuPmcACgkQhvpINdm7 VJJlQQ//TGIj8Nm+JA1eSMPG5CK4MXy5g1jHCLnb9hf2L7kuuE6Szwnsth3IQ6Ds QHYkyzTiZt1SIAZ/x1cJPyg7sI09H5KUo9mkh+pPqqDodvOynZVDrvCqp/nhIkKx ued5CyWx9illXCF/Myj9ARoknDxK/k0MEEFHBhdbRaTavauIWrEN4W+tKpw0JMom OXlssOmPeJ51evjd9YwwUUZgoVhrYneaOqx8NCC6Hv4CXIT9wQLnQsXrg6T8zKb7 FbrITR46MkXZyh5iibbDe7am8rIMYindyEjRQiMitYsOgNFYwdsnHfeNGDvKLmYB l5bPIfyIzjnfANGKvPfXTaS3umavlkdjbOmpD0dgXoW1XqU8Jk2tsul3Ou3ooqSG DkxRfRxVk5aRgjoONGJgZPP4kOLGZ4/BV/GABasSXmyXpZ26h/+J39kDg9AHKVH+ CHEf+RVbx3QbXO7UgBC0jK1BdpclRpwJWWgJOUWdn1SNYiTN7mEZUAQMj3AU8PGQ q3UyIkM/Zd5te/XsfuxVa2GucgRizIRs4WYw/Njmz32gJyVMTiCrskEkFywlA4ZY HntEfYNJop/zzyCblaLp8/0qEfqDfUg/MpUILqZEobE9+oI2gTJ8HVCLvwUVWN8g /RgD9t6Gl8LvUZCMAOwswLcZGreYIjO7h0m8jfbUYakB3Y5bYCs= =enNp -----END PGP SIGNATURE----- --+eKruDaQgZ0deyTo--