Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2884312pxu; Mon, 14 Dec 2020 13:17:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5PNDfHSYZ5XyCUkCh5JPJYx+0yDc070ldQ29ZdXpCo+NXh2QpfEFJEY74x++C0iZpHDq3 X-Received: by 2002:a05:6402:1593:: with SMTP id c19mr11105326edv.269.1607980624737; Mon, 14 Dec 2020 13:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607980624; cv=none; d=google.com; s=arc-20160816; b=1GMhyDrknFB/xa5OJfEs62K7tlsstR2qm8QHvvfpkAendUQxpOwFA3PiqT7xP88gxM aIyJPMjm0DyDAaCiteoSMZ21XZCzz2MYubs3Mi4wDk6arQ7bwx7XYio3zj5QhSZG7UcD Dnv5w7LF1I4kWx49k7pOZ9DujVAEO8ot98ZINmpwxMDeCW19eFQF/wjhLnmNULR9WwxV /vAimXk7lF4RB3zc3lKPtHYi7q6sCDuYqQUDO3HQSIbbo/9eHxkQa45GQYwhwOfLWEMv ZApcjIiOQUzYzZNLIXlRPI07ZqOI6s31k2TKmATtbGl1jqR0dBgv7ZrriUl6BCBAGe8/ 83wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :dkim-signature:message-id; bh=sNG4Zt7ThoLC+d0ennIqKin8aW4cS5Pdf+M4jr9sICk=; b=kR7eIugw2GifLvc7566G3ba0P3uGdvqPY6PHE07DTG6h2h1LdvJBPpoQYF1Jb7ivFR IPQse+mlwptJPDz66Cev3PdISR1ZPA6pRi1byhj0PFl5N6swxXe7oYY7FU1iwV8p4sMs TAv5T3dh1xJ97D2ZBqj+GcrPfV9x4yiQtAiHGbZ/cTj5mq9R1Dsrz0hFAqFFJF/0Adhu /Otec/XZE1WjW8Yudum8S0T1RkTsLrnWc2AC8mgDmuwlk7YrkTEUzYXhvGOoPFoEQLuR aMTNGtDUONCQpWowO2Msic90MRAwU43AdeWA8TwyMrxN1DKdu5Y99X3Zm1y8kMN8gBTP U8jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ks3P3xnv; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si10673272ejy.167.2020.12.14.13.16.40; Mon, 14 Dec 2020 13:17:04 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Ks3P3xnv; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503529AbgLNVOG (ORCPT + 99 others); Mon, 14 Dec 2020 16:14:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:42014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728461AbgLNVNv (ORCPT ); Mon, 14 Dec 2020 16:13:51 -0500 Message-ID: <0f8eda3bbed1100c1c1f7015dd5c172f8d735c94.camel@kernel.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607980391; bh=Pzvi/5ISTUEc02BC83hB6nniQmkTHPAhNCBBNcfKAUY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Ks3P3xnvXkJSp+uh7CcZoik6MJkEKtx2PvE0VYPE/pepC3FjT65YOm45Ebhka542Q KDRZnMtG6PVk8azMh03nN0D62HLqcKsXaM3NGfl0cnBfDn4M/eCG3Bapi5UEiWJojE Wz5xGjdq/ndTqDY7tNprPuvOQMJrfpTrREHq07hUDedim+JiPcYSm9y/a+CVpdgIGp tK5qViUVIaC1nIaet1VMQYFfwNA6Uv7knO5wHsw+J306Af6r5YPeiXS/tptiFYTABJ 2yXmYvRm101qHL41Iu7+0L42D5JI7GLbb235mT9lCcvuGwm/DUlfBNloCq8GKc5F9/ KjhGS5BzrCEJg== Subject: Re: [patch 22/30] net/mlx5: Replace irq_to_desc() abuse From: Saeed Mahameed To: Thomas Gleixner , LKML Cc: Peter Zijlstra , Marc Zyngier , "James E.J. Bottomley" , Helge Deller , afzal mohammed , linux-parisc@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Mark Rutland , Catalin Marinas , Will Deacon , Christian Borntraeger , Heiko Carstens , linux-s390@vger.kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Pankaj Bharadiya , Chris Wilson , Wambui Karuga , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Tvrtko Ursulin , Linus Walleij , linux-gpio@vger.kernel.org, Lee Jones , Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com, Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Michal Simek , linux-pci@vger.kernel.org, Karthikeyan Mitran , Hou Zhiqiang , Tariq Toukan , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Leon Romanovsky , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , xen-devel@lists.xenproject.org Date: Mon, 14 Dec 2020 13:13:07 -0800 In-Reply-To: <20201210194044.769458162@linutronix.de> References: <20201210192536.118432146@linutronix.de> <20201210194044.769458162@linutronix.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-12-10 at 20:25 +0100, Thomas Gleixner wrote: > No driver has any business with the internals of an interrupt > descriptor. Storing a pointer to it just to use yet another helper at > the > actual usage site to retrieve the affinity mask is creative at best. > Just > because C does not allow encapsulation does not mean that the kernel > has no > limits. > you can't blame the developers for using stuff from include/linux/ Not all developers are the same, and sometime we don't read in between the lines, you can't assume all driver developers to be expert on irq APIs disciplines. your rules must be programmatically expressed, for instance, you can just hide struct irq_desc and irq_to_desc() in kernel/irq/ and remove them from include/linux/ header files, if you want privacy in your subsystem, don't put all your header files on display under include/linux. > Retrieve a pointer to the affinity mask itself and use that. It's > still > using an interface which is usually not for random drivers, but > definitely > less hideous than the previous hack. > > Signed-off-by: Thomas Gleixner > --- > drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- > drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 6 +----- > 3 files changed, 3 insertions(+), 7 deletions(-) > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h > @@ -669,7 +669,7 @@ struct mlx5e_channel { > spinlock_t async_icosq_lock; > > /* data path - accessed per napi poll */ > - struct irq_desc *irq_desc; > + const struct cpumask *aff_mask; > struct mlx5e_ch_stats *stats; > > /* control */ > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > @@ -1998,7 +1998,7 @@ static int mlx5e_open_channel(struct mlx > c->num_tc = params->num_tc; > c->xdp = !!params->xdp_prog; > c->stats = &priv->channel_stats[ix].ch; > - c->irq_desc = irq_to_desc(irq); > + c->aff_mask = irq_get_affinity_mask(irq); as long as the affinity mask pointer stays the same for the lifetime of the irq vector. Assuming that: Acked-by: Saeed Mahameed