All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Feng Tang <feng.tang@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	intel-wired-lan <intel-wired-lan@lists.osuosl.org>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH] igb: Make driver init async
Date: Mon, 21 Jan 2019 18:29:51 -0800	[thread overview]
Message-ID: <CAKgT0Uc14wOufpa2vspV6DZN-wF7QTqz2Te7QL7Ys06T8TMVkw@mail.gmail.com> (raw)
In-Reply-To: <20190122014029.wrqvt3hfl3ee7g2x@shbuild888>

On Mon, Jan 21, 2019 at 5:39 PM Feng Tang <feng.tang@intel.com> wrote:
>
> Hi Duyck,
>
> Thanks for your review!
>
> On Mon, Jan 21, 2019 at 02:50:08PM -0800, Alexander Duyck wrote:
> > On Mon, Jan 21, 2019 at 12:36 AM Feng Tang <feng.tang@intel.com> wrote:
> > >
> > > When optimizing boot time for a platform with igb module, we found the
> > > igb driver probe will take about 45 ms, make the probe asynchronous
> > > will save quite some time as the init runs in parallel with other
> > > asynchronous drivers.
> > >
> > > In theory, this could be applied to some other drivers like igc or
> > > e1000, but we don't have HW to verify that.
> > >
> > > Signed-off-by: Feng Tang <feng.tang@intel.com>
> >
> > I really don't like this patch. This seems like you are tuning for a
> > specific platform or system setup by making changes to the driver. Is
> > there any reason why you couldn't just pass the module parameter
> > "igb.async_probe" to accomplish the same thing?
>
> Thanks for the info. I didn't make it clear, in some case we need it to
> be builtin, and this doesn't work per my try.

Well then why not try implementing a similar feature that could be
used for built-in drivers. My point is that it is really bad to be
modifying a driver to work for a specific use case. It makes the
driver overly brittle from a maintenance point of view.

> > I suspect most people
> > won't care that much about the 45ms boot time difference, and if we
>
> Yes, 45ms is trivial to Desktop/Server. But our platform is for automotive
> and IOTG case, and these count there. US Department of Transportation
> has a requirement that the rear-view camera needs to be functional in 2
> seconds after power on. To achieve that, we've done things to get 20ms
> from PCI init, 5ms from disabling some ACPI_PM clocksource :)

That is your set of requirements. There are multiple other users of
this driver out there. We cannot just go in and arbitrarily change
core behaviors for one specific use case. I would much prefer this to
be something that can be changed either via a sysctl or via a module
parameter so that we can have this behavior turned off by default if
so desired.

> > were to make this sort of change it should probably be more
> > generically applied to either PCI devices or network devices instead
> > of doing this one driver at a time.
>
> Agree. I also mentioned this in commit log, I didn't do it for other drivers
> as I don't have HW to verify, and I would be happy to proceed if
> experts for those HW think this change is fine.

You normally don't need to test all possible hardware that could be
impacted by a change, but what you should do is try to test what you
have available.

This sort of change would make more sense as a PCI feature where you
essentially cause endpoint devices to asynchronously probe instead of
doing so synchronously if a certain kernel module parameter is set.
Otherwise if you ever change drivers in the future for some design you
will have to submit yet another patch for this. So for example one
thing you might look at doing is adding a new option for the "pci="
module parameter. You could specify for example something like
"pci=async_probe=pci:8086:1533" and then that would specify all i210
adapters with that device ID would be asynchronously probed instead of
going through the standard probe path.

> Technically I think it's fine, as making them async will only push their
> init later, which won't break their existing dependence. And there should
> be very few modules which depend on network drivers.

Actually this will break functionality on the 82576 quad port
adapters. Specifically we are using a static counter to identify which
groupings of 4 ports belonged together using the global_quad_port_a
value. With this changing to asynchronous you will end up confusing
the driver resulting in it randomly assigning WOL to possibly the
wrong port since the async code doesn't guarantee ordering of the
probe routines.

That would be another good reason why this should be handled as a per
PCI device/function type feature instead of trying to just make it
apply to all of igb.

> Thanks,
> Feng
>

Thanks.

- Alex

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH] igb: Make driver init async
Date: Mon, 21 Jan 2019 18:29:51 -0800	[thread overview]
Message-ID: <CAKgT0Uc14wOufpa2vspV6DZN-wF7QTqz2Te7QL7Ys06T8TMVkw@mail.gmail.com> (raw)
In-Reply-To: <20190122014029.wrqvt3hfl3ee7g2x@shbuild888>

On Mon, Jan 21, 2019 at 5:39 PM Feng Tang <feng.tang@intel.com> wrote:
>
> Hi Duyck,
>
> Thanks for your review!
>
> On Mon, Jan 21, 2019 at 02:50:08PM -0800, Alexander Duyck wrote:
> > On Mon, Jan 21, 2019 at 12:36 AM Feng Tang <feng.tang@intel.com> wrote:
> > >
> > > When optimizing boot time for a platform with igb module, we found the
> > > igb driver probe will take about 45 ms, make the probe asynchronous
> > > will save quite some time as the init runs in parallel with other
> > > asynchronous drivers.
> > >
> > > In theory, this could be applied to some other drivers like igc or
> > > e1000, but we don't have HW to verify that.
> > >
> > > Signed-off-by: Feng Tang <feng.tang@intel.com>
> >
> > I really don't like this patch. This seems like you are tuning for a
> > specific platform or system setup by making changes to the driver. Is
> > there any reason why you couldn't just pass the module parameter
> > "igb.async_probe" to accomplish the same thing?
>
> Thanks for the info. I didn't make it clear, in some case we need it to
> be builtin, and this doesn't work per my try.

Well then why not try implementing a similar feature that could be
used for built-in drivers. My point is that it is really bad to be
modifying a driver to work for a specific use case. It makes the
driver overly brittle from a maintenance point of view.

> > I suspect most people
> > won't care that much about the 45ms boot time difference, and if we
>
> Yes, 45ms is trivial to Desktop/Server. But our platform is for automotive
> and IOTG case, and these count there. US Department of Transportation
> has a requirement that the rear-view camera needs to be functional in 2
> seconds after power on. To achieve that, we've done things to get 20ms
> from PCI init, 5ms from disabling some ACPI_PM clocksource :)

That is your set of requirements. There are multiple other users of
this driver out there. We cannot just go in and arbitrarily change
core behaviors for one specific use case. I would much prefer this to
be something that can be changed either via a sysctl or via a module
parameter so that we can have this behavior turned off by default if
so desired.

> > were to make this sort of change it should probably be more
> > generically applied to either PCI devices or network devices instead
> > of doing this one driver at a time.
>
> Agree. I also mentioned this in commit log, I didn't do it for other drivers
> as I don't have HW to verify, and I would be happy to proceed if
> experts for those HW think this change is fine.

You normally don't need to test all possible hardware that could be
impacted by a change, but what you should do is try to test what you
have available.

This sort of change would make more sense as a PCI feature where you
essentially cause endpoint devices to asynchronously probe instead of
doing so synchronously if a certain kernel module parameter is set.
Otherwise if you ever change drivers in the future for some design you
will have to submit yet another patch for this. So for example one
thing you might look at doing is adding a new option for the "pci="
module parameter. You could specify for example something like
"pci=async_probe=pci:8086:1533" and then that would specify all i210
adapters with that device ID would be asynchronously probed instead of
going through the standard probe path.

> Technically I think it's fine, as making them async will only push their
> init later, which won't break their existing dependence. And there should
> be very few modules which depend on network drivers.

Actually this will break functionality on the 82576 quad port
adapters. Specifically we are using a static counter to identify which
groupings of 4 ports belonged together using the global_quad_port_a
value. With this changing to asynchronous you will end up confusing
the driver resulting in it randomly assigning WOL to possibly the
wrong port since the async code doesn't guarantee ordering of the
probe routines.

That would be another good reason why this should be handled as a per
PCI device/function type feature instead of trying to just make it
apply to all of igb.

> Thanks,
> Feng
>

Thanks.

- Alex

  reply	other threads:[~2019-01-22  2:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21  8:37 [PATCH] igb: Make driver init async Feng Tang
2019-01-21  8:37 ` [Intel-wired-lan] " Feng Tang
2019-01-21 22:50 ` Alexander Duyck
2019-01-21 22:50   ` Alexander Duyck
2019-01-22  1:40   ` Feng Tang
2019-01-22  1:40     ` Feng Tang
2019-01-22  2:29     ` Alexander Duyck [this message]
2019-01-22  2:29       ` Alexander Duyck
2019-01-22  2:39       ` Feng Tang
2019-01-22  2:39         ` Feng Tang

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=CAKgT0Uc14wOufpa2vspV6DZN-wF7QTqz2Te7QL7Ys06T8TMVkw@mail.gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=feng.tang@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.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 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.