Skip to content

Conversation

@fredoh9
Copy link
Collaborator

@fredoh9 fredoh9 commented Jul 9, 2020

This is updated PR from #1841.

Renamed from Virtual bus to Ancillary bus.

@fredoh9
Copy link
Collaborator Author

fredoh9 commented Jul 9, 2020

I took renaming of source codes but documentation on first commit(516836b) will be updated from Dave. That's why you can still find "virtual bus" in Documentation/.

dmertman and others added 5 commits July 13, 2020 17:36
This is the initial implementation of the Ancillary Bus,
ancillary_device and ancillary_driver. The ancillary bus is
a software based bus intended to support registering
ancillary_devices and ancillary_drivers and provide matching
between them and probing of the registered drivers.

The bus will support probe/remove shutdown and
suspend/resume callbacks.

Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
A client in the SOF (Sound Open Firmware) context is a
device that needs to communicate with the DSP via IPC
messages. The SOF core is responsible for serializing the
IPC messages to the DSP from the different clients. One
example of an SOF client would be an IPC test client that
floods the DSP with test IPC messages to validate if the
serialization works as expected. Multi-client support will
also add the ability to split the existing audio cards
into multiple ones, so as to e.g. to deal with HDMI with a
dedicated client instead of adding HDMI to all cards.

This patch introduces descriptors for SOF client driver
and SOF client device along with APIs for registering
and unregistering a SOF client driver, sending IPCs from
a client device and accessing the SOF core debugfs root entry.

Along with this, add a couple of new members to struct
snd_sof_dev that will be used for maintaining the list of
clients.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Create an SOF client driver for IPC flood test. This
driver is used to set up the debugfs entries and the
read/write ops for initiating the IPC flood test that
would be used to measure the min/max/avg response times
for sending IPCs to the DSP.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add a new op for registering clients. The clients to be
registered depend on the DSP capabilities and the ACPI/DT
information. For now, we only add 2 IPC test clients that
will be used for run tandem IPC flood tests for all Intel
platforms.

For ACPI platforms, change the Kconfig to select
SND_SOC_SOF_PROBE_WORK_QUEUE to allow the ancillary driver
to probe when the client is registered.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Remove the IPC flood test support in the SOF core as it is
now added in the IPC flood test client.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@fredoh9 fredoh9 force-pushed the fix/0708_ancillary_bus branch from 2efca26 to 8e8e887 Compare July 14, 2020 00:38
@fredoh9
Copy link
Collaborator Author

fredoh9 commented Jul 14, 2020

I merged ancillary bus documentation from #2264 to first commit and rebased all again.

.. SPDX-License-Identifier: GPL-2.0-only

===========
Ancillary Bus

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 is name changed discussed with Greg KH? Did I miss the discussion?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paravmellanox the name change was based on our discussions with kernel developers at Intel. This version is based on the feedback provided and is still under review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but to be clear Greg KH was informed in the email thread for the previous series.

Copy link

@paravmellanox paravmellanox Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart can you please point me to the discussion thread?

Was the requirement of [1] dropped out? if so, can you point me to the thread? Need to ask what changed? OR it is just the name change?

[1] https://patchwork.kernel.org/patch/11280547/#23056771

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your question based on a reference that's more than 6 months old. What requirement are you referring to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then what solution you are suggesting?

We cannot have both a generic light-weight mechanism and burden it with unrelated stuff. The odds of an audio solution sharing any sysfs attributes with rdma are nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am familiar with device groups, but that should be handled with your own drivers.

I don't think we can have default sysfs attributes added by default in the ancillary_device code, that was my point.

In other words, you can use existing kernel capabilities to add your own attributes.

The only point that maybe would be problematic for userspace is that you would need a device 'type' to know what attributes to expect. That maybe something that needs to be added as a default attribute, with an enum that avoid collisions between device types exposes to userspace. e.g if /sys/bus/ancillary/ancillary.1/type stays 'AUDIO' then userspace should not expect any net/rdma capabiltiies.

@plbossart
Also we certainly don't want to expose every ancillary device as subfunction device.

there will be new API such as
ancillary_device_sf_register(ancillary_device, &sf_sysfs_group);

This will do current work + new sysfs.
So base ancillary device is unmodified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who calls this API and when?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then what solution you are suggesting?

We cannot have both a generic light-weight mechanism and burden it with unrelated stuff. The odds of an audio solution sharing any sysfs attributes with rdma are nil

@plbossart we just crossed each other. :-)

whether a device is audio or rdma, it is decided on the bus driver side. when 'struct device' is created, it only has base sysfs attributes which I described previously and here below.

Below attributes are created optionally.

  1. sfnum
  2. irqs
  3. resources
  4. numa node info
  5. link to parent pci device

This is done through by having additional APIs than what is already present in PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who calls this API and when?

who calls this API and when?

@plbossart This API is called by the mlx5_core driver when

user issues devlink port add command.
An example:
$ devlink port add pci/0000.06.00.0/100 flavour pcisf pfnum 1 sfnum 10

content of [2] is more example oriented for subfunction.
Please refer to diagram and it will likely give you more insights.

This is explained in
[1] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/
and
[2] https://marc.info/?l=linux-netdev&m=158555928517777&w=2

just the matching up of multiple registering drivers, and sacrifices common
generality to extend the bus functionality into subsystem specific functions,
then the ancillary bus should not be used. A custom bus solution, or some other
method should be considered in this use case.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 we discussed with Greg KH that virtbus will be used beyond just the matching service instead of creating one.
It is beyond just the matching service, did you discuss this over email to limit the usage when Greg KH agreed last time?

Copy link
Collaborator

@ranj063 ranj063 Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paravmellanox could you please elaborate on what you mean by "beyond just the matching service". Put differently, what would be missing from the current implementation of the ancillary bus for your needs?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063
Please follow through the thread and discussion [1] with Greg KH.
We must converge before posting this series and have good enough answer to prove Greg KH suggestions wrong. I am not sure you want to go that path at this point.

[1] https://patchwork.kernel.org/patch/11280547/#23056771

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through the linked thread and I didn't see any mention of any functionality beyond the matching. The primary focus of ancillary bus is to provide a way for multiple kernel objects to be matched and have access to a shared object. Emphasis on generic interface and commonality.

If I missed something could you please point me to it?

Thanks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in [2] refer to this line.
cat /sys/bus/virtbus/devices/mlx5_sf.1/sfnum

Ignore the incorrect device name mlx5_sf.1, it is virtdev.1.
But the part to focus is additional sysfs attributes that will be used by systemd to rename the netdevices of this virtdev (sub function).

At beginning there is only handful attribute like sfnum. But as it becomes mature, it will have more attributes like irqs, numa hierarchy of device, because device should be self-contained for such device specific properties.

It has functionality beyond matching, that is: a sub-function device is anchored on the virtbus. There will be netdevice and rdma device attached to this device.
So when someone sees the sysfs files as below there are actual net and rdma devices attached to it.

/sys/bus/virtbus/devices/virtdev.1/net/eth0
/sys/bus/virtbus/devices/virtdev.1/infiniband/mlx5_2

When someone uses the bus as matching service bus, there won't be class devices underneath like above.

This subtle difference and information is capture and acked in thread by Greg KH in [1].

[1] https://patchwork.kernel.org/patch/11280547/#23056985
[2] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/

@@ -0,0 +1,214 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Lightweight software based bus for Ancillary devices

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 I think lightweight prefix is misleading here.

@lyakh
Copy link
Collaborator

lyakh commented Jul 15, 2020

Checked (visually through diffs, so, some error probability remains), that these patches are the same as the last version of #1841 so I could ack this one too as I've acked the original one. There's just one nitpick from me, that I noted in #2264

@dmertman
Copy link

dmertman commented Jul 15, 2020

On the request of @ranj063 (offline discussion) I am going to pull this PR into my Documentation PR, since there is some thrash happening in the Documentation, but this PR looks to be fairly static. This will provide a single location for feedback on the ancillary bus implementation.

goto err;
}

dev_dbg(&adev->dev, "Registering ancillary device '%s'\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now new coding standard is 100 characters in line.
Please review whole code to see follow new alignment. Less lines are easier to merge.


ret = dev_set_name(&adev->dev, "%s.%d", adev->match_name, adev->id);
if (ret) {
dev_err(&adev->dev, "dev_set_name failed for device\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check (if not yet checked), if this is legit. Because we fail to set the device name and dev_err will try to print uninitialized device name.


ret = adrv->remove(adev);
dev_pm_domain_detach(_dev, true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for empty line when code before is straight forward.

@fredoh9
Copy link
Collaborator Author

fredoh9 commented Jul 15, 2020

We have decided to consolidate to one PR, #2264. Please move all comments/input to 2264.

@fredoh9 fredoh9 closed this Jul 15, 2020
@dmertman
Copy link

dmertman commented Jul 16, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants