Re: [PATCH 0/7] libtracfes: Add tracefs_function_filter()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 26 Mar 2021 05:55:46 +0530
sameeruddin shaik <sameeruddin.shaik8@xxxxxxxxx> wrote:

> 
> On 23/03/21 6:22 pm, Steven Rostedt wrote:
> > On Mon, 22 Mar 2021 21:27:55 -0400
> > Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> >> This adds a new API tracefs_function_filter() as described in:
> >>
> >>   https://bugzilla.kernel.org/show_bug.cgi?id=210643
> >>
> >> It will use regular expressions against available_filter_functions (or even
> >> the kernel glob expression) to enable the function by the index method if it
> >> is supported. If it is not supported, it will go back to the writing of the
> >> filter strings directly into the set_ftrace_filter file.
> >>
> >>
> > Playing with the interface some more, I feel it's not quite adequate.
> >
> > The returning the negative number of filters that failed, isn't very
> > useful. Having the errs array that points to those filters gives us that
> > information.
> Yeah, Anyway we are pointing the failed filters using the errs pointer. 
> But to differentiate
> 
> the failed filters from the general errors, we can return -1, what you say?
>

No, I was thinking that -1 means that the file was never opened, but 1
means an error happened after the file was opened (and thus it must be
closed, or "committed"). In either case, the errs can be set.

I have the function checking the available_filter_functions to see if
there's any matches before it even opens the file, and if any filter
fails, I was thinking it should return -1 (meaning failure before
opening) and the errs will be set to the filters that failed (if it was
due to a filter failing. We should clear errno, at the start, so that
if a filter failed, errno is zero, and errs points to the failed
filters, if there was another failure, then errno would be set instead).

If all filters match, and we use your old method and there's some other
kind of error in writing the filter to set_ftrace_filter, then we could
have errs point to that filter, but still return 1 because the file was
opened and it still needs to be closed / committed. Note, this wont
happen on kernels 5.1 and beyond, as they support indexing, and once we
get to the indexing part, errs wont be used.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux