From: Jani Nikula <jani.nikula@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v6 2/3] drm/i915: Prepare error capture to work with const modparams
Date: Wed, 20 Sep 2017 11:15:42 +0300 [thread overview]
Message-ID: <87a81p945t.fsf@nikula.org> (raw)
In-Reply-To: <20170919193846.38060-2-michal.wajdeczko@intel.com>
On Tue, 19 Sep 2017, Michal Wajdeczko <michal.wajdeczko@intel.com> wrote:
> We are planning to enforce "read_mostly" access to modparams.
> Let start handle modparams as it was already defined as const.
FWIW, __read_mostly is a hint for caching, not so much for the
developer. We've added __read_mostly to *reflect* the usage pattern, not
to *enforce* a usage pattern.
I don't disagree modifying should be discouraged, but please don't
conflate the concepts.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index c7aaf62..15fe8ed 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -820,7 +820,7 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
> kfree(obj);
> }
>
> -static __always_inline void free_param(const char *type, void *x)
> +static __always_inline void free_param(const char *type, const void *x)
> {
> if (!__builtin_strcmp(type, "char *"))
> kfree(*(void **)x);
> @@ -1680,7 +1680,7 @@ static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
> sizeof(error->device_info));
> }
>
> -static __always_inline void dup_param(const char *type, void *x)
> +static __always_inline void dup_param(const char *type, const void *x)
> {
> if (!__builtin_strcmp(type, "char *"))
> *(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
> @@ -1696,7 +1696,7 @@ static int capture(void *data)
> ktime_to_timeval(ktime_sub(ktime_get(),
> error->i915->gt.last_init_time));
>
> - error->params = i915_modparams;
> + memcpy(&error->params, &i915_modparams, sizeof(i915_modparams));
Nitpick, sizeof(error->params).
BR,
Jani.
> #define DUP(T, x) dup_param(#T, &error->params.x);
> I915_PARAMS_FOR_EACH(DUP);
> #undef DUP
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-20 8:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 19:38 [PATCH v6 1/3] drm/i915: Rename global i915 to i915_modparams Michal Wajdeczko
2017-09-19 19:38 ` [PATCH v6 2/3] drm/i915: Prepare error capture to work with const modparams Michal Wajdeczko
2017-09-20 8:15 ` Jani Nikula [this message]
2017-09-19 19:38 ` [PATCH v6 3/3] drm/i915: Make i915_modparams members const Michal Wajdeczko
2017-09-20 8:34 ` Jani Nikula
2017-09-20 9:54 ` Michal Wajdeczko
2017-09-20 11:43 ` Ville Syrjälä
2017-09-20 12:06 ` Joonas Lahtinen
2017-09-20 12:13 ` Joonas Lahtinen
2017-09-20 11:30 ` Joonas Lahtinen
2017-09-20 12:01 ` Jani Nikula
2017-09-20 13:07 ` Joonas Lahtinen
2017-09-21 10:05 ` Michal Wajdeczko
2017-09-22 12:24 ` Jani Nikula
2017-09-21 11:08 ` Jani Nikula
2017-09-19 20:52 ` ✗ Fi.CI.BAT: warning for series starting with [v6,1/3] drm/i915: Rename global i915 to i915_modparams Patchwork
2017-09-21 12:08 ` Patchwork
2017-09-21 14:29 ` ✓ Fi.CI.BAT: success " Patchwork
2017-09-21 15:44 ` ✗ Fi.CI.IGT: failure " 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=87a81p945t.fsf@nikula.org \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=michal.wajdeczko@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