Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp298894pxu; Tue, 6 Oct 2020 06:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiwFoPe0CpA0IR5imocTv0wwWdVZIgoKv0k8ud5T1vm8Cob2f1CrrFbscJxlJblRkOVFrj X-Received: by 2002:a05:6402:2055:: with SMTP id bc21mr5436085edb.67.1601992069802; Tue, 06 Oct 2020 06:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601992069; cv=none; d=google.com; s=arc-20160816; b=Tw3pcofhymyjFAOX5/0heYUp04OeWV3KdAIOIiKAE/xXj+WHdSPe2vYuDfCAQZiruw sRrWl2JpuC914CCc0UgPlKerJHLAPkAsQQlNBqooRuuOGZBuhQmTOcZGoGtGiKUnVvVK qLnvwwi89h+4nrN00EqD5nkY36YYLzL83gspZOUDE2AoujMFYdtE8nSDq3ylHKsixU+t EaeQDA0mIJW3PCxf9nVz1Brg5tuvQnqPuvNiD9+l6vG1kwRoFZcSgbBy8KstWOAUpP34 V9VL6+gXuM+FrNTiBFlXzme/W4ST/NX+l8GB43XVuqqPeyPQnf6+vJwcIV0Y0m04cQEZ bkRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=5tbBktaYCveUyqUKP7C5+yx8eshWk6kNr6MFBtqaYs0=; b=kGre9FyrgXhh6vXWX2johyvMS7zRCSe4HZSQ+5CBhVfdMkv1TwVTsBQvE4yv+dBF37 O3xkBloYWloAU34GekdyoV2BIlUdN5Z/lzcsWxhUnJ5FUtkAoqlbal0m7pP9wYj3l/4G 6VS8JnuIhBxRAHQoMSELBREq4kXDXy3MJg+1yU8dKTOg9R16mCsLGnrHRQ/ZzfL3h3kW kaGJxIx2Cg7t38EWuQvjNC7dBtAQ9IDi0W6K0Uv44NRYHWMP5QMOV3NGAD8r6VgDLqwC xjoIMpLYB77HJAzZQ1DTSktRWLfVESkRmFLzqf8HI9dVBA+ttErhI6ngdMJX3foruKm9 nnyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tdFbbEab; 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 q4si2058546ejd.380.2020.10.06.06.47.26; Tue, 06 Oct 2020 06:47:49 -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=tdFbbEab; 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 S1726064AbgJFNp2 (ORCPT + 99 others); Tue, 6 Oct 2020 09:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725902AbgJFNp2 (ORCPT ); Tue, 6 Oct 2020 09:45:28 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA8BC061755; Tue, 6 Oct 2020 06:45:28 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id 7so7993326pgm.11; Tue, 06 Oct 2020 06:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=5tbBktaYCveUyqUKP7C5+yx8eshWk6kNr6MFBtqaYs0=; b=tdFbbEab7P6ctnOCztAANhuNGfm0C/s+XpQayT+qel735y0nuTSQeZEui67TMEJKO5 T1qaKdEgNKghpD6QPcfuqQxD9wJomEOMw6TIcsjv1cJasXB5IxHYbFA2Ee8aMWFTjJ5H k4QNJ2puGJPlj7rqNBI90PSx0qvHIl2R7QHn7sZG8WX0g83Nd7dRtzpsmDLFiYBI2olt DhmLNuHtiKwF8jOru8FkRFegFa8XtfNYrxyHHxDxuLIQBpiGUdpq3IILRshj4fvDEmOV 8C0dOPV/bfkWx+6l205vAv0pG06xIg8FjgoU9WKBsb77UJEOGVNdFEbFaA0SrORVWgMd 9uYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5tbBktaYCveUyqUKP7C5+yx8eshWk6kNr6MFBtqaYs0=; b=WLPp2SsKqjVD1k0SND57J4oy2bmvpc0j41ewkGamMVtlp5dKoc9yY3XYO+05ka3oKR 7To5j3WIo7jfztrEnrnEKlaURRJCnvKOvuzSiogB1tFnL6/HgbMO0uxyBhvo+2ygu2en GaiFRme/QDg6WAE7jI5Dnq2jMw9qtsF0t9HpZOezQGikbBy4nzJP+uovDwbar6+XRbIY NBPM0c7HgJDaHTaC6O7lYjQu+BQIqsTTeMpbRHul3IsZCQDBPN9sYrrHbk/PslP0+18F /f1CiAwFHgi0QMlsLqH6SeQEKLLJdEBlTLZg0AzD8Y5je0Bf1N3MZXKXtJLVF665BjHz 8Otg== X-Gm-Message-State: AOAM533aR+0NjxT1WWJ8VE7QOWbNFv9ImGsaFJvzgv7DddlnZHggWBN/ BOaYsjImpxjw/RXUJBpHkvNnzxkzeLPlGHtI X-Received: by 2002:aa7:8dc7:0:b029:151:2237:52c5 with SMTP id j7-20020aa78dc70000b0290151223752c5mr4649146pfr.32.1601991927399; Tue, 06 Oct 2020 06:45:27 -0700 (PDT) Received: from ?IPv6:2402:b801:2840:8200:a50f:f34d:264:5cdf? ([2402:b801:2840:8200:a50f:f34d:264:5cdf]) by smtp.gmail.com with ESMTPSA id h12sm3703548pfo.68.2020.10.06.06.45.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Oct 2020 06:45:26 -0700 (PDT) Subject: Re: [PATCH] mmc: meson-gx: remove IRQF_ONESHOT To: Thomas Gleixner , Ulf Hansson Cc: Jerome Brunet , Kevin Hilman , "open list:ARM/Amlogic Meson..." , Linux Kernel Mailing List , "linux-mmc@vger.kernel.org" , Sebastian Andrzej Siewior References: <20201002164915.938217-1-jbrunet@baylibre.com> <87wo052grp.fsf@nanos.tec.linutronix.de> <87v9fn7ce2.fsf@nanos.tec.linutronix.de> From: Brad Harper Message-ID: Date: Wed, 7 Oct 2020 00:45:20 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <87v9fn7ce2.fsf@nanos.tec.linutronix.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm happy to test anything on a range of amlogic hardware with standard / rt and  multiple mmc devices.  Ill test Jerome's patch in next 24 hours to report the results. On 6/10/2020 11:43 pm, Thomas Gleixner wrote: > On Mon, Oct 05 2020 at 10:55, Thomas Gleixner wrote: >> On Mon, Oct 05 2020 at 10:22, Ulf Hansson wrote: >>> On Fri, 2 Oct 2020 at 18:49, Jerome Brunet wrote: >>>> IRQF_ONESHOT was added to this driver to make sure the irq was not enabled >>>> again until the thread part of the irq had finished doing its job. >>>> >>>> Doing so upsets RT because, under RT, the hardirq part of the irq handler >>>> is not migrated to a thread if the irq is claimed with IRQF_ONESHOT. >>>> In this case, it has been reported to eventually trigger a deadlock with >>>> the led subsystem. >>>> >>>> Preventing RT from doing this migration was certainly not the intent, the >>>> description of IRQF_ONESHOT does not really reflect this constraint: >>>> >>>> > IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. >>>> > Used by threaded interrupts which need to keep the >>>> > irq line disabled until the threaded handler has been run. >>>> >>>> This is exactly what this driver was trying to acheive so I'm still a bit >>>> confused whether this is a driver or an RT issue. >>>> >>>> Anyway, this can be solved driver side by manually disabling the IRQs >>>> instead of the relying on the IRQF_ONESHOT. IRQF_ONESHOT may then be removed >>>> while still making sure the irq won't trigger until the threaded part of >>>> the handler is done. >>> Thomas, may I have your opinion on this one. >>> >>> I have no problem to apply $subject patch, but as Jerome also >>> highlights above - this kind of makes me wonder if this is an RT >>> issue, that perhaps deserves to be solved in a generic way. >>> >>> What do you think? >> Let me stare at the core code. Something smells fishy. > The point is that for threaded interrupts (without a primary handler) > the core needs to be told that the interrupt line should be masked until > the threaded handler finished. That's what IRQF_ONESHOT is for. > > For interrupts which have both a primary and a threaded handler that's a > different story. The primary handler decides whether the thread should > be woken and it decides whether to block further interrupt delivery in > the device or keep it enabled. > > When forced interrupt threading is enabled (even independent of RT) then > we have the following cases: > > 1) Regular device interrupt (primary handler only) > > The primary handler is replaced with the default 'wake up thread' > handler and the original primary handler becomes the threaded > handler. This enforces IRQF_ONESHOT so that the interupt line (for > level interrupts) stays masked until the thread completed handling. > > 2) Threaded interrupts > > Interrupts which have been requested as threaded handler (no > primary handler) are not changed obvioulsy > > 3) Interrupts which have both a primary and a thread handler > > Here IRQF_ONESHOT decides whether the primary handler will be > forced threaded or not. > > That's a bit unfortunate and ill defined and was not intended to be > used that way. > > We rather should make interrupts which need to have their primary > handler in hard interrupt context to set IRQF_NO_THREAD. That > should at the same time confirm that the primary handler is RT > safe. > > Let me stare at the core code and the actual usage sites some more. > > Thanks, > > tglx > > > > > >