All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Shay Drory <shayd@nvidia.com>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
	kuba@kernel.org, edumazet@google.com, gregkh@linuxfoundation.org,
	david.m.ertman@intel.com, rafael@kernel.org, ira.weiny@intel.com,
	linux-rdma@vger.kernel.org, leon@kernel.org, tariqt@nvidia.com,
	Parav Pandit <parav@nvidia.com>
Subject: Re: [PATCH 1/2] driver core: auxiliary bus: show auxiliary device IRQs
Date: Sat, 4 May 2024 18:50:24 +0100	[thread overview]
Message-ID: <20240504175024.GI2279@kernel.org> (raw)
In-Reply-To: <20240503043104.381938-2-shayd@nvidia.com>

On Fri, May 03, 2024 at 07:31:03AM +0300, Shay Drory wrote:
> PCI subfunctions (SF) are anchored on the auxiliary bus. PCI physical
> and virtual functions are anchored on the PCI bus;  the irq information
> of each such function is visible to users via sysfs directory "msi_irqs"
> containing file for each irq entry. However, for PCI SFs such information
> is unavailable. Due to this users have no visibility on IRQs used by the
> SFs.
> Secondly, an SF is a multi function device supporting rdma, netdevice
> and more. Without irq information at the bus level, the user is unable
> to view or use the affinity of the SF IRQs.
> 
> Hence to match to the equivalent PCI PFs and VFs, add "irqs" directory,
> for supporting auxiliary devices, containing file for each irq entry.
> 
> Additionally, the PCI SFs sometimes share the IRQs with peer SFs. This
> information is also not available to the users. To overcome this
> limitation, each irq sysfs entry shows if irq is exclusive or shared.
> 
> For example:
> $ ls /sys/bus/auxiliary/devices/mlx5_core.sf.1/irqs/
> 50  51  52  53  54  55  56  57  58
> $ cat /sys/bus/auxiliary/devices/mlx5_core.sf.1/irqs/52
> exclusive
> 
> Reviewed-by: Parav Pandit <parav@nvidia.com>
> Signed-off-by: Shay Drory <shayd@nvidia.com>

...

> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c

...

> +static int auxiliary_irq_create(int irq)
> +{
> +	refcount_t *ref;
> +	int ret = 0;
> +
> +	mutex_lock(&irqs_lock);
> +	ref = xa_load(&irqs, irq);
> +	if (ref && refcount_inc_not_zero(ref))
> +		goto out;
> +
> +	ref = kzalloc(sizeof(ref), GFP_KERNEL);

Hi Shay,

Should this be sizeof(*ref) ?

Flagged by Coccinelle.

> +	if (!ref) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}
> +
> +	refcount_set(ref, 1);
> +	ret = xa_insert(&irqs, irq, ref, GFP_KERNEL);
> +	if (ret)
> +		kfree(ref);
> +
> +out:
> +	mutex_unlock(&irqs_lock);
> +	return ret;
> +}
> +
> +/**
> + * auxiliary_device_sysfs_irq_add - add a sysfs entry for the given IRQ
> + * @auxdev: auxiliary bus device to add the sysfs entry.
> + * @irq: The associated Linux interrupt number.
> + *
> + * This function should be called after auxiliary device have successfully
> + * received the irq.

It would be nice to include a Return section to this kernel doc.

Flagged by ./scripts/kernel-doc -none -Wall

> + */
> +int auxiliary_device_sysfs_irq_add(struct auxiliary_device *auxdev, int irq)

...

  parent reply	other threads:[~2024-05-04 17:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03  4:31 [PATCH 0/2] Introduce auxiliary bus IRQs sysfs Shay Drory
2024-05-03  4:31 ` [PATCH 1/2] driver core: auxiliary bus: show auxiliary device IRQs Shay Drory
2024-05-03  5:10   ` Greg KH
2024-05-03  6:18     ` Shay Drori
2024-05-03 17:14   ` kernel test robot
2024-05-05  8:43     ` Zhu Yanjun
2024-05-04 17:50   ` Simon Horman [this message]
2024-05-05  5:16     ` Shay Drori
2024-05-03  4:31 ` [PATCH 2/2] net/mlx5: Expose SFs IRQs Shay Drory

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240504175024.GI2279@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david.m.ertman@intel.com \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parav@nvidia.com \
    --cc=rafael@kernel.org \
    --cc=shayd@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.