[igt-dev] [PATCH] [PATCH i-g-t]lib/sw_sync:Fixing modprobe for sw_sync to return if not supported

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 3 15:36:53 UTC 2020


Quoting Melkaveri, Arjun (2020-07-03 13:05:35)
> On Fri, Jul 03, 2020 at 12:04:49PM +0100, Chris Wilson wrote:
> > Quoting Arjun Melkaveri (2020-07-03 11:33:52)
> > > Few tests that use "igt_require_sw_sync" , would not skip or assert the
> > > test if it fails to load sw_sync module.
> > > 
> > > Mentioned error is seen and test continues executing .
> > > "igt_kmod-DEBUG: Unknown symbol in module sw_sync or unknown parameter"
> > > 
> > > igt_require for modprobe in this file would skip the test if it fails
> > > to load the module.
> > 
> > Which then fails when it is builtin.
> > 
> > > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > > Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> > > Signed-off-by: Arjun Melkaveri <arjun.melkaveri at intel.com>
> > > ---
> > >  lib/sw_sync.c | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/lib/sw_sync.c b/lib/sw_sync.c
> > > index e860a2c1..ed8375ca 100644
> > > --- a/lib/sw_sync.c
> > > +++ b/lib/sw_sync.c
> > > @@ -228,16 +228,17 @@ int sync_fence_status(int fence)
> > >         return info.status;
> > >  }
> > >  
> > > -static void modprobe(const char *driver)
> > > +static int modprobe(const char *driver)
> > >  {
> > > -       igt_kmod_load(driver, NULL);
> > > +       return igt_kmod_load(driver, NULL);
> > >  }
> > >  
> > >  static bool kernel_has_sw_sync(void)
> > >  {
> > >         char buf[128];
> > >  
> > > -       modprobe("sw_sync");
> > > +       /* Make sure our Kernel supports sw_sync and the module is loaded. */
> > > +       igt_require(modprobe("sw_sync") == 0);
> > >  
> > >         return kernel_sw_sync_path(buf, sizeof(buf));
> > 
> > It's the return from this function that needs to be checked, and indeed
> > is: igt_require_sw_sync().
> > -Chris
> Test is able to find the path, but throws "Unknown symbol in module
> sw_sync or unknown parameter" error from modprobe-> igt_kmod_load .
> execision continues as Return value from igt_kmod_load is not been checked .
> I put that check only to make sure that modprob is success . 

That's because it's builtin not a module, so the load fail; but since
the driver exists, the path exists and sw_sync works.

So really it just wants to squelch the warning, and have a igt_require_f
in igt_require_sw_sync to explain the lack of module.
-Chris


More information about the igt-dev mailing list