mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Haverkamp <markh@osdl.org>
To: Andrew Morton <akpm@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>, john stultz <johnstul@us.ibm.com>
Subject: [PATCH] linux-2.6.0-test2_mtrr-race-fix_A0
Date: Thu, 07 Aug 2003 07:38:12 -0700	[thread overview]
Message-ID: <1060267092.24115.8.camel@markh1.pdx.osdl.net> (raw)
In-Reply-To: <1060192965.10732.58.camel@cog.beaverton.ibm.com>

On Wed, 2003-08-06 at 11:02, john stultz wrote:
> On Wed, 2003-08-06 at 11:05, Mark Haverkamp wrote:
> > On Wed, 2003-08-06 at 10:15, john stultz wrote:
> > > 
> > > Well, let me look at it again and see if I can come up with a proper
> > > fix. 
> > I added an extra sync up from the caller after the last gate change so
> > it is the last one to touch the automatic data.
> 
> Ah, you beat me to it! 
> 
> I'm actually testing the very same change (comments differ a touch, but
> that's ok).
> 
> Looks good. If everyone is happy I'd say resubmit it to Andrew.
> 
> thanks
> -john

I'd like to submit this patch for inclusion.  It adds an extra sync up
in set_mtrr and ipi_handler to make sure that set_mtrr is the last to
touch the automatic set_mtrr_data.


===== arch/i386/kernel/cpu/mtrr/main.c 1.29 vs edited =====
--- 1.29/arch/i386/kernel/cpu/mtrr/main.c	Tue Jul 15 10:08:48 2003
+++ edited/arch/i386/kernel/cpu/mtrr/main.c	Wed Aug  6 10:46:00 2003
@@ -169,6 +169,7 @@
 		cpu_relax();
 		barrier();
 	}
+	atomic_dec(&data->count);
 	local_irq_restore(flags);
 }
 
@@ -256,8 +257,18 @@
 		cpu_relax();
 		barrier();
 	}
-	local_irq_restore(flags);
+	atomic_set(&data.count, num_booting_cpus() - 1);
 	atomic_set(&data.gate,0);
+
+	/* 
+	 * Wait here for everyone to have seen the gate change
+	 * So we're the last ones to touch 'data'
+	 */
+	while(atomic_read(&data.count)) {
+		cpu_relax();
+		barrier();
+	}
+	local_irq_restore(flags);
 }
 
 /**


-- 
Mark Haverkamp <markh@osdl.org>


  reply	other threads:[~2003-08-07 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-06  8:52 [RFC][PATCH] linux-2.6.0-test2_mtrr-race-fix_A0 Mathias Fröhlich
2003-08-06 17:15 ` john stultz
2003-08-06 18:05   ` Mark Haverkamp
2003-08-06 18:02     ` john stultz
2003-08-07 14:38       ` Mark Haverkamp [this message]
2003-08-06 18:31   ` Zwane Mwaikambo
2003-08-06 20:24     ` john stultz
2003-08-07  5:06       ` Zwane Mwaikambo

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=1060267092.24115.8.camel@markh1.pdx.osdl.net \
    --to=markh@osdl.org \
    --cc=akpm@osdl.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®