Subject: Re: [PATCH net-next v4 5/5] ice: add documentation for FW logging

From: Jakub Kicinski <[email-masked]>
Date: Tue, 10 Oct 2023 18:18:32 -0700

On Tue, 10 Oct 2023 16:00:13 -0700 Paul M Stillwell Jr wrote:
> >> +Retrieving FW log data
> >> +~~~~~~~~~~~~~~~~~~~~~~
> >> +The FW log data can be retrieved by reading from 'fwlog/data'. The user can
> >> +write to 'fwlog/data' to clear the data. The data can only be cleared when FW
> >> +logging is disabled.  
> > 
> > Oh, now it sounds like only one thing can be enabled at a time.
> > Can you clarify?
> >   
> 
> What I'm trying to describe here is a mechanism to read all the data 
> (whatever modules have been enabled) as it's coming in and to also be 
> able to clear the data in case the user wants to start fresh (by writing 
> 0 to the file). Does that make sense?

Yes that part does.

> I probably wasn't clear in the 
> previous section that the user can enable many modules at the same time.

Probably best if you describe enabling of multiple modules in the
example. I'm not sure how one disables a module with the current API.

> > Why 4K? The number of buffers is irrelevant to the user, why not let
> > the user configure the size in bytes (which his how much DRAM the
> > driver will hold hostage)?  
> 
> I'm trying to keep the numbers small for the user :). I could say 
> 1048576 bytes (256 x 4096), but those kinds of numbers get unwieldy to a 
> user (IMO).

echo $((256 * 4096)) >> $the_file

But also...

> The FW logs generate a LOT of data depending on what modules are enabled 
> so we typically need a lot of buffers to handle them.
> 
> In the past we have tried to use the syslog mechanism, but we generate 
> SO much data that we overwhelm that and lose data. That's why the idea 
> of using static buffers is appealing to us. We could still overrun the 
> buffers, but at least we will have contiguous data. The problem then 
> becomes one of allocating enough space for what the user is trying to 
> catch instead of trying to start/stop logging and hoping you get all the 
> events in the log.
> 
> I can drop the mention of 4K buffers in the documentation. Or we could 
> use terms like 1M, 2M, 512K, et al. That would require string parsing in 
> the driver though and I'm trying to avoid that if possible. What do you 
> think?

.. I thought such helpers already existed.