linux-hardened/drivers/ptp
Grygorii Strashko d9535cb7b7 ptp: introduce ptp auxiliary worker
Many PTP drivers required to perform some asynchronous or periodic work,
like periodically handling PHC counter overflow or handle delayed timestamp
for RX/TX network packets. In most of the cases, such work is implemented
using workqueues. Unfortunately, Kernel workqueues might introduce
significant delay in work scheduling under high system load and on -RT,
which could cause misbehavior of PTP drivers due to internal counter
overflow, for example, and there is no way to tune its execution policy and
priority manuallly.

Hence, The kthread_worker can be used insted of workqueues, as it create
separte named kthread for each worker and its its execution policy and
priority can be configured using chrt tool.

This prblem was reported for two drivers TI CPSW CPTS and dp83640, so
instead of modifying each of these driver it was proposed to add PTP
auxiliary worker to the PHC subsystem.

The patch adds PTP auxiliary worker in PHC subsystem using kthread_worker
and kthread_delayed_work and introduces two new PHC subsystem APIs:

- long (*do_aux_work)(struct ptp_clock_info *ptp) callback in
ptp_clock_info structure, which driver should assign if it require to
perform asynchronous or periodic work. Driver should return the delay of
the PTP next auxiliary work scheduling time (>=0) or negative value in case
further scheduling is not required.

- int ptp_schedule_worker(struct ptp_clock *ptp, unsigned long delay) which
allows schedule PTP auxiliary work.

The name of kthread_worker thread corresponds PTP PHC device name "ptp%d".

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-01 15:22:55 -07:00
..
Kconfig ptp: Add a ptp clock driver for Broadcom DTE 2017-06-15 12:07:15 -04:00
Makefile ptp: Add a ptp clock driver for Broadcom DTE 2017-06-15 12:07:15 -04:00
ptp_chardev.c drivers/ptp: Fix kernel memory disclosure 2016-10-13 10:20:06 -04:00
ptp_clock.c ptp: introduce ptp auxiliary worker 2017-08-01 15:22:55 -07:00
ptp_dte.c ptp: dte: Use LL suffix for 64-bit constants 2017-07-06 11:40:58 +01:00
ptp_ixp46x.c ptp: ixp46x: remove NO_IRQ handling 2016-09-06 16:57:02 -07:00
ptp_kvm.c PTP: fix ptr_ret.cocci warnings 2017-03-20 16:25:06 +01:00
ptp_pch.c ptp: pch: convert to the 64 bit get/set time methods. 2015-03-31 12:01:19 -04:00
ptp_private.h ptp: introduce ptp auxiliary worker 2017-08-01 15:22:55 -07:00
ptp_sysfs.c ptp: create "pins" together with the rest of attributes 2017-02-17 11:03:06 -05:00