From: Robert Love <rml@tech9.net>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: [PATCH] preempt-safe load_LDT
Date: 20 Jul 2002 13:21:57 -0700 [thread overview]
Message-ID: <1027196517.1085.769.camel@sinai> (raw)
Linus,
Attached patch makes load_LDT preempt-safe per our off-list discussion.
Header dependencies prevent use of the get_cpu()/put_cpu() methods so we
explicitly call disable/enable.
This is Ingo Molnar's version of the patch: I like how he broke up
load_LDT into two versions better.
Patch is against 2.5.27, please apply.
Robert Love
diff -urN linux-2.5.27/include/asm-i386/desc.h linux/include/asm-i386/desc.h
--- linux-2.5.27/include/asm-i386/desc.h Sat Jul 20 12:11:03 2002
+++ linux/include/asm-i386/desc.h Sat Jul 20 12:48:15 2002
@@ -90,9 +90,8 @@
/*
* load one particular LDT into the current CPU
*/
-static inline void load_LDT (mm_context_t *pc)
+static inline void load_LDT_no_preempt(mm_context_t *pc, int cpu)
{
- int cpu = smp_processor_id();
void *segments = pc->ldt;
int count = pc->size;
@@ -104,6 +103,14 @@
set_ldt_desc(cpu, segments, count);
__load_LDT(cpu);
}
+static inline void load_LDT(mm_context_t *pc)
+{
+ int cpu = smp_processor_id();
+
+ preempt_disable();
+ load_LDT_no_preempt(pc, cpu);
+ preempt_enable();
+}
#endif /* !__ASSEMBLY__ */
diff -urN linux-2.5.27/include/asm-i386/mmu_context.h linux/include/asm-i386/mmu_context.h
--- linux-2.5.27/include/asm-i386/mmu_context.h Sat Jul 20 12:11:04 2002
+++ linux/include/asm-i386/mmu_context.h Sat Jul 20 12:48:15 2002
@@ -44,7 +44,7 @@
* has a non-default LDT.
*/
if (next->context.size+prev->context.size)
- load_LDT(&next->context);
+ load_LDT_no_preempt(&next->context, cpu);
}
#ifdef CONFIG_SMP
else {
@@ -56,7 +56,7 @@
* tlb flush IPI delivery. We must reload %cr3.
*/
load_cr3(next->pgd);
- load_LDT(&next->context);
+ load_LDT_no_preempt(&next->context, cpu);
}
}
#endif
next reply other threads:[~2002-07-20 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-20 20:21 Robert Love [this message]
2002-07-20 20:42 ` Linus Torvalds
2002-07-20 20:51 ` 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=1027196517.1085.769.camel@sinai \
--to=rml@tech9.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@transmeta.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®