Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2463497rwb; Wed, 30 Nov 2022 07:00:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5coliKCPU3T49e5Plp+gwz4/S9gTD3YEyxmHQpFHNkj0VbK6BfbQh6Wg5Vy2RBQFRs5Tva X-Received: by 2002:a05:6402:3886:b0:463:ab08:2bc6 with SMTP id fd6-20020a056402388600b00463ab082bc6mr38908807edb.143.1669820418609; Wed, 30 Nov 2022 07:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669820418; cv=none; d=google.com; s=arc-20160816; b=ulV3BqrHM9MUmknBOLMV1KtEVSExTETpuxLKDTvmFJYr8YFD+aen5Pe3ygvjN1qJfQ td7eUi3SQ6KS4lYPOZE//BYnkNjq1tC4L0WLpVKDYBf2VogVv9QnJvYDah3/yZ2PWsqc dMNBgw9lSM/9/jt4H0CEzoEdZDvlm/ptMf8+vHuaRTBrTkHBKrVJUFmVZ2brrQfR/Boa aohzulzVgG6Kh/kxwxS3O5gnhP9K8yR5CTj8US1xUdtfbG35d7yZM7vsRF0kCLeb1QYl xG9+RiLWldpMPYs1XQ+uxy0QvBzYpf5m4yWq8Qxfkx5jyZPXZ4fWKwM6byatOkQ6R/GD PLAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=ysb9nF7W7aBl+zloPQlgaS76S2jwLQXf+/wIbHzkL2s=; b=czogcFkoTf4K/zsB3uU9tuG0KCZvgF9TiihzQZDD16ZKGmIOPlf4PDOPgei363MPcn k32/Y0s5ab03Kq/VOJ7RChN5IgJEq4rJmEPfVlQ0GLI66tZUTJYo3o4VaNmXkdB5oQZ7 ouWvT9VB/RKe3W2ly3ylO9Qxi5HzmGW/dOkFsKxcjgNR1UNwH1p3s/GDug01ZNK7J1pJ 19KrY7kelu/z2Ius7nrIDciHLtaFM7qjPr2Dy9b0hmCvsoPcBVoPdN2FZjurrVf8pc7f NpmIszg3mXfyj0jTzIA8RAm7wSDGP6xj4Hp3Zr1F7vTD3OtRmffV597g/GlvZ03H3pkM 8gBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=XpIyPYch; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=VR3a3G9c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a056402037500b0046b953601c9si1442065edw.7.2022.11.30.06.59.55; Wed, 30 Nov 2022 07:00:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=XpIyPYch; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=VR3a3G9c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiK3OsX (ORCPT + 83 others); Wed, 30 Nov 2022 09:48:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbiK3OsW (ORCPT ); Wed, 30 Nov 2022 09:48:22 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6691A51C23 for ; Wed, 30 Nov 2022 06:48:20 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669819699; 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: in-reply-to:in-reply-to:references:references; bh=ysb9nF7W7aBl+zloPQlgaS76S2jwLQXf+/wIbHzkL2s=; b=XpIyPYchmWSgiG870br6Rr+E4xnpbB/61RTG50j7xs4sSOWyx8VUdXson8QV6vh2ZpWMuQ BZEMYc/p9N0Q0tSsTonvSPnaHIf2aWBB5+cAcEcuCI6+HVRiinLqDa3IrrDdndyOD+G3Hr Z6sM5rpFOEr9L1YcG11yjaSFORrZLqEwGLoHlqyRhr+IUveLr0N5sYvM5Y719pf4b3Ok7h /C0dDnmTcKDeYwgPwb1KR73iQ95pH4Cdv6XfjSaoTmG1OjrZHqbGh1+cDTjDVfb3R/3BDk A35C9XsX7NZiWCXdNnA1vviL+H365iJtI8VmtbpuPW5Tn7FCd41iyz6Mj6S2zQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669819699; 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: in-reply-to:in-reply-to:references:references; bh=ysb9nF7W7aBl+zloPQlgaS76S2jwLQXf+/wIbHzkL2s=; b=VR3a3G9cPiYAbCKymrWGiegBry122LXuvcA9Z2nHl9QZdvcIn8YIEze+UtGvD+ADar1uDX BDCgBiqqjw00cmCA== To: Samuel Holland , Marc Zyngier , Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, Samuel Holland , Paul Walmsley , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] genirq: Simplify cond_unmask_eoi_irq() In-Reply-To: <20221126234134.32660-2-samuel@sholland.org> References: <20221126234134.32660-1-samuel@sholland.org> <20221126234134.32660-2-samuel@sholland.org> Date: Wed, 30 Nov 2022 15:48:18 +0100 Message-ID: <87edtkts5p.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Samuel! On Sat, Nov 26 2022 at 17:41, Samuel Holland wrote: > This function calls .irq_eoi in three places, making the logic hard to > follow. Rearrange the function so that .irq_eoi is called only once. > > The only time .irq_eoi is not called is when all three if checks fail, > so return early in that case. threads_oneshot can only be nonzero if > IRQS_ONESHOT is set, so the IRQS_ONESHOT check can be omitted there. > > The IRQS_ONESHOT condition from the first if statement must then be > copied to the unmask_irq() condition. > > Furthermore, if IRQS_ONESHOT is set, mask_irq() must have been called > in the parent function, so the irqd_irq_masked() check is redundant. Not really convinced that all this is functionaly equivalent. > static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip) > { > - if (!(desc->istate & IRQS_ONESHOT)) { > - chip->irq_eoi(&desc->irq_data); > + /* > + * Do not send an EOI if the thread will do it later in > + * unmask_threaded_irq(). > + */ > + if ((chip->flags & IRQCHIP_EOI_THREADED) && desc->threads_oneshot) > return; > - } > + > + chip->irq_eoi(&desc->irq_data); This now issues EOI when the interrupt is in disabled state, which was not done before. That's probably a non-issue, but clearly a undocumented change. > + > /* > * We need to unmask in the following cases: > * - Oneshot irq which did not wake the thread (caused by a > @@ -669,12 +674,8 @@ static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip) > * completely). > */ > if (!irqd_irq_disabled(&desc->irq_data) && > - irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot) { > - chip->irq_eoi(&desc->irq_data); > + (desc->istate & IRQS_ONESHOT) && !desc->threads_oneshot) > unmask_irq(desc); This breaks the mask logic of handle_fasteoi_mask_irq() for an interrupt which does not have IRQS_ONESHOT set. So no, it's not the same and it even breaks stuff. Thanks, tglx