All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Lichvar <mlichvar@redhat.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Richard Cochran <richardcochran@gmail.com>
Subject: [Intel-wired-lan] ice driver bug with PTP vclocks
Date: Wed, 9 Nov 2022 16:20:02 +0100	[thread overview]
Message-ID: <Y2vFIq/6rB7k12Gd@localhost> (raw)

It seems the locking of the PTP clock in the ice driver conflicts with
spinlocks used by PTP virtual clocks protecting their timecounter and
cyclecounter. I get the following report when running ptp4l+phc2sys
pairs on multiple ports of an E810 with vclocks enabled:

BUG: scheduling while atomic: ptp7/3859/0x00000002
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 3859 Comm: ptp7 Tainted: G        W          6.0.6-300.fc37.x86_64 #1
Call Trace:
 <TASK>
 dump_stack_lvl+0x44/0x5c
 __schedule_bug.cold+0x81/0x8e
 __schedule+0xe82/0x12b0
 ? get_nohz_timer_target+0x18/0x1a0
 ? timerqueue_add+0x62/0xb0
 ? enqueue_hrtimer+0x2f/0x80
 schedule+0x5d/0xe0
 schedule_hrtimeout_range_clock+0xb5/0x100
 ? __hrtimer_init+0xe0/0xe0
 usleep_range_state+0x50/0x70
 ice_ptp_lock+0x39/0x60 [ice]
 ice_ptp_gettimex64+0x31/0x70 [ice]
 ? ptp_clock_release+0x50/0x50
 ? kthread_stop+0x170/0x170
 ptp_vclock_read+0x37/0x90
 timecounter_read+0x14/0x60
 ptp_vclock_refresh+0x2a/0x50
 ptp_aux_kworker+0x1c/0x40
 kthread_worker_fn+0xaa/0x250
 kthread+0xe9/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 </TASK>

I tried to fix this in the vclock code by moving the PHC read outside
of the spinlock, but it turns out that's not a complete fix and it
breaks the update of the timecounter's cycle_last value. I suspect I'd
need to modify the cyclecounter to use a cached value which would need
to be read ahead of the timecounter call.

Any chance this could be addressed in the ice driver? Any suggestions?

-- 
Miroslav Lichvar

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

             reply	other threads:[~2022-11-09 15:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 15:20 Miroslav Lichvar [this message]
2022-11-09 20:08 ` [Intel-wired-lan] ice driver bug with PTP vclocks Keller, Jacob E
2023-02-02 20:43   ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2vFIq/6rB7k12Gd@localhost \
    --to=mlichvar@redhat.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.