[PATCH v7 4/5] docs: counter: Document character device interface

David Lechner david at lechnology.com
Wed Dec 30 13:18:48 EST 2020


On 12/25/20 6:15 PM, William Breathitt Gray wrote:

> +Userspace
> +---------
> +Userspace applications can configure Counter events via ioctl operations
> +on the Counter character device node. There following ioctl codes are
> +supported and provided by the `linux/counter.h` userspace header file:
> +
> +* COUNTER_CLEAR_WATCHES_IOCTL:
> +  Clear all Counter watches from all events
> +
> +* COUNTER_ADD_WATCH_IOCTL:
> +  Add a Counter watch for the specified event
> +
> +* COUNTER_LOAD_WATCHES_IOCTL:
> +  Activates the Counter watches added earlier

Would it make more sense to call the last and first ones
COUNTER_ENABLE_EVENTS_IOCTL and COUNTER_DISABLE_EVENTS_IOCTL?
In any case, more explanation would be helpful.

* COUNTER_ADD_WATCH_IOCTL:
   Queues a Counter watch for the specified event. The queued watches
   will not be applied until COUNTER_ENABLE_EVENTS_IOCTL is called.

* COUNTER_ENABLE_EVENTS_IOCTL:
   Enables monitoring the events specified by the Counter watches that were
   queued by COUNTER_ADD_WATCH_IOCTL. If events are already enabled, the new
   set of watches replaces the old one. Calling this ioctl also has the
   effect of clearing the queue of watches added by COUNTER_ADD_WATCH_IOCTL.

* COUNTER_DISABLE_EVENTS_IOCTL:
   Stops monitoring the previously enabled events.

> +
> +To configure events to gather Counter data, users first populate a
> +`struct counter_watch` with the relevant event id, event channel id, and
> +the information for the desired Counter component from which to read,
> +and then pass it via the `COUNTER_ADD_WATCH_IOCTL` ioctl command.

for restructured text, two backticks are needed for ``code`` formatting





More information about the linux-arm-kernel mailing list