Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp359400pxa; Wed, 12 Aug 2020 04:05:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWmzH8BuRTWhbds7GvYWXj2V7KzU3Q5RE6bVvP2/BnXmPMrxuCxVo/sJUVBlUmzjz27OlF X-Received: by 2002:a17:906:dd5:: with SMTP id p21mr32393056eji.416.1597230344077; Wed, 12 Aug 2020 04:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597230344; cv=none; d=google.com; s=arc-20160816; b=uYoDbZZT98919d8l04aYus/6pnrB4fFTMbBSgdwKN5eo4SocoI/Pr7GpoNJlEne3B6 zg9HKxArcOAJSpE7hAHdc+5AR06alF4oBzdtgXH0MP8NVysKafawesajUiRNmH2cweab luK9Vd6Jl7C0Qt6liAvJ8MZKNXip7GPWQifMO8lKb1GXpOmx11m/CpnOi8m1u30KzgKS PuX0GsKuBqr6oZFuOOJrXEdd87vYarfcCyg9e+FTzFsZ2Uq6375mnGvxF8+zG8oOHnIB OOCb1jNTQ4aNEpYQ7v4Jf7cPQMCH01Er4kyTzBcJN1eHD6bJZ9LJh9CB8fiSG5MFL1qZ 2dlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=w3wvDeaNKu4HOwZN6F09rODvPG5uay043sR4GLeWcBs=; b=opVDCLd/ZSo1qNAUBfZx6iUqb/yw8XpfmxefyvJ4/BlgiEUceazdrQrEx955slX7QJ uTa6+HRQnBX6hXghjiqTCQ8roXvlhvp5syIUnLlB6CQRw5VnwdF5TJ+8nIeJ1x7Q62Ib 4B+wEk5OFEsOWj69KSxzfFe1dJGxps46PFNIjZEc8amNAmETKzdaFO9QG9EbMHGOcCht jGl7W/9mWzMQYZttS/uaxldDiXQBL4oPkxYps33NpGoF0SGECORf1LjO3NXwdT8CnPze lSutIUkM1oQYnUSUlkrHcMM7kfscUMqbH1PRqT4bH73CnTT6Qu3X6ku61NqPfVMSOpsh FuiA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jo4si886648ejb.455.2020.08.12.04.05.19; Wed, 12 Aug 2020 04:05:44 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgHLLC2 (ORCPT + 99 others); Wed, 12 Aug 2020 07:02:28 -0400 Received: from mailout06.rmx.de ([94.199.90.92]:44187 "EHLO mailout06.rmx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726404AbgHLLC1 (ORCPT ); Wed, 12 Aug 2020 07:02:27 -0400 Received: from kdin01.retarus.com (kdin01.dmz1.retloc [172.19.17.48]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout06.rmx.de (Postfix) with ESMTPS id 4BRRcG0M7Sz9tNn; Wed, 12 Aug 2020 13:02:22 +0200 (CEST) Received: from mta.arri.de (unknown [217.111.95.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by kdin01.retarus.com (Postfix) with ESMTPS id 4BRRbx2bRCz2xjY; Wed, 12 Aug 2020 13:02:05 +0200 (CEST) Received: from n95hx1g2.localnet (192.168.54.41) by mta.arri.de (192.168.100.104) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Aug 2020 13:01:52 +0200 From: Christian Eggers To: Lars-Peter Clausen CC: Jonathan Cameron , , "Hartmut Knaack" , Peter Meerwald-Stadler , , Subject: Re: [PATCH] iio: trigger: sysfs: Disable irqs before calling iio_trigger_poll() Date: Wed, 12 Aug 2020 13:01:51 +0200 Message-ID: <3847827.rc3nFVyU9p@n95hx1g2> Organization: Arnold & Richter Cine Technik GmbH & Co. Betriebs KG In-Reply-To: References: <20200727145714.4377-1-ceggers@arri.de> <4871626.01MspNxQH7@n95hx1g2> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [192.168.54.41] X-RMX-ID: 20200812-130211-4BRRbx2bRCz2xjY-0@kdin01 X-RMX-SOURCE: 217.111.95.66 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lars On Monday, 3 August 2020, 08:52:54 CEST, Lars-Peter Clausen wrote: > On 8/3/20 8:44 AM, Christian Eggers wrote: > > ... > > is my patch sufficient, or would you prefer a different solution? > > The code in normal upstream is correct, there is no need to patch it > since iio_sysfs_trigger_work() always runs with IRQs disabled. > > >> Are you using a non-upstream kernel? Maybe a RT kernel? > > > > I use v5.4.-rt > > That explains it. Have a look at > 0200-irqwork-push-most-work-into-softirq-context.patch. > > The right fix for this issue is to add the following snippet to the RT > patchset. > > diff --git a/drivers/iio/trigger/iio-trig-sysfs.c > b/drivers/iio/trigger/iio-trig-sysfs.c > --- a/drivers/iio/trigger/iio-trig-sysfs.c > +++ b/drivers/iio/trigger/iio-trig-sysfs.c > @@ -161,6 +161,7 @@ static int iio_sysfs_trigger_probe(int id) > iio_trigger_set_drvdata(t->trig, t); > > init_irq_work(&t->work, iio_sysfs_trigger_work); > + t->work.flags = IRQ_WORK_HARD_IRQ; > > ret = iio_trigger_register(t->trig); > if (ret) I can confirm that this works for iio-trig-sysfs on 5.4.54-rt32. Currently I do not use iio-trig-hrtimer, but if I remember correctly, the problem was also present there. Do you want to apply your patch for mainline? In contrast to v5.4, IRQ_WORK_HARD_IRQ is already available there (moved to smp_types.h). Unfortunately I cannot test it on mainline for now, as my BSP stuff is not ported yet. Best regards Christian