All of lore.kernel.org
 help / color / mirror / Atom feed
* How to let devcoredump know data has been read?
@ 2018-06-05 22:27 Ben Greear
  2018-06-05 22:53 ` Brian Norris
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Greear @ 2018-06-05 22:27 UTC (permalink / raw)
  To: linux-wireless

I have been testing ath10k on 4.16, which uses the devcoredump API
to notify about dumps.

I am able to see the binary crash dump at /sys/class/devcoredump/devcd2/data,
for instance, but if I do another crash quickly, I get no new uevent sent
and no new crash.

I see there is a 5 minute timer on the coredump data, but it also seems to indicate
that if I read the crash, the data should be cleared and ready to be
recreated again?  How do you notify the system that the crash data has
been read?

I tried 'cat' on the data file, but that did not seem to clear anything.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to let devcoredump know data has been read?
  2018-06-05 22:27 How to let devcoredump know data has been read? Ben Greear
@ 2018-06-05 22:53 ` Brian Norris
  2018-06-06 17:04   ` Ben Greear
  2018-06-06 19:08   ` Arend van Spriel
  0 siblings, 2 replies; 5+ messages in thread
From: Brian Norris @ 2018-06-05 22:53 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless, Arend van Spriel, Johannes Berg

Hi,

On Tue, Jun 05, 2018 at 03:27:28PM -0700, Ben Greear wrote:
> I have been testing ath10k on 4.16, which uses the devcoredump API
> to notify about dumps.
> 
> I am able to see the binary crash dump at /sys/class/devcoredump/devcd2/data,
> for instance, but if I do another crash quickly, I get no new uevent sent
> and no new crash.
> 
> I see there is a 5 minute timer on the coredump data, but it also seems to indicate
> that if I read the crash, the data should be cleared and ready to be
> recreated again?  How do you notify the system that the crash data has
> been read?
> 
> I tried 'cat' on the data file, but that did not seem to clear anything.

Try *writing* to it?

https://elixir.bootlin.com/linux/v4.16/source/drivers/base/devcoredump.c#L91

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=833c95456a70826d1384883b73fd23aff24d366f

<quote>
The dumped data will be readable in sysfs in the virtual device's
data file under /sys/class/devcoredump/devcd*/. Writing to it will
free the data and remove the device, as does a 5-minute timeout.
</quote>

e.g.:

# ls -l /sys/class/devcoredump/devcd1
lrwxrwxrwx. 1 root root 0 Jun  5 15:49 /sys/class/devcoredump/devcd1 -> ../../devices/virtual/devcoredump/devcd1
# echo 1 > /sys/class/devcoredump/devcd1/data
# ls -l /sys/class/devcoredump/devcd1
ls: cannot access '/sys/class/devcoredump/devcd1': No such file or directory

Unfortunately, devcoredump is a bit lacking in documentation. Arend was
writing a bit for the new trigger mechanism at least.

Brian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to let devcoredump know data has been read?
  2018-06-05 22:53 ` Brian Norris
@ 2018-06-06 17:04   ` Ben Greear
  2018-06-06 19:02     ` Arend van Spriel
  2018-06-06 19:08   ` Arend van Spriel
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Greear @ 2018-06-06 17:04 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-wireless, Arend van Spriel, Johannes Berg

On 06/05/2018 03:53 PM, Brian Norris wrote:
> Hi,
>
> On Tue, Jun 05, 2018 at 03:27:28PM -0700, Ben Greear wrote:
>> I have been testing ath10k on 4.16, which uses the devcoredump API
>> to notify about dumps.
>>
>> I am able to see the binary crash dump at /sys/class/devcoredump/devcd2/data,
>> for instance, but if I do another crash quickly, I get no new uevent sent
>> and no new crash.
>>
>> I see there is a 5 minute timer on the coredump data, but it also seems to indicate
>> that if I read the crash, the data should be cleared and ready to be
>> recreated again?  How do you notify the system that the crash data has
>> been read?
>>
>> I tried 'cat' on the data file, but that did not seem to clear anything.
>
> Try *writing* to it?
>
> https://elixir.bootlin.com/linux/v4.16/source/drivers/base/devcoredump.c#L91
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=833c95456a70826d1384883b73fd23aff24d366f
>
> <quote>
> The dumped data will be readable in sysfs in the virtual device's
> data file under /sys/class/devcoredump/devcd*/. Writing to it will
> free the data and remove the device, as does a 5-minute timeout.
> </quote>
>
> e.g.:
>
> # ls -l /sys/class/devcoredump/devcd1
> lrwxrwxrwx. 1 root root 0 Jun  5 15:49 /sys/class/devcoredump/devcd1 -> ../../devices/virtual/devcoredump/devcd1
> # echo 1 > /sys/class/devcoredump/devcd1/data
> # ls -l /sys/class/devcoredump/devcd1
> ls: cannot access '/sys/class/devcoredump/devcd1': No such file or directory

Thanks to all who responded.  That indeed works just fine.

Just in case you know a quick answer:  I opened a netlink socket to listen
to uevents so I would know when FW crashed.  It receives the kernel messages,
but also receives 'libudev' events which seem to have some binary header in
them (which I could not google any info about how to decode it).  Is there
an easy way to tell the socket to not send the libudev events?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to let devcoredump know data has been read?
  2018-06-06 17:04   ` Ben Greear
@ 2018-06-06 19:02     ` Arend van Spriel
  0 siblings, 0 replies; 5+ messages in thread
From: Arend van Spriel @ 2018-06-06 19:02 UTC (permalink / raw)
  To: Ben Greear, Brian Norris; +Cc: linux-wireless, Arend van Spriel, Johannes Berg

On 6/6/2018 7:04 PM, Ben Greear wrote:
> On 06/05/2018 03:53 PM, Brian Norris wrote:
>> Hi,
>>
>> On Tue, Jun 05, 2018 at 03:27:28PM -0700, Ben Greear wrote:
>>> I have been testing ath10k on 4.16, which uses the devcoredump API
>>> to notify about dumps.
>>>
>>> I am able to see the binary crash dump at
>>> /sys/class/devcoredump/devcd2/data,
>>> for instance, but if I do another crash quickly, I get no new uevent
>>> sent
>>> and no new crash.
>>>
>>> I see there is a 5 minute timer on the coredump data, but it also
>>> seems to indicate
>>> that if I read the crash, the data should be cleared and ready to be
>>> recreated again?  How do you notify the system that the crash data has
>>> been read?
>>>
>>> I tried 'cat' on the data file, but that did not seem to clear anything.
>>
>> Try *writing* to it?
>>
>> https://elixir.bootlin.com/linux/v4.16/source/drivers/base/devcoredump.c#L91
>>
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=833c95456a70826d1384883b73fd23aff24d366f
>>
>>
>> <quote>
>> The dumped data will be readable in sysfs in the virtual device's
>> data file under /sys/class/devcoredump/devcd*/. Writing to it will
>> free the data and remove the device, as does a 5-minute timeout.
>> </quote>
>>
>> e.g.:
>>
>> # ls -l /sys/class/devcoredump/devcd1
>> lrwxrwxrwx. 1 root root 0 Jun  5 15:49 /sys/class/devcoredump/devcd1
>> -> ../../devices/virtual/devcoredump/devcd1
>> # echo 1 > /sys/class/devcoredump/devcd1/data
>> # ls -l /sys/class/devcoredump/devcd1
>> ls: cannot access '/sys/class/devcoredump/devcd1': No such file or
>> directory
>
> Thanks to all who responded.  That indeed works just fine.
>
> Just in case you know a quick answer:  I opened a netlink socket to listen
> to uevents so I would know when FW crashed.  It receives the kernel
> messages,
> but also receives 'libudev' events which seem to have some binary header in
> them (which I could not google any info about how to decode it).  Is there
> an easy way to tell the socket to not send the libudev events?

Hi Ben,

When I was playing with..eh..implementing devcoredump functionality in 
brcmfmac, I created a small app for it based on [1]. I should have put 
it under version control so I can not make it easier for you.

Regards,
Arend

[1] http://www.signal11.us/oss/udev/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to let devcoredump know data has been read?
  2018-06-05 22:53 ` Brian Norris
  2018-06-06 17:04   ` Ben Greear
@ 2018-06-06 19:08   ` Arend van Spriel
  1 sibling, 0 replies; 5+ messages in thread
From: Arend van Spriel @ 2018-06-06 19:08 UTC (permalink / raw)
  To: Brian Norris, Ben Greear; +Cc: linux-wireless, Arend van Spriel, Johannes Berg

On 6/6/2018 12:53 AM, Brian Norris wrote:
> Unfortunately, devcoredump is a bit lacking in documentation. Arend was
> writing a bit for the new trigger mechanism at least.

I did indeed write ABI doc for user-space trigger mechanism and you 
brought up the need to have ABI doc for devcoredump. I agree it would be 
useful and it is dangling at the bottom of my todo list so I did not get 
to it (yet). Hopefully I can spend a moment on it.

Regards,
Arend

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-06 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 22:27 How to let devcoredump know data has been read? Ben Greear
2018-06-05 22:53 ` Brian Norris
2018-06-06 17:04   ` Ben Greear
2018-06-06 19:02     ` Arend van Spriel
2018-06-06 19:08   ` Arend van Spriel

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.