From: Jani Nikula <jani.nikula@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v3 3/3] drm/xe/uc: Add GuC/HuC firmware path overrides
Date: Thu, 14 Sep 2023 17:22:50 +0300 [thread overview]
Message-ID: <871qf0x29x.fsf@intel.com> (raw)
In-Reply-To: <ZQMSfcP5O8bRpkwO@intel.com>
On Thu, 14 Sep 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Thu, Sep 14, 2023 at 10:53:40AM +0300, Jani Nikula wrote:
>>
>> [hijacking the thread a bit, sorry]
>>
>> On Wed, 13 Sep 2023, Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> wrote:
>> > diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c
>> > index de85494e2280..0660017c3e83 100644
>> > --- a/drivers/gpu/drm/xe/xe_module.c
>> > +++ b/drivers/gpu/drm/xe/xe_module.c
>> > @@ -30,6 +30,16 @@ int xe_guc_log_level = 5;
>> > module_param_named(guc_log_level, xe_guc_log_level, int, 0600);
>> > MODULE_PARM_DESC(guc_log_level, "GuC firmware logging level (0=disable, 1..5=enable with verbosity min..max)");
>> >
>> > +char *xe_guc_firmware_path = NULL;
>> > +module_param_named_unsafe(guc_firmware_path, xe_guc_firmware_path, charp, 0400);
>> > +MODULE_PARM_DESC(guc_firmware_path,
>> > + "GuC firmware path to use instead of the default one");
>> > +
>> > +char *xe_huc_firmware_path = NULL;
>> > +module_param_named_unsafe(huc_firmware_path, xe_huc_firmware_path, charp, 0400);
>> > +MODULE_PARM_DESC(huc_firmware_path,
>> > + "HuC firmware path to use instead of the default one - empty string disables");
>> > +
>> > char *xe_param_force_probe = CONFIG_DRM_XE_FORCE_PROBE;
>> > module_param_named_unsafe(force_probe, xe_param_force_probe, charp, 0400);
>> > MODULE_PARM_DESC(force_probe,
>>
>> Not related to this patch specifically, but, uh, why does xe collect all
>> module parameters in one file like this?
>>
>> IMO there's two reasonable ways of defining module paramers:
>>
>> 1) Module parameters defined for static variables in each .c file where
>> needed, and avoid the need to access them in multiple .c files.
>>
>> 2) Module parameters defined in a single file, wrapped in a global
>> struct. (This is what i915 does.)
>>
>> Putting all of the variables in a single file, and exposing them
>> globally is not cool. You want to limit the number of module global
>> variables in big drivers like this.
>>
>> (Of course, primarily module parameters should be avoided altogether.)
>
> Well, I believe this is my fault. I explicitly asked folks to avoid doing
> what i915 was doing. Well, when I asked that I was more focused on avoiding
> the macros and doing in the same way that other drivers were doing.
>
> I really hated the explosion of parameters in our internal version of i915.
> We need to do our best to avoid, or at least minimize the amount of params
> and I believe the macros is like an incentive/invitation to bring more.
>
> Then while checking other big drivers around we see that there are many
> drivers doing the same extern exports as xe.
>
> Would something like iwlwifi_mod_params from
> drivers/net/wireless/intel/iwlwifi/iwl-modparams.h ease your concerns?
I think that's exactly 2) above. i915 having macro wrappers for this is
an implementation detail that's neither here nor there.
BR,
Jani.
>
> Thanks,
> Rodrigo.
>
>>
>> > diff --git a/drivers/gpu/drm/xe/xe_module.h b/drivers/gpu/drm/xe/xe_module.h
>> > index 2c1f9199f909..e1da1e9ca5cb 100644
>> > --- a/drivers/gpu/drm/xe/xe_module.h
>> > +++ b/drivers/gpu/drm/xe/xe_module.h
>> > @@ -10,4 +10,6 @@ extern bool force_execlist;
>> > extern bool enable_display;
>> > extern u32 xe_force_vram_bar_size;
>> > extern int xe_guc_log_level;
>> > +extern char *xe_guc_firmware_path;
>> > +extern char *xe_huc_firmware_path;
>> > extern char *xe_param_force_probe;
>>
>> Basically *every* extern in a big driver is a sign of a problem. Data is
>> not an interface.
>>
>> Yes, also i915_modparams violates this, but it groups the stuff together
>> under *one* extern struct with a "namespace", if you will.
>>
>>
>> BR,
>> Jani.
>>
>>
>> --
>> Jani Nikula, Intel
--
Jani Nikula, Intel
next prev parent reply other threads:[~2023-09-14 14:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 23:28 [Intel-xe] [PATCH v3 0/3] uC management cleanup Daniele Ceraolo Spurio
2023-09-13 23:28 ` [Intel-xe] [PATCH v3 1/3] drm/xe/uc: Rename guc_submission_enabled() to uc_enabled() Daniele Ceraolo Spurio
2023-09-14 15:36 ` Matthew Brost
2023-09-13 23:28 ` [Intel-xe] [PATCH v3 2/3] drm/xe/uc: Fix uC status tracking Daniele Ceraolo Spurio
2023-09-13 23:28 ` [Intel-xe] [PATCH v3 3/3] drm/xe/uc: Add GuC/HuC firmware path overrides Daniele Ceraolo Spurio
2023-09-14 7:53 ` Jani Nikula
2023-09-14 14:02 ` Rodrigo Vivi
2023-09-14 14:22 ` Jani Nikula [this message]
2023-09-14 19:01 ` John Harrison
2023-09-14 0:01 ` [Intel-xe] ✓ CI.Patch_applied: success for uC management cleanup (rev2) Patchwork
2023-09-14 0:01 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-09-14 0:02 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-09-14 0:09 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-14 0:10 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-14 0:11 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-14 0:43 ` [Intel-xe] ✓ CI.BAT: " 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=871qf0x29x.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.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.