intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Jouni Högander" <jouni.hogander@intel.com>,
	"Luca Coelho" <luciano.coelho@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>
Subject: Re: [PATCH] drm/i915/display: fix display param dup for NULL char * params
Date: Wed, 03 Apr 2024 11:03:38 +0300	[thread overview]
Message-ID: <87h6gieuud.fsf@intel.com> (raw)
In-Reply-To: <20240402155534.1788466-1-jani.nikula@intel.com>

On Tue, 02 Apr 2024, Jani Nikula <jani.nikula@intel.com> wrote:
> The display param duplication deviates from the original param
> duplication in that it converts NULL params to to allocated empty
> strings. This works for the vbt_firmware parameter, but not for
> dmc_firmware_path, the user of which interprets NULL and the empty
> string as distinct values. Specifically, the empty dmc_firmware_path
> leads to DMC and PM being disabled.
>
> Just remove the NULL check and pass it to kstrdup(), which safely
> returns NULL for NULL input.

Turns out this fails miserably as well. The debugfs for display params
oopses for NULL value while the i915 core debugfs doesn't. I obviously
didn't realize how the param handling was subtly different between the
two.

Since the quick fix didn't cut it, I've opted to revert 0d82a0d6f556
("drm/i915/display: move dmc_firmware_path to display params") with
Rodrigo's and Lucas' acks. Back to the drawing board.

We probably want to first address the issue with NULL and "" being
distinct values for firmware path params and the fact that you can't set
them back to NULL via debugfs or module param sysfs.

BR,
Jani.


> Fixes: 8015bee0bfec ("drm/i915/display: Add framework to add parameters specific to display")
> Fixes: 0d82a0d6f556 ("drm/i915/display: move dmc_firmware_path to display params")
> Cc: Jouni Högander <jouni.hogander@intel.com>
> Cc: Luca Coelho <luciano.coelho@intel.com>
> Cc: <stable@vger.kernel.org> # v6.8+
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_params.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
> index c8e3d6892e23..49c6b42077dc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_params.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_params.c
> @@ -176,9 +176,9 @@ void intel_display_params_dump(struct drm_i915_private *i915, struct drm_printer
>  #undef PRINT
>  }
>  
> -__maybe_unused static void _param_dup_charp(char **valp)
> +static void _param_dup_charp(char **valp)
>  {
> -	*valp = kstrdup(*valp ? *valp : "", GFP_ATOMIC);
> +	*valp = kstrdup(*valp, GFP_ATOMIC);
>  }
>  
>  __maybe_unused static void _param_nop(void *valp)

-- 
Jani Nikula, Intel

      parent reply	other threads:[~2024-04-03  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 15:55 [PATCH] drm/i915/display: fix display param dup for NULL char * params Jani Nikula
2024-04-02 16:24 ` Lucas De Marchi
2024-04-02 16:49   ` Jani Nikula
2024-04-02 18:14 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2024-04-02 18:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-04-03  8:03 ` Jani Nikula [this message]

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=87h6gieuud.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jouni.hogander@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=luciano.coelho@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 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).