Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: feng.tang@intel.com, Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, alek.du@intel.com
Subject: Re: [RFC] i915: make the probe asynchronous
Date: Wed, 20 Jun 2018 10:11:34 +0300	[thread overview]
Message-ID: <87bmc6vsnt.fsf@intel.com> (raw)
In-Reply-To: <20180620064701.nsa4nw56ro5dirp6@shbuild888>

On Wed, 20 Jun 2018, Feng Tang <feng.tang@intel.com> wrote:
> Hi Takashi, 
>
> On Wed, Jun 20, 2018 at 08:35:05AM +0200, Takashi Iwai wrote:
>> On Wed, 20 Jun 2018 08:25:23 +0200,
>> Feng Tang wrote:
>> > 
>> > Hi Jani/Chris/Takashi, 
>> > 
>> > On Wed, Jun 06, 2018 at 11:21:43AM +0300, Jani Nikula wrote:
>> > > >> 
>> > > >> http://patchwork.freedesktop.org/patch/msgid/20180323083048.13327-1-chris@chris-wilson.co.uk
>> > > >
>> > > > IIUC, you are waiting for the HDA audio driver to first handle the
>> > > > i915 sync probel case?
>> > > 
>> > > I wouldn't hold my breath waiting. If you want to do i915 async probe,
>> > > you'll probably have to figure hda out as well.
>> > 
>> > I made the following patch based on 4.18-rc1, and tested on my machine,
>> > which basically works fine with Async probe taking effect (I tried
>> > builtin and modules way).
>> > 
>> > Please review this initial version, and I'll separate to clean patches
>> > if you think it's OK. thanks!
>> 
>> When you call an i915 function from HD-audio driver, you made already
>> a hard dependency.  This is exactly what we want to avoid.
>
> Thanks for the info, I see your intension now.
>
> In previous discussion, Jani suggested to use a completion to indicate
> the probe done, I can't figure out another way :)

I suggested you do that within hdac_i915.c. Wait in snd_hdac_i915_init()
below request_module(), complete in hdac_component_master_bind().

BR,
Jani.

>
> In my own debug patch, I had put a 
> #ifndef CONFIG_DRM_I915
> static inline int  wait_i915_probe_done() {return -ENODEV;}
> #else
> ....
> #endif
>
> Is this fine?
>
> btw, for hdac_i915.c, if it is already bound with i915, can we make
> it an separte module to dedpend on i915?
>
> Thanks,
> Feng
>
>> 
>> 
>> thanks,
>> 
>> Takashi
>> 
>> > 
>> > - Feng
>> > 
>> > 
>> > ------
>> > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
>> > index 4364922..16a59ae 100644
>> > --- a/drivers/gpu/drm/i915/i915_pci.c
>> > +++ b/drivers/gpu/drm/i915/i915_pci.c
>> > @@ -671,6 +671,21 @@ static const struct pci_device_id pciidlist[] = {
>> >  };
>> >  MODULE_DEVICE_TABLE(pci, pciidlist);
>> >  
>> > +static struct completion i915_probe_done;
>> > +
>> > +int wait_i915_probe_done(int timeout)
>> > +{
>> > +	int ret;
>> > +
>> > +	ret = wait_for_completion_interruptible_timeout(&i915_probe_done, timeout);
>> > +	if (ret <= 0)
>> > +		return -ENODEV;
>> > +
>> > +	return 0;
>> > +}
>> > +EXPORT_SYMBOL_GPL(wait_i915_probe_done);
>> > +
>> > +
>> >  static void i915_pci_remove(struct pci_dev *pdev)
>> >  {
>> >  	struct drm_device *dev = pci_get_drvdata(pdev);
>> > @@ -717,6 +732,7 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> >  		return err > 0 ? -ENOTTY : err;
>> >  	}
>> >  
>> > +	complete_all(&i915_probe_done);
>> >  	return 0;
>> >  }
>> >  
>> > @@ -726,6 +742,7 @@ static struct pci_driver i915_pci_driver = {
>> >  	.probe = i915_pci_probe,
>> >  	.remove = i915_pci_remove,
>> >  	.driver.pm = &i915_pm_ops,
>> > +	.driver.probe_type = PROBE_PREFER_ASYNCHRONOUS,
>> >  };
>> >  
>> >  static int __init i915_init(void)
>> > @@ -755,6 +772,8 @@ static int __init i915_init(void)
>> >  		return 0;
>> >  	}
>> >  
>> > +	init_completion(&i915_probe_done);
>> > +
>> >  	return pci_register_driver(&i915_pci_driver);
>> >  }
>> >  
>> > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
>> > index c9e5a66..adae172 100644
>> > --- a/include/drm/i915_drm.h
>> > +++ b/include/drm/i915_drm.h
>> > @@ -36,6 +36,12 @@ extern bool i915_gpu_lower(void);
>> >  extern bool i915_gpu_busy(void);
>> >  extern bool i915_gpu_turbo_disable(void);
>> >  
>> > +/*
>> > + * For use by HDA driver for now
>> > + * Return 0 on i915 probe is done, and -ENODEV on error
>> > + */
>> > +extern int wait_i915_probe_done(int timeout);
>> > +
>> >  /* Exported from arch/x86/kernel/early-quirks.c */
>> >  extern struct resource intel_graphics_stolen_res;
>> >  
>> > diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
>> > index cbe818e..48e5039 100644
>> > --- a/sound/hda/hdac_i915.c
>> > +++ b/sound/hda/hdac_i915.c
>> > @@ -17,6 +17,7 @@
>> >  #include <linux/pci.h>
>> >  #include <linux/component.h>
>> >  #include <drm/i915_component.h>
>> > +#include <drm/i915_drm.h>
>> >  #include <sound/core.h>
>> >  #include <sound/hdaudio.h>
>> >  #include <sound/hda_i915.h>
>> > @@ -357,6 +358,7 @@ static bool i915_gfx_present(void)
>> >   *
>> >   * Returns zero for success or a negative error code.
>> >   */
>> > +#define HDAC_WAIT_I915_LOAD_MS	3000
>> >  int snd_hdac_i915_init(struct hdac_bus *bus)
>> >  {
>> >  	struct component_match *match = NULL;
>> > @@ -386,7 +388,11 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
>> >  	 * Atm, we don't support deferring the component binding, so make sure
>> >  	 * i915 is loaded and that the binding successfully completes.
>> >  	 */
>> > -	request_module("i915");
>> > +	ret = wait_i915_probe_done(HDAC_WAIT_I915_LOAD_MS);
>> > +	if (ret) {
>> > +		dev_info(dev, "failed to wait for i915 probe done\n");
>> > +		goto out_master_del;
>> > +	}
>> >  
>> >  	if (!acomp->ops) {
>> >  		ret = -ENODEV;
>> > 

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-06-20  7:11 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  5:32 [RFC] i915: make the probe asynchronous Feng Tang
2018-06-04  6:27 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-06-04  7:18 ` ✓ Fi.CI.IGT: " Patchwork
2018-06-05  7:41 ` [RFC] " Jani Nikula
2018-06-05  7:51   ` Feng Tang
2018-06-05  8:18     ` Jani Nikula
2018-06-06  7:36       ` Feng Tang
2018-06-06  8:21         ` Jani Nikula
2018-06-20  6:25           ` Feng Tang
2018-06-20  6:35             ` Takashi Iwai
2018-06-20  6:47               ` Feng Tang
2018-06-20  7:11                 ` Jani Nikula [this message]
2018-06-20  8:02                   ` Daniel Vetter
2018-06-20  9:45                     ` Takashi Iwai
2018-06-21  6:52                       ` Feng Tang
2018-06-25 15:36                       ` Daniel Vetter
2018-06-26  2:29                         ` Feng Tang
2018-07-12  1:29                           ` Feng Tang
2018-07-12  6:54                             ` Daniel Vetter
2018-07-12  6:56                               ` Takashi Iwai
2018-07-12  7:37                                 ` Daniel Vetter
2018-07-12  7:57                                   ` Feng Tang
2018-07-12  7:51                               ` Feng Tang
2018-08-14  6:54                                 ` Feng Tang
2018-08-14  9:34                                   ` Daniel Vetter
2018-08-14  9:39                                     ` Takashi Iwai
2018-08-16  7:40                                       ` Feng Tang
2022-10-28 21:55                                         ` [Intel-gfx] " Brian Norris
2018-06-20  9:46                   ` Feng Tang
2018-06-20 11:16                     ` Jani Nikula
2018-06-20  6:37 ` ✗ Fi.CI.CHECKPATCH: warning for i915: make the probe asynchronous (rev2) Patchwork
2018-06-20  6:59 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-06-20  9:58 ` ✗ Fi.CI.CHECKPATCH: warning for i915: make the probe asynchronous (rev3) Patchwork
2018-06-20 10:13 ` ✓ Fi.CI.BAT: success " Patchwork
2018-06-20 11:34 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-12  9:03 ` ✗ Fi.CI.CHECKPATCH: warning for i915: make the probe asynchronous (rev4) Patchwork
2018-07-12  9:20 ` ✓ Fi.CI.BAT: success " Patchwork

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=87bmc6vsnt.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=alek.du@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=feng.tang@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tiwai@suse.de \
    /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