Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp116671pxv; Thu, 24 Jun 2021 04:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgL+7XIOgbhD5zvzMZ8uHd7Yp3my7oHUsVeSjFc+iJKCGxkn4uj8qoz3hIHOlU8LaaaARG X-Received: by 2002:a92:360e:: with SMTP id d14mr3208281ila.106.1624533274552; Thu, 24 Jun 2021 04:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624533274; cv=none; d=google.com; s=arc-20160816; b=K6PvV6ZkLBV8bUftvFrpgSqwVL95xhVBFzh0bCP8eESuTOBM90g8UC737kOLJytiAu ExuKWWI+t2vhSAqbypEhKhOvCUHG7IxmiFSRvRhDoFrNGQ988ce7eaqtL6AM/GOnVeD4 pLQWGiSGiiD5SAwbFEIpNIs1g6R023+SAbb8JZNsQWUWSK6LzK7UAg2PAd2CMdP0Fke/ Bs5SzShtvGQLpBdozqO7yFHJWFvBapJdNBzKKYhVNRRTLO7xry/qc5Gfi+9mUlg+XgoC s3ls6YskgeyApC0LiRjhXXt3QHwQuxBaKWjnKSKn3MgvZAZ8VXHwhYUHnUCVo1LgjBIR jn0A== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=GQbQQeIrRdDv283QxkkrMQqh6kQDdmhKMptxE1wKs5Q=; b=QzEHmHR48lhFl1p1ECKLWm+S52Njlr8rTtS4WqkvuT7LZOxn/wxUe/KtlX1oiKy4aL MVOWsWdoeVQ7L78fcKklEgC1DqN1AqPUj+sBpvvkbxtfJ7P3LXZ38difneK6B03wVb+j ARQi9WjAEn4rndBTn356+vFb8fvhLgi2oLbnLDFDQxbnvCP8NCWMhyKZew/mqnRnNH7n mWhqJajmsJFL9AdCWr5Mfd7t8E2WeyCeQ2ql4imu0lfHvWKqLs8xiQKICTPHTr4IjgmP zxIdzJyUfrUYbOnO68GeoMQ2sUYIgRrjX9ckkSW9/zhycL7zQ9wmGX7xT6GsuhJCE0KF utxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+fX4qNG; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si3177165ils.62.2021.06.24.04.14.23; Thu, 24 Jun 2021 04:14:34 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d+fX4qNG; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232227AbhFXLQL (ORCPT + 99 others); Thu, 24 Jun 2021 07:16:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50505 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232350AbhFXLQK (ORCPT ); Thu, 24 Jun 2021 07:16:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624533231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GQbQQeIrRdDv283QxkkrMQqh6kQDdmhKMptxE1wKs5Q=; b=d+fX4qNGjIVjaLJiK5+MRR6ftmf+WLW32LA6IvvLh/o1kpE1W0t6zzDrJGjMSfzXTbePF3 jnK5DqCyFp7mQQPTL/l4v5XjDwdaFK7IODBRWrgDiNIyQBzvHKaa9GLRChRsozLFX/GD9b Tkvpyoxntx+I6932sjiOjYjCc+wSfog= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-nD5nWWLQP_6OOSH7fPs_3w-1; Thu, 24 Jun 2021 07:13:49 -0400 X-MC-Unique: nD5nWWLQP_6OOSH7fPs_3w-1 Received: by mail-wm1-f72.google.com with SMTP id i82-20020a1c22550000b02901d64e84b3c9so1505680wmi.5 for ; Thu, 24 Jun 2021 04:13:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=GQbQQeIrRdDv283QxkkrMQqh6kQDdmhKMptxE1wKs5Q=; b=s7KFwDojoQbk1vUp7rsdGYf7Kf817Hh0BFB8CkIHO8QPOsyIsFU825gQonegjKRdqr FOYzbwOZfkMSjfj3kTqkTtXNe0zd7lh7BJUB0VzB30vyHe0n2bUBIoFBFS/tj4FpPC1T CPn/EAJnWC/c0Jn5MEGAcsUmUYTSztY50vMr09si4mcXXIDb6jB1rdj1D35OO1gMllb0 2c6ubdVajVgkun8cJuTCsANhXmdhKC+E3hweStM6CZKcM0aIxtMD9vjNcduQUaOuSax+ arg+KzSL83DCiva9V6cw4S7Vd9hx24jpHDHnMLzdNLxzYQes6gUC67KMwafZguIzJSzy x7yA== X-Gm-Message-State: AOAM5304OIQ7/4RR6k02VW9n3wftYUrJHxPrpZCCHP2QnDWl2k/M23I4 rYEmIzFb2p3e0x3SFJwPna5SkTz7qFRffxC5vHT6KFjCJuEktiNtltFVRyJ89uWy0xqD3hgJeQ8 fSG0g9DyYp3+yR09uaSfrslu7 X-Received: by 2002:adf:a2d1:: with SMTP id t17mr3840776wra.74.1624533228386; Thu, 24 Jun 2021 04:13:48 -0700 (PDT) X-Received: by 2002:adf:a2d1:: with SMTP id t17mr3840758wra.74.1624533228196; Thu, 24 Jun 2021 04:13:48 -0700 (PDT) Received: from ?IPv6:2a0c:5a80:3d14:2800:933d:abfc:d8e4:637f? ([2a0c:5a80:3d14:2800:933d:abfc:d8e4:637f]) by smtp.gmail.com with ESMTPSA id z3sm8173497wmi.29.2021.06.24.04.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 04:13:47 -0700 (PDT) Message-ID: <3974817ea942f616b77450914aa23b181b062d87.camel@redhat.com> Subject: Re: [PATCH] iio: chemical: atlas-sensor: Avoid using irq_work From: Nicolas Saenz Julienne To: Andy Shevchenko Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio , Linux Kernel Mailing List , Matt Ranostay Date: Thu, 24 Jun 2021 13:13:47 +0200 In-Reply-To: References: <20210624100046.1037159-1-nsaenzju@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.0 (3.40.0-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). -- Nicolás Sáenz