Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27846259rwd; Tue, 4 Jul 2023 08:38:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHX0pN0WkL73t21uM47v++PB1zxIboeMEK+Bp8Q4LG/7pORVCNhXqjZ/q42EPIhyqGFvRk X-Received: by 2002:a17:903:48c:b0:1b8:9ecd:8b86 with SMTP id jj12-20020a170903048c00b001b89ecd8b86mr3227199plb.5.1688485107919; Tue, 04 Jul 2023 08:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688485107; cv=none; d=google.com; s=arc-20160816; b=t+ygZ1Ixl/+oHalchSQnXfdExTo0IbaruycjvvVKK3R9UDUDtyvhQPr16U7LlFaljZ 6XBXK8oUGjnPcqjDmjhrRn1BVchefhKKoZCCY8jwm5Q41D1tBq5H+YPJ5AXA+w4RHX7z NJH+84GSl1BT08ZJzOoVtgKuEsFsNG0MNQv6XB2LR9mMpMfXQj5mm3Kcw4x7z3y5Grgj xo/IgLLL+6OZvhekF3oE5/CXTyfojA7i0LasWnL8iXjg1zMWfZClNSyA5XcSJDN/H71z +NfzsQphoafYmbrw9AULD0Z0ixw6jr6+rALp8Gbf86PAQ8Rbft64nQ2HjQWB5DD64Ppe wC5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T1MU9nDMfnJmNmvZiatTV1emdxx200/rrY6dmy8zyrU=; fh=qCd6aXxaCBmxEgqP5kOnn85bNG6VAdSq7OXFoxDpcZM=; b=qc4VDnPszNmhUxJuukKF/6n1Zt7vi8/iCVfDTySBtkaNy83xliS3Bl7cqYaTxVGN1X dtyeyEccm5paApskqM6nXo5iGHl4WqyF5wk7fgwgqm0I80nO++kT2sc4oN6Zwo8BlxdI 4GvgOlnAAmUhtpQWWBaeE9U4yoA1//PJcVrTFAUwr7y6qJzbHk6cHu/+v6R8oQDuf8aH rkta3LmDYU+wb0LvOW/pnyLBHHVNWjXJ7tOxUUeyJmkAjLoEOM3BSbFZ9GO92fdV8ag7 JKvlz0h0JcrDlHiXAiCougw4NCkO0nsx4ie35v+maBnmILSk9kWZs02Upl2Cicp7OgbT zhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s664yN5V; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a170902dad000b001b8820ab49fsi7900955plx.101.2023.07.04.08.38.08; Tue, 04 Jul 2023 08:38:27 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=s664yN5V; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbjGDP2D (ORCPT + 99 others); Tue, 4 Jul 2023 11:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbjGDP1v (ORCPT ); Tue, 4 Jul 2023 11:27:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DABA1A4 for ; Tue, 4 Jul 2023 08:27:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97F016128B for ; Tue, 4 Jul 2023 15:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DBFCC433C8; Tue, 4 Jul 2023 15:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688484470; bh=qUdWowWIkYFtnfXdxb32NHn0VbYNimiXJawRxIFxkSM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s664yN5VLDy2qSr5Y2mQ2AD6gEkyBn/S9mB+USWiSd7bDDNWQs/9+6rU2ZuojzA2n knYf6brty31tilj4ogSVkCGlUnnbN3brUk4Y8qmosc0w6A+hqmxw+wuVQEr3t03xfz L7jp2GqB0JmhSDQEtkg7qWj5wI4u/qqN2WDefsmtcfhTu3x9rYx5rLJRODtL+z3lD1 o660VJdMRmtDrIUxmhfAbvh67NXJmixBKx1MfLMpDrDS62jgdL5eamEakAPdg+7D/e Y2D6Y3EUiASguU06msX6SeWNzeDGYQio/nCFoUvZcwEvv/9ORgAsNifnLJ9B05MEBM Fzq1IYiFH7XPg== Date: Tue, 4 Jul 2023 17:27:45 +0200 From: Lorenzo Pieralisi To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, Hanks Chen , Cheng-Yuh.Wu@mediatek.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] irqchip/gic-v3: Workaround for GIC-700 erratum 2941627 Message-ID: References: <20230704123436.127449-1-lpieralisi@kernel.org> <86ttujwxb1.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86ttujwxb1.wl-maz@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Tue, Jul 04, 2023 at 03:44:50PM +0100, Marc Zyngier wrote: [...] > > + return !((gic_irq_in_rdist(d)) || gic_irq(d) >= 8192 || > > + cpumask_equal(irq_data_get_effective_affinity_mask(d), > > + cpumask_of(smp_processor_id()))); > > I dislike this statement for multiple reasons: > > - it is written as a negation, making it harder than strictly > necessary to parse as it is the opposite of the comment above > > - gic_irq_in_rdist() and gic_irq(d) >= 8192 are two ways of checking > the interrupt range -- maybe we should just do that > > - cpumask_equal() is *slow* if you have more that 64 CPUs, something > that is increasingly common -- a better option would be to check > whether the current CPU is in the mask or not, which would be enough > as we only have a single affinity bit set > > - smp_processor_id() can check for preemption, which is pointless > here, as we're doing things under the irq_desc raw spinlock. > > I would expect something like: > > enum gic_intid_range range = get_intid_range(d); > > return (range == SGI_RANGE || range == ESPI_RANGE) && > !cpumask_test_cpu(raw_smp_processor_id(), > irq_data_get_effective_affinity_mask(d)); > s/SGI/SPI - just noticed, for the records. Thanks, Lorenzo