Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp837332pxb; Fri, 22 Apr 2022 12:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQYZvSYlIh5OLf9PNGMePFnJlOLQvOGzzb4v8BKPJi5fZs9fKiVAQEwrU+ORE/kfis0TMY X-Received: by 2002:a62:6443:0:b0:50a:d54c:7de2 with SMTP id y64-20020a626443000000b0050ad54c7de2mr6431514pfb.60.1650654874705; Fri, 22 Apr 2022 12:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650654874; cv=none; d=google.com; s=arc-20160816; b=ME5uN6/P0cAlt3o/NNDufe2HNThC2bqqwWI1oks4WMe6NpdvTPF+mPREVsC07XtWhn rDZM31z2MExjik5+6TfyxUEOmtiUckOE3DwA43uX5Q5pvyHlh/BT5CjzBGYTj5Xo/l4Z qTZHnHAtY4Y4DGg8y0A732T8h0211lijFfGU83dnh29NWC0No+ra65POMEE0WpzFBkPS ime66GBwpTZFUDhvss0raQSH0HN2WAng/I0sGl7PxrxIy43zh30xi/I2npab9shi1e8u J5I0zusnMe1sWPl7/o24WtsMgFEXf4NbWfRJga/j8sXf3lNhP1BPzDZzA3zZd6O9Jkra wlLA== 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=YBvc9avqMiVzUv5zEL0CqCVNyrKHrc8Ik9lljpgTt70=; b=isNM6kCFgHS6XxNZGWyarxdEpKfVVZAlpqbHtBM9ZClz+q4nXzGCZRVHRsVtBzzpGz WxmmK/munGvSI85d/xgDZCObzbkuIK34CJdS8XeYNqRHMIbv07ziKzTHyzI0fNypRQvd j9nGXpJQsW5f87p/XobH0UCGjZlFSNCI8yOjivwzpv1vXw5owt6Em31cv3z6ogvg82kE 9xXBypPx9UftlwifCtPUtNQ8L8V6q8s5NKW7eucIBeGqPBFeo4LDb4UUZAfjqaz6HsaL rgstLUGSGzWx2Tb1ulPJAnULCTD66Ocngs4Ae05cnlzAwkxoHs+SzTPiPsOPgbFvoQEk eyTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=3Atuvrxq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z16-20020a170903019000b00158b5b65721si9751926plg.321.2022.04.22.12.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:14:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=3Atuvrxq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2666CABBA; Fri, 22 Apr 2022 11:31:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382755AbiDUMDl (ORCPT + 99 others); Thu, 21 Apr 2022 08:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383356AbiDUMD1 (ORCPT ); Thu, 21 Apr 2022 08:03:27 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F772FFE1 for ; Thu, 21 Apr 2022 05:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=YBvc9avqMiVzUv5zEL0CqCVNyrKHrc8Ik9lljpgTt70=; b=3AtuvrxqSBebVty1LCRVIP0iaB bTDkjVSb8NmMZC5BKmthtpv+pxDcaUEN88ZxAT8x1VtU5M02Kh1Av1bLYTSl/ZD8Ipf35gsrHEwkU jA1ig1Gf3JaXQtvJpwbTZecXYrcLeK7G5TbX4Tu46TiWiq49s7NfQfw2L4E/v10qasp0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nhVU3-00GnOY-2m; Thu, 21 Apr 2022 14:00:27 +0200 Date: Thu, 21 Apr 2022 14:00:27 +0200 From: Andrew Lunn To: Nathan Rossi Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nathan Rossi , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner Subject: Re: [PATCH] irqchip/armada-370-xp: Enable MSI affinity configuration Message-ID: References: <20220421015728.86912-1-nathan@nathanrossi.com> <87mtgfgx7d.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 > > > static void armada_370_xp_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) > > > { > > > +#ifdef CONFIG_SMP > > > + unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(data)); > > > + > > > + msg->data = (1 << (cpu + 8)) | (data->hwirq + PCI_MSI_DOORBELL_START); > > > > BIT(cpu + 8) | ... > > > > > +#else > > > + msg->data = 0xf00 | (data->hwirq + PCI_MSI_DOORBELL_START); > > > > This paints the existing code a bit differently. This seems to target > > all 4 CPUs. Why is that? I'd expect only bit 8 to be set, and the > > whole #ifdefery to go away. > > I will remove the #ifdef in a v2 patch that addresses your > other comments. Please try to remove all the #ifdef'ery. > > > static int armada_370_xp_msi_set_affinity(struct irq_data *irq_data, > > > const struct cpumask *mask, bool force) > > > { > > > - return -EINVAL; > > > +#ifdef CONFIG_SMP > > > + unsigned int cpu; > > > + > > > + if (!force) > > > + cpu = cpumask_any_and(mask, cpu_online_mask); > > > + else > > > + cpu = cpumask_first(mask); > > > + > > > + if (cpu >= nr_cpu_ids) > > > + return -EINVAL; > > > + > > > + irq_data_update_effective_affinity(irq_data, cpumask_of(cpu)); > > > + > > > + return IRQ_SET_MASK_OK; > > > +#else > > > + return -EINVAL; > > > +#endif A quick look in cpumask.h suggests that if NR_CPUS == 1, there are stub functions which return constant values. So you might not need this #ifdef. However, i'm a network guy, not a scheduling guy, so don't trust what i say... Andrew