Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3216635pxb; Sun, 26 Sep 2021 08:30:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6neZx1uqoIYnQU08TjTGgBm1qStg3p+OO4OfES49ktXHlHogO2l9Y/sj+GpS7VlGCX6MA X-Received: by 2002:a05:6a00:16ca:b0:413:d3f7:646f with SMTP id l10-20020a056a0016ca00b00413d3f7646fmr18992720pfc.7.1632670255001; Sun, 26 Sep 2021 08:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632670254; cv=none; d=google.com; s=arc-20160816; b=Np+oZ9lnTT3jkqomL5hmdynCif/9IUWSa4Lkf/9JjbTz7YxYHi3aLfrnK89MSru4Ml jHekdi7zZKqJErz5a/BEwFo3UrAAMRHH0yECLAQqJgydbRdWtR5dD4jHAyXwa0TtKVSD +P0DWJ7oOxPW1oI+qN2P6UtU7yNENH0QPLvfIFhNk9BnfCx6/lwwGYObY59cLYvR4xt4 ng0IzIw+MOLxE1l+7i1bzF+GLLmpcFjtO6MbYW9ohy3VxpbuU+i9Kt+Pl3KMHdN7Q7LY q53PlFHbjJCtFL5Fa3vCT7d3jEb+5AxqdP0xg78ID9vKKPoKS62JE9xkFDJILUMYDfUI QSgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ee5ZTfU6ZyhtaxOW/btFl235sA8zQzE79DBVHkyvA/0=; b=JErdEotkJk45g1kMgGAiUlOW6pnMbIvspVHlIYiUlcQFnNDXeC4xMKYCHT8aGITy6s Chh7jB6ps41V/4IKy5yaElV08uiFeb8JL166xvaeowbsqkA25sqGOjpLuCr1f5AhlV54 Yl8Chuv9Lw359a0APmmHWpxwcvGqr0Yt+hNfalFYXwndBZVszaupEbdoqXIoCeMsjvIu Z7HYI3+mIaHTcDy3vEyTvi7FPpcE4NGDdeuU/fkvEXdE+HiAINyntH9gO72Lv9mzCKoM WcK54manKwZfw7CK4r9LBxIyqzf49VQ1SLjqsRyAjfsefzAuuBuidgjHcmRootEbdDRo C0ng== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si18229361pfj.271.2021.09.26.08.30.41; Sun, 26 Sep 2021 08:30:54 -0700 (PDT) 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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231991AbhIZPb2 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 26 Sep 2021 11:31:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:40300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbhIZPb1 (ORCPT ); Sun, 26 Sep 2021 11:31:27 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7239B60E08; Sun, 26 Sep 2021 15:29:49 +0000 (UTC) Date: Sun, 26 Sep 2021 16:33:38 +0100 From: Jonathan Cameron To: Nicolas Saenz Julienne Cc: Andy Shevchenko , Lars-Peter Clausen , linux-iio , Linux Kernel Mailing List , Matt Ranostay Subject: Re: [PATCH] iio: chemical: atlas-sensor: Avoid using irq_work Message-ID: <20210926163338.1170f73a@jic23-huawei> In-Reply-To: <3974817ea942f616b77450914aa23b181b062d87.camel@redhat.com> References: <20210624100046.1037159-1-nsaenzju@redhat.com> <3974817ea942f616b77450914aa23b181b062d87.camel@redhat.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jun 2021 13:13:47 +0200 Nicolas Saenz Julienne wrote: > Hi Andy, thanks for the review. > > On Thu, 2021-06-24 at 13:39 +0300, Andy Shevchenko wrote: > > On Thu, Jun 24, 2021 at 1:01 PM Nicolas Saenz Julienne > > wrote: > > > > > > The atlas sensor driver currently registers a threaded IRQ handler whose > > > sole responsibility is to trigger an irq_work which will in turn run > > > iio_trigger_poll() in IRQ context. > > > > > > This seems overkill given the fact that there already was a opportunity > > > > an opportunity > > Thanks, noted. > > > > @@ -474,7 +465,7 @@ static irqreturn_t atlas_interrupt_handler(int irq, void *private) > > >         struct iio_dev *indio_dev = private; > > >         struct atlas_data *data = iio_priv(indio_dev); > > > > > > - irq_work_queue(&data->work); > > > + iio_trigger_poll(data->trig); > > > > Have you considered dropping atlas_interrupt_trigger_ops() altogether? > > Not really, but it makes sense as a separate patch. I'll take care of it. > > > > > >         if (client->irq > 0) { > > >                 /* interrupt pin toggles on new conversion */ > > >                 ret = devm_request_threaded_irq(&client->dev, client->irq, > > > > > - NULL, atlas_interrupt_handler, > > > + atlas_interrupt_handler, NULL, > > > > So, you move it from threaded IRQ to be a hard IRQ handler (we have a > > separate call for this). > > Noted. > > > Can you guarantee that handling of those events will be fast enough? > > Do you mean the events triggered in iio_trigger_poll()? If so the amount of > time spent in IRQ context is going to be the same regardless of whether it's > handled through atlas' IRQ or later in irq_work IPI (or softirq context on some > weird platforms). > Hi Nicolas, Andy, Matt, Just been checking patchwork for IIO and noted that this one is still outstanding. My reading of above is that we kind of got to a conclusion - though I'd like Matt to sanity check the patch (and maybe test it if he still has hardware for this?) We have a generic form of this handler that may let you drop the atlas_interrupt_handler() function entirely iio_trigger_generic_data_rdy_poll(). https://elixir.bootlin.com/linux/latest/source/drivers/iio/industrialio-trigger.c#L182 Thanks, Jonathan