netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: linux-net-drivers <linux-net-drivers@solarflare.com>,
	netdev <netdev@vger.kernel.org>
Subject: Re: PHC device sharing between PCI functions
Date: Wed, 3 Jul 2013 20:30:37 +0200	[thread overview]
Message-ID: <20130703183035.GA4446@netboy> (raw)
In-Reply-To: <1372778262.1919.12.camel@bwh-desktop.uk.level5networks.com>

On Tue, Jul 02, 2013 at 04:17:42PM +0100, Ben Hutchings wrote:
> On Tue, 2013-07-02 at 16:24 +0200, Richard Cochran wrote:
> 
> > And if so, then how will the mutiple, read-only MAC clocks help other
> > guests? Seems kinda useless to me.
> 
> It would allow them to convert hardware timestamps or sync system time
> to NIC time.

Okay, so let's talk about HW time stamps. That is a separate issue
from the PHC. You would think that you could offer HW time stamping to
each VM guest using the MAC. But wait, how will the guests enable it?

They will have to call the HWTSTAMP ioctl. Unfortunately, your driver
is one of those that offers fine grained choices (as opposed to all
packets or none), and that means that the guests will be potentially
spoiling each others settings (unless you implement per-function
filters).

WRT the PHC, I guess you could offer:

- gettime	to all functions
- set/adjtime	works in one, throws error in others
- pps hook	to all functions

You just need to decide how to determine which function will have the
writable clock.

Also, it might be worth thinking about how well the pps interrupt will
work. When there are many guest, will the card produce multiple MSI
interrupts every second, on the second? That won't work too well, I
think.

As an alternative to the pps interrupt, the phc2sys program (from
linuxptp) can periodically read out the system and PHC times in a
tight loop in order to discipline the system clock. This works quite
well in practice, but, again, what happens when multiple guest all try
to read the PHC time over PCIe simultaneously?

Thanks,
Richard

BTW, I am working on adding Tx time stamping to the tuntap driver. My
motivation is be able to conveniently test some of the PTP aspects
(like Best Master Clock selection) over a virtual switch. I also
wonder whether this could be used to distribute the host's system time
to VM guests, and how well it would work.

  reply	other threads:[~2013-07-03 18:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 16:56 PHC device sharing between PCI functions Ben Hutchings
2013-07-02 14:24 ` Richard Cochran
2013-07-02 15:17   ` Ben Hutchings
2013-07-03 18:30     ` Richard Cochran [this message]
2013-07-03 19:52       ` Ben Hutchings
2013-07-04  5:36         ` Richard Cochran
2013-07-04 14:34           ` Ben Hutchings
2013-07-04 15:53             ` Richard Cochran
2013-07-04 16:21               ` Ben Hutchings
2013-07-04 17:39                 ` Richard Cochran
2013-07-04 18:19                   ` Ben Hutchings
2013-07-05  5:25                     ` Richard Cochran

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=20130703183035.GA4446@netboy \
    --to=richardcochran@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).