linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Arend van Spriel <arend.vanspriel@broadcom.com>,
	Brian Norris <briannorris@chromium.org>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	 linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/3] mwifiex: support sysfs initiated device coredump
Date: Fri, 23 Feb 2018 11:51:02 +0100	[thread overview]
Message-ID: <1519383062.2231.5.camel@sipsolutions.net> (raw)
In-Reply-To: <5A8FEF68.5080900@broadcom.com> (sfid-20180223_113938_578183_0B4B09C3)

Hey,

Hadn't really followed this discussion much due to other fires
elsewhere :-)

On Fri, 2018-02-23 at 11:39 +0100, Arend van Spriel wrote:

> > > Well, that depends on the eye of the beholder I guess. From user-space
> > > perspective it is asynchronous regardless. A write access to the coredump
> > > sysfs file eventually results in a uevent when the devcoredump entry is
> > > created, ie. after driver has made a dev_coredump API call. Whether the
> > > driver does that synchronously or asynchronously is irrelevant as far as
> > > user-space is concerned.
> > 
> > Is it really? The driver infrastructure seems to guarantee that the
> > entirety of a driver's ->coredump() will complete before returning from
> > the write. So it might be reasonable for some user to assume (based on
> > implementation details, e.g., of brcmfmac) that the devcoredump will be
> > ready by the time the write() syscall returns, absent documentation that
> > says otherwise. But then, that's not how mwifiex works right now, so
> > they might be surprised if they switch drivers.

I can see how you might want to have that kind of behaviour, but you'd
have to jump through some hoops to see if the coredump you saw is
actually the right one - you probably want an asynchronous coredump
"collector" and then wait for it to show up (with some reasonable
timeout) on the actual filesystem, not on sysfs?

Otherwise you have to trawl sysfs for the right coredump I guess, which
too is possible.

> > > You are right. Clearly I did not reach the end my learning curve here. I
> > > assumed referring to the existing dev_coredump facility was sufficient, but
> > > maybe it is worth a patch to be more explicit and mention the uevent
> > > behavior. Also dev_coredump facility may be disabled upon which the trigger
> > > will have no effect in sysfs. In the kernel the data passed by the driver is
> > > simply freed by dev_coredump facility.
> > 
> > Is there any other documentation for the coredump feature? I don't
> > really see much.
> 
> Any other than the code itself you mean? I am not sure. Maybe Johannes 
> knows.

There isn't really, it originally was really simple, but then somebody
(Kees perhaps?) requested a way to turn it off forever for security or
privacy concerns and it became more complicated.

> > static ssize_t coredump_store(struct device *dev, struct device_attribute *attr,
> > 			    const char *buf, size_t count)
> > {
> > 	device_lock(dev);
> > 	if (dev->driver->coredump)
> > 		dev->driver->coredump(dev);
> > 	device_unlock(dev);
> > 
> > 	return count;
> > }
> > static DEVICE_ATTR_WO(coredump);
> > 
> > Is that a bug or a feature?
> 
> Yeah. Let's call it a bug. Just not sure what to go for. Return the 
> error or change coredump callback to void return type.

I'm not sure it matters all that much - the underlying devcoredump
calls all have no return value (void), and given the above complexities
with the ability to turn off devcoredumping entirely you cannot rely on
this return value to tell you if a dump was created or not, at least
not without much more infrastructure work.

johannes

  reply	other threads:[~2018-02-23 10:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 10:50 [PATCH 0/3] drivers: support for sysfs initiated coredump Arend van Spriel
2018-02-21 10:50 ` [PATCH 1/3] brcmfmac: add " Arend van Spriel
2018-02-21 10:50 ` [PATCH 2/3] mwifiex: support sysfs initiated device coredump Arend van Spriel
2018-02-21 22:59   ` Brian Norris
2018-02-22 12:17     ` Arend van Spriel
2018-02-22 19:35       ` Brian Norris
2018-02-23 10:39         ` Arend van Spriel
2018-02-23 10:51           ` Johannes Berg [this message]
2018-02-26 22:06             ` Brian Norris
2018-02-26 22:25               ` Arend van Spriel
2018-03-12  9:41   ` [2/3] " Kalle Valo
2018-03-12  9:41   ` Kalle Valo
     [not found]   ` <20180312094115.2E1C1606DB@smtp.codeaurora.org>
2018-03-12 12:44     ` Arend van Spriel
2018-03-13 13:10       ` Kalle Valo
2018-03-13 19:42         ` Arend van Spriel
2018-03-13 20:19           ` Marcel Holtmann
2018-03-13 20:21             ` Arend van Spriel
2018-02-21 10:50 ` [PATCH 3/3] btmrvl: support sysfs initiated firmware coredump Arend van Spriel
2018-02-27 14:46   ` [3/3] " Kalle Valo
2018-02-27 14:46   ` Kalle Valo
2018-02-27 18:26   ` [PATCH 3/3] " Marcel Holtmann

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=1519383062.2231.5.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=arend.vanspriel@broadcom.com \
    --cc=briannorris@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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;
as well as URLs for NNTP newsgroup(s).