mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Saravana Kannan <saravanak@google.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	kernel-team@android.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1] driver core: Expose device link details in sysfs
Date: Mon, 18 May 2020 10:04:35 +0200	[thread overview]
Message-ID: <20200518080435.GA3133037@kroah.com> (raw)
In-Reply-To: <20200518070607.104611-1-saravanak@google.com>

On Mon, May 18, 2020 at 12:06:07AM -0700, Saravana Kannan wrote:
> It's helpful to be able to look at device link details from sysfs. So,
> expose it in sysfs.
> 
> Say device-A is supplier of device-B. These are the additional files
> this patch would create:
> 
> /sys/class/devlink/device-A:device-B/
> 	flags
> 	supplier/ -> .../device-A/
> 	consumer/ -> .../device-B/
> 
> /sys/devices/.../device-A/
> 	consumer:device-B/ -> /sys/class/devlink/device-A:device-B/
> 
> /sys/devices/.../device-B/
> 	supplier:device-A/ -> /sys/class/devlink/device-A:device-B/
> 
> That way:
> To get a list of all the device link in the system:
> ls /sys/class/devlink/
> 
> To get the consumer names and links of a device:
> ls -d /sys/devices/.../device-X/consumer:*
> 
> To get the supplier names and links of a device:
> ls -d /sys/devices/.../device-X/supplier:*
> 
> For now, I'm just exporting "flags", supplier and consumer for each
> device link. But the goal is to expand it to "state", etc once the
> overall idea is accepted.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
> Greg/Rafael,
> 
> Wanted to check if both of you are okay with the overall idea of
> exporting device link details through sysfs and if using a "struct
> device" is how you'd like to do it. I think this information would be
> helpful in debugging all kinds of suspend/resume, probe and power issues
> in a production system. I didn't want to spend more time on this patch
> before I got your okays.
> 
> I'm not too familiar with the right way to do kobjs and symlinks in
> sysfs -- so apologies any crazy code. But overall, the patch does create
> the layout I describe above and seems to work.

Looks sane to me, nice work.

> I could also remove kref and switch to using link_dev to keep track of
> refcount and releasing stuff, but I wasn't sure if we really needed the
> srcu implementation or not. So didn't remove it in this series and left
> it as is.

I would just leave that alone for now, as that would be a different
change here, right?

thanks,

greg k-h

      reply	other threads:[~2020-05-18  8:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  7:06 Saravana Kannan
2020-05-18  8:04 ` Greg Kroah-Hartman [this message]

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=20200518080435.GA3133037@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome