Patches contributed by Eötvös Lorand University
commit 2c78ffeca98fcd5a1dfd4a322438944506ed5e64
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Oct 25 08:41:09 2010 +0200
x86/oprofile: Fix uninitialized variable use in debug printk
Stephen Rothwell reported this build warning:
arch/x86/oprofile/op_model_amd.c: In function 'ibs_eilvt_valid':
arch/x86/oprofile/op_model_amd.c:289: warning: 'offset' may be used uninitialized in this function
And correctly observed that indeed the variable is used uninitialized in
this function. The result of this bug can be a debug printk with a bogus
value.
Also fix a few more small details that made this function hard to read
and which probably contributed to the bug being introduced to begin with:
- Use more symmetric error conditions
- Remove the !0 obfuscation
- Add newlines to the printk output
- Remove bogus linebreaks in printk strings and elsewhere
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
LKML-Reference: <20101025115736.41d51abe.sfr@canb.auug.org.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 42fb46f83883..68759e716f0f 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -281,29 +281,25 @@ static inline int eilvt_is_available(int offset)
static inline int ibs_eilvt_valid(void)
{
- u64 val;
int offset;
+ u64 val;
rdmsrl(MSR_AMD64_IBSCTL, val);
+ offset = val & IBSCTL_LVT_OFFSET_MASK;
+
if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
- pr_err(FW_BUG "cpu %d, invalid IBS "
- "interrupt offset %d (MSR%08X=0x%016llx)",
- smp_processor_id(), offset,
- MSR_AMD64_IBSCTL, val);
+ pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
+ smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
return 0;
}
- offset = val & IBSCTL_LVT_OFFSET_MASK;
-
- if (eilvt_is_available(offset))
- return !0;
-
- pr_err(FW_BUG "cpu %d, IBS interrupt offset %d "
- "not available (MSR%08X=0x%016llx)",
- smp_processor_id(), offset,
- MSR_AMD64_IBSCTL, val);
+ if (!eilvt_is_available(offset)) {
+ pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
+ smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
+ return 0;
+ }
- return 0;
+ return 1;
}
static inline int get_ibs_offset(void)
commit b8ecad8b2f8757d51632b1ea6d602c1f7b9760a2
Merge: eea4a0b19a27 8bfb5e7d6a14
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Oct 23 20:05:43 2010 +0200
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/urgent
commit eea4a0b19a2719e3e23b5450dd9fbe97789d2a57
Merge: d7842da470f2 dd49a38cf309
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Oct 22 15:13:45 2010 +0200
Merge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/urgent
commit 14d4962dc863ab42e898d66d4837aa6c3afedc3b
Merge: 9717967c4b70 2b666ca4a68c
Author: Ingo Molnar <mingo@elte.hu>
Date: Wed Oct 20 04:38:56 2010 +0200
Merge branch 'linus' into irq/core
Merge reason: update to almost-final-.36
Signed-off-by: Ingo Molnar <mingo@elte.hu>
commit 750ed158bf6c782d2813da1bca2c824365a0b777
Merge: 3f7edb1656e5 7e40798f406f
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Oct 19 20:41:38 2010 +0200
Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
commit 1fa41266e9d20f6d66f9d7d067d9825e2c1002b9
Merge: ebf31f502492 d7b4d6de57d4
Author: Ingo Molnar <mingo@elte.hu>
Date: Tue Oct 19 08:21:10 2010 +0200
Merge branch 'tip/perf/recordmcount-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
commit b7dadc38797584f6203386da1947ed5edf516646
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Oct 18 20:00:37 2010 +0200
sched: Export account_system_vtime()
KVM uses it for example:
ERROR: "account_system_vtime" [arch/x86/kvm/kvm.ko] undefined!
Cc: Venkatesh Pallipadi <venki@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1286237003-12406-3-git-send-email-venki@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/sched.c b/kernel/sched.c
index 567f5cb9808c..5998222f901c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1991,6 +1991,7 @@ void account_system_vtime(struct task_struct *curr)
local_irq_restore(flags);
}
+EXPORT_SYMBOL_GPL(account_system_vtime);
static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time)
{
commit f2f108eb4511f22a6f7568090cfcf4e7b2dc0f62
Merge: 756b0322e50a 2b666ca4a68c
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Oct 18 18:43:43 2010 +0200
Merge branch 'linus' into core/locking
Merge reason: Update to almost-final-.36
Signed-off-by: Ingo Molnar <mingo@elte.hu>
commit f92f6e6ee35d2779aa62e70f78ad8e1cd417eb52
Merge: 66af86e2c630 cd254f295248
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Oct 16 20:17:25 2010 +0200
Merge branch 'core' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile into perf/core
commit 66af86e2c630908b21cec018cb612576cf5f516e
Merge: 0fdf13606b67 85caa993d7f2
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Oct 16 14:48:58 2010 +0200
Merge branch 'tip/perf/recordmcount' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core