Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp94487pxv; Thu, 24 Jun 2021 03:41:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIAOyRZQZ6mEr3fsYvNuDovfxCtw0f/nCFEBI6vQsIL7JHRvQQ6fu+onZzeresnJNtL97O X-Received: by 2002:aa7:d413:: with SMTP id z19mr6307395edq.37.1624531290336; Thu, 24 Jun 2021 03:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624531290; cv=none; d=google.com; s=arc-20160816; b=PHp+xkEmApWQa+5UDjr209K37PuaFNDK8mfqGe/D5qdHtjNJSqoCQ/REfEVgjt4RJc iVDiAMLiMwwzNxN6Dgnt2VkF75GRYPhoofIflC0hSx8SteQKhbXcPrDhfY9CGiQ5BK4q bjBnO+4TrqMjGNulAe6TOuO8ES8Bb7UAdxMT1fDyJ83NOM6/YCKuFJbwHif1nciBm0Gi 00IkEj9Yqhk4kfslAVlTeo6YfBaAyvpX4aZloPJPHeaTjoPInb6V5eY8YYYpouJjhObT FB7KupaHJJl9mZcn5deo6q4yEfEMQLm+Byu7/0Boqn7EX5kXZZoApmkEtYWWgKEt57SS wdZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=v2nueDFN3sIUezwAZTq4ZWYAx08fjXKv4iNtaPXarDA=; b=p6v8Ck/oHAfDtFSIehSRINXMUyHMsFJFWXQYMkBWenF+llq2fEBJ5Gd2v5QvsdONBA c2EVs4Aj3WIejEkA3TIals9E9j2BBVKFgsOHy4R/huSCY1hdMzFuUPGuNwgWRc4o/cs8 Vu0Kw8QvTgKAEE8OKSLo+pXX1PlkY8c/YSc61CHcm7AafRdqSFwL0xX/DGYZPcD63YWY XI6eicdbTf/gJFjr4nuzVo9MeMgR859VBMLvF6OqYG95vdluXZZASufsDUgDTP6/2cn9 jzlDliJ0vb0jyrdjJlrbMB2U+btVv2eftmZh1HcfFio0b/NpZMznY+D/edIAKa88wRTW 2vOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mhmJm3rC; 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 y13si2712406edq.315.2021.06.24.03.41.07; Thu, 24 Jun 2021 03:41:30 -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=@gmail.com header.s=20161025 header.b=mhmJm3rC; 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 S232111AbhFXKmU (ORCPT + 99 others); Thu, 24 Jun 2021 06:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbhFXKmT (ORCPT ); Thu, 24 Jun 2021 06:42:19 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79DEC061574; Thu, 24 Jun 2021 03:40:00 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id c5so4792726pfv.8; Thu, 24 Jun 2021 03:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v2nueDFN3sIUezwAZTq4ZWYAx08fjXKv4iNtaPXarDA=; b=mhmJm3rC5l98CLp97BJhCX6M5px6gRr0k5qBRMbEmQMmZs//HLTPQ1IAHBYs8TlzWC XDgyddHepQofYbWc/+LAEXMIihPPX8XQ0uoC54Kqfbg/S1thl+NkJpK1nJ3jXZSdP67D QXoxcD+Rc8A1izn5yZrr00MK9OASLRpLickqFT5tXH10RGq1lTYxHketHxBnH5/lTGmf V3bmxsmwzWZImT8+Dr2NPBKxOdP6zVQC/TYW0URB+aN93d4DplGReIVJ/3Y16PcK/izY yO6P8lDtmc7QCWp4Fp6RAe2dbzpeDcCs0kFLpagRSsDVZa4wgOybzyiO1qj3EZZ3P8TX md2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v2nueDFN3sIUezwAZTq4ZWYAx08fjXKv4iNtaPXarDA=; b=kNg3IQxVglrbOkrXKpe530plUo7SO/8kZFinjOW5B9b3yghWTas1dN5+QS6IAjpN5Z BCE8Bu8j7KVErjmEPIpzpoqANH02TsWW+D7M6ywhoIqRmSTyWLPYBdQfXDSfVetLLltF ImYCJ6D7KbhF6Yj0d/mf9DSr84vYMGEtIImW6kC5702aucZQ8PhIx+GP2uvxLoqA6UPJ QuXBel3guvvjYTioMjjxlePFxEYJI7WQx95w/Wx6dYbMYVLWHFJLj4AfnBQyAo7kdNUb BsTfK4bk3GjM7+TaiKY9oyfyNDEguucKB67pxeofl0peKkFZZ+qWejGXSSmMmwcwZ9At XIFA== X-Gm-Message-State: AOAM532Fu2NdT6g1wMNsR8X9KN3eOpsq2d9oFzcKrIVpKFHHlaXx4Glc I7VI/qflb+V0706rI/JBTsdDEgkfHBKQbz4gQOg= X-Received: by 2002:a63:fd16:: with SMTP id d22mr4168264pgh.203.1624531200201; Thu, 24 Jun 2021 03:40:00 -0700 (PDT) MIME-Version: 1.0 References: <20210624100046.1037159-1-nsaenzju@redhat.com> In-Reply-To: <20210624100046.1037159-1-nsaenzju@redhat.com> From: Andy Shevchenko Date: Thu, 24 Jun 2021 13:39:23 +0300 Message-ID: Subject: Re: [PATCH] iio: chemical: atlas-sensor: Avoid using irq_work To: Nicolas Saenz Julienne Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio , Linux Kernel Mailing List , Matt Ranostay Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > to run iio_trigger_poll() in IRQ context in the top half of the IRQ > handler. So make use of it, ultimately avoiding a context switch, an > IPI, and reducing latency. ... > @@ -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? > return IRQ_HANDLED; ... > 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). Can you guarantee that handling of those events will be fast enough? > IRQF_TRIGGER_RISING | > IRQF_TRIGGER_FALLING | IRQF_ONESHOT, > "atlas_irq", -- With Best Regards, Andy Shevchenko