From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
Michal Wajdeczko <michal.wajdeczko@intel.com>,
intel-gfx@lists.freedesktop.org
Cc: Ville Syrjala <ville.syrjala@intel.com>
Subject: Re: [PATCH v6 3/3] drm/i915: Make i915_modparams members const
Date: Wed, 20 Sep 2017 16:07:50 +0300 [thread overview]
Message-ID: <1505912870.8291.33.camel@linux.intel.com> (raw)
In-Reply-To: <87k20t7f4c.fsf@nikula.org>
On Wed, 2017-09-20 at 15:01 +0300, Jani Nikula wrote:
> On Wed, 20 Sep 2017, Joonas Lahtinen <joonas.lahtinen@linux.intel.com> wrote:
> > On Tue, 2017-09-19 at 19:38 +0000, Michal Wajdeczko wrote:
> > > We should discourage developers from modifying modparams.
> > > Introduce special macro for easier tracking of changes done
> > > in modparams and enforce its use by defining existing modparams
> > > members as const. Note that defining whole modparams struct
> > > as const makes checkpatch unhappy.
> > >
> > > v2: rebased
> > >
> > > Credits-to: Coccinelle
> > >
> > > @@
> > > identifier n;
> > > expression e;
> > > @@
> > > (
> > > - i915_modparams.n = e;
> > > + i915_modparams_set(n, e);
> >
> > Not cool with such a brief name, it really needs to be something more
> > standing out to make the developer think they've failed design if
> > they're calling the function.
> >
> > 'i915_modparams_force_write' is my current favourite.
> >
> > And we need huge kerneldoc comment for the function about the concerns
> > expressed by Jani, me and Ville. There must be no potential readers for
> > the variables while they're being changed, compiler optimizations need
> > to be watched for etc.
> >
> > Because really, if we change a module parameter variable while somebody
> > is for example running a loop based on it, we're in deep problems.
> >
> > Might be worthwhile having a i915_modparams_lock to be taken when
> > sanitization of options begins, and asserting that lock is held when
> > _force_write() is being called. rw_semaphore sounds like the right
> > choice here. Many can read but only one can write.
> >
> > Any opinions on that?
>
> It can't protect against users changing the parameters via sysfs, and I
> think fixing that at the moment would have an air of overengineering.
>
> I'm thinking review and merge patch 1 to fix the i915 name collision,
> and forget about the rest for now.
Agreed on merging, disagreeing on forgetting next steps.
> Too much controversy, no real rush or
> pressure to do anything right now beyond patch 1. Don't just do
> something, stand there.
The controversy seemed to be around compiler optimizations, and that
doesn't seem to be a worry. The other thing is how to name the
function, and that's not too bad discussion. It naturally shouldn't
block merging the first patch.
Reviewing the places where the modparams get written/read may only lead
to improvements as I see it. Any troublesome variables should get moved
to device state instead of module state. For example while sanitizing
enable_ppgtt and other user requested kernel parameters, we should copy
the state to relevant dynamic structures where it'll have an effect, if
we actually intend to support changing the parameters on the fly.
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
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 13:08 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
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 [this message]
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=1505912870.8291.33.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=ville.syrjala@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