mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nick Piggin <npiggin@suse.de>, "mingo@elte.hu" <mingo@elte.hu>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [patch] x86: Rendezvous all the cpu's for MTRR/PAT init
Date: Wed, 19 Aug 2009 14:59:29 +0800	[thread overview]
Message-ID: <20090819065929.GA21824@sli10-desk.sh.intel.com> (raw)
In-Reply-To: <1250662857.2615.42.camel@sbs-t61>

On Wed, Aug 19, 2009 at 02:20:57PM +0800, Siddha, Suresh B wrote:
> On Tue, 2009-08-18 at 18:01 -0700, Andrew Morton wrote:
> > On Tue, 18 Aug 2009 17:30:35 -0700 Suresh Siddha <suresh.b.siddha@intel.com> wrote:
> > > +	/*
> > > +	 * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed,
> > > +	 * but this routine will be called in cpu boot time, holding the lock
> > > +	 * breaks it. This routine is called in two cases: 1.very earily time
> > > +	 * of software resume, when there absolutely isn't mtrr entry changes;
> > > +	 * 2.cpu hotadd time. We let mtrr_add/del_page hold cpuhotplug lock to
> > > +	 * prevent mtrr entry changes
> > > +	 */
> > 
> > That's a tantalising little comment.  What does "breaks it" mean?  How
> > can reviewers and later code-readers possibly suggest alternative fixes
> > to this breakage if they aren't told what it is?
> 
> This is a cut and paste comment coming from the previous code. Shaohua
> added this comment originally and I think this is the case he is trying
> to avoid.
> 
> cpu - A modifying/adding a  MTRR register
> 
> cpu - B is coming online
> 
> if cpu - A doesn't take the cpu hotplug lock, then potentially what can
> happen is that cpu B will update its mtrr's with old state and now A can
> change the state and before B comes completely online, A can do send the
> MTRR update to all cpu's except B.
> 
> So Shaohua's code is taking cpu hotplug lock before A updates MTRR's so
> that B's MTRRs are always is in sync with rest of the cpu's in the
> system. Only the mtrr_mutex is not enough.
> 
> Nevertheless as far as this patch is concerned mtrr_aps_init() gets
> called during early boot/resume time and as such we never hit this
> condition. So I removed this comment in the new patch appended.
> 
> Shaohua if you agree with my explanation we can have a separate patch to
> make the original comment more meaningful.
Yes, your explanation is correct.

Thanks,
Shaohua

  reply	other threads:[~2009-08-19  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  0:30 Suresh Siddha
2009-08-19  1:01 ` Andrew Morton
2009-08-19  6:20   ` Suresh Siddha
2009-08-19  6:59     ` Shaohua Li [this message]
2009-08-19  7:50     ` Nick Piggin
2009-08-19 13:10       ` Ingo Molnar

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=20090819065929.GA21824@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@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

all inboxes | Powered by JetHome®