Commit c32017a4 authored by Dave Jones's avatar Dave Jones

[X86] Rename MTRR mutex to something more sensible.

I spotted 'main_lock' whilst grovelling through a vmlinux with objdump.
Even if it is static, it's a horrible name.
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent f8a363b8
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
u32 num_var_ranges = 0; u32 num_var_ranges = 0;
unsigned int *usage_table; unsigned int *usage_table;
static DECLARE_MUTEX(main_lock); static DECLARE_MUTEX(mtrr_sem);
u32 size_or_mask, size_and_mask; u32 size_or_mask, size_and_mask;
...@@ -335,7 +335,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, ...@@ -335,7 +335,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
lock_cpu_hotplug(); lock_cpu_hotplug();
/* Search for existing MTRR */ /* Search for existing MTRR */
down(&main_lock); down(&mtrr_sem);
for (i = 0; i < num_var_ranges; ++i) { for (i = 0; i < num_var_ranges; ++i) {
mtrr_if->get(i, &lbase, &lsize, &ltype); mtrr_if->get(i, &lbase, &lsize, &ltype);
if (base >= lbase + lsize) if (base >= lbase + lsize)
...@@ -373,7 +373,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, ...@@ -373,7 +373,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
printk(KERN_INFO "mtrr: no more MTRRs available\n"); printk(KERN_INFO "mtrr: no more MTRRs available\n");
error = i; error = i;
out: out:
up(&main_lock); up(&mtrr_sem);
unlock_cpu_hotplug(); unlock_cpu_hotplug();
return error; return error;
} }
...@@ -466,7 +466,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) ...@@ -466,7 +466,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
max = num_var_ranges; max = num_var_ranges;
/* No CPU hotplug when we change MTRR entries */ /* No CPU hotplug when we change MTRR entries */
lock_cpu_hotplug(); lock_cpu_hotplug();
down(&main_lock); down(&mtrr_sem);
if (reg < 0) { if (reg < 0) {
/* Search for existing MTRR */ /* Search for existing MTRR */
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
...@@ -505,7 +505,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) ...@@ -505,7 +505,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
set_mtrr(reg, 0, 0, 0); set_mtrr(reg, 0, 0, 0);
error = reg; error = reg;
out: out:
up(&main_lock); up(&mtrr_sem);
unlock_cpu_hotplug(); unlock_cpu_hotplug();
return error; return error;
} }
...@@ -688,7 +688,7 @@ void mtrr_ap_init(void) ...@@ -688,7 +688,7 @@ void mtrr_ap_init(void)
if (!mtrr_if || !use_intel()) if (!mtrr_if || !use_intel())
return; return;
/* /*
* Ideally we should hold main_lock here to avoid mtrr entries changed, * Ideally we should hold mtrr_sem here to avoid mtrr entries changed,
* but this routine will be called in cpu boot time, holding the lock * 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 * breaks it. This routine is called in two cases: 1.very earily time
* of software resume, when there absolutely isn't mtrr entry changes; * of software resume, when there absolutely isn't mtrr entry changes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment