2000-11-15 12:10:31

by Tigran Aivazian

[permalink] [raw]
Subject: [patch] fixes for kdb on 2.4.0-test11-pre5

Hi Keith,

Here is some fixes related to x86 capabilities changes in test11-pre5.
Against your latest patch (test11-pre5) from oss.sgi. Tested under
test11-pre5 on SMP.

Regards,
Tigran

--- arch/i386/kernel/traps.c.0 Wed Nov 15 11:20:34 2000
+++ arch/i386/kernel/traps.c Wed Nov 15 11:28:20 2000
@@ -1213,8 +1213,8 @@
set_trap_gate(12,&stack_segment);
set_trap_gate(13,&general_protection);
#if defined(CONFIG_KDB)
- if ((boot_cpu_data.x86_capability & X86_FEATURE_MCE) &&
- (boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability)) {
set_trap_gate(14,&page_fault_mca);
}
else {
--- arch/i386/kernel/apic.c.0 Wed Nov 15 11:26:27 2000
+++ arch/i386/kernel/apic.c Wed Nov 15 11:28:12 2000
@@ -210,7 +210,8 @@
int set_nmi_counter_local(void)
{
extern unsigned long cpu_khz;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
@@ -224,7 +225,8 @@
int setup_apic_nmi_watchdog(int value)
{
int ret, eax;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (!test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
--- arch/i386/kdb/kdbasupport.c.0 Wed Nov 15 11:29:16 2000
+++ arch/i386/kdb/kdbasupport.c Wed Nov 15 11:33:37 2000
@@ -1081,11 +1081,8 @@
/*
* Enable Machine Check Exceptions
*/
- u32 x86_capability;
-
- x86_capability = boot_cpu_data.x86_capability;
- if ((x86_capability & X86_FEATURE_MCE) &&
- (x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
u32 i, lv, hv, count;
rdmsr(MCG_CAP, lv, hv);
count = lv&0xff;
@@ -1141,7 +1138,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1173,7 +1170,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1205,9 +1202,8 @@
{
u32 from, to, dummy;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability))
return;
- }

rdmsr(LASTBRANCHFROMIP, from, dummy);
rdmsr(LASTBRANCHTOIP, to, dummy);


2000-11-15 15:24:38

by Tigran Aivazian

[permalink] [raw]
Subject: Re: [patch] fixes for kdb on 2.4.0-test11-pre5

On Wed, 15 Nov 2000, Tigran Aivazian wrote:

> Hi Keith,
>
> Here is some fixes related to x86 capabilities changes in test11-pre5.
> Against your latest patch (test11-pre5) from oss.sgi. Tested under
> test11-pre5 on SMP.
>

small (but important!) typo fixed, thanks to George
<[email protected]>. Here is updated patch:

--- arch/i386/kernel/traps.c.0 Wed Nov 15 11:20:34 2000
+++ arch/i386/kernel/traps.c Wed Nov 15 11:28:20 2000
@@ -1213,8 +1213,8 @@
set_trap_gate(12,&stack_segment);
set_trap_gate(13,&general_protection);
#if defined(CONFIG_KDB)
- if ((boot_cpu_data.x86_capability & X86_FEATURE_MCE) &&
- (boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
set_trap_gate(14,&page_fault_mca);
}
else {
--- arch/i386/kernel/apic.c.0 Wed Nov 15 11:26:27 2000
+++ arch/i386/kernel/apic.c Wed Nov 15 11:28:12 2000
@@ -210,7 +210,8 @@
int set_nmi_counter_local(void)
{
extern unsigned long cpu_khz;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
@@ -224,7 +225,8 @@
int setup_apic_nmi_watchdog(int value)
{
int ret, eax;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (!test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
--- arch/i386/kdb/kdbasupport.c.0 Wed Nov 15 11:29:16 2000
+++ arch/i386/kdb/kdbasupport.c Wed Nov 15 11:33:37 2000
@@ -1081,11 +1081,8 @@
/*
* Enable Machine Check Exceptions
*/
- u32 x86_capability;
-
- x86_capability = boot_cpu_data.x86_capability;
- if ((x86_capability & X86_FEATURE_MCE) &&
- (x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
u32 i, lv, hv, count;
rdmsr(MCG_CAP, lv, hv);
count = lv&0xff;
@@ -1141,7 +1138,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1173,7 +1170,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1205,9 +1202,8 @@
{
u32 from, to, dummy;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability))
return;
- }

rdmsr(LASTBRANCHFROMIP, from, dummy);
rdmsr(LASTBRANCHTOIP, to, dummy);

2000-11-15 15:46:41

by Tigran Aivazian

[permalink] [raw]
Subject: Re: [patch] fixes for kdb on 2.4.0-test11-pre5

On Wed, 15 Nov 2000, Tigran Aivazian wrote:

> On Wed, 15 Nov 2000, Tigran Aivazian wrote:
>
> > Hi Keith,
> >
> > Here is some fixes related to x86 capabilities changes in test11-pre5.
> > Against your latest patch (test11-pre5) from oss.sgi. Tested under
> > test11-pre5 on SMP.
> >
>
> small (but important!) typo fixed, thanks to George
> <[email protected]>. Here is updated patch:

I am sorry again -- third time lucky (hopefully): (so _that_ is why kdb
misbehaved earlier.... :)

--- arch/i386/kernel/traps.c.0 Wed Nov 15 11:20:34 2000
+++ arch/i386/kernel/traps.c Wed Nov 15 11:28:20 2000
@@ -1213,8 +1213,8 @@
set_trap_gate(12,&stack_segment);
set_trap_gate(13,&general_protection);
#if defined(CONFIG_KDB)
- if ((boot_cpu_data.x86_capability & X86_FEATURE_MCE) &&
- (boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
set_trap_gate(14,&page_fault_mca);
}
else {
--- arch/i386/kernel/apic.c.0 Wed Nov 15 11:26:27 2000
+++ arch/i386/kernel/apic.c Wed Nov 15 11:28:12 2000
@@ -210,7 +210,8 @@
int set_nmi_counter_local(void)
{
extern unsigned long cpu_khz;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (!test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
@@ -224,7 +225,8 @@
int setup_apic_nmi_watchdog(int value)
{
int ret, eax;
- if (!(boot_cpu_data.x86_capability & X86_FEATURE_APIC))
+
+ if (!test_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability))
return(-EIO);
if (nmi_watchdog_source && nmi_watchdog_source != 1)
return(0); /* Not using local APIC */
--- arch/i386/kdb/kdbasupport.c.0 Wed Nov 15 11:29:16 2000
+++ arch/i386/kdb/kdbasupport.c Wed Nov 15 11:33:37 2000
@@ -1081,11 +1081,8 @@
/*
* Enable Machine Check Exceptions
*/
- u32 x86_capability;
-
- x86_capability = boot_cpu_data.x86_capability;
- if ((x86_capability & X86_FEATURE_MCE) &&
- (x86_capability & X86_FEATURE_MCA)) {
+ if (test_bit(X86_FEATURE_MCE, &boot_cpu_data.x86_capability) &&
+ test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
u32 i, lv, hv, count;
rdmsr(MCG_CAP, lv, hv);
count = lv&0xff;
@@ -1141,7 +1138,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1173,7 +1170,7 @@
{
u32 lv, hv;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability)) {
if (lbr_warned) {
kdb_printf("kdb: machine does not support last branch recording\n");
lbr_warned = 1;
@@ -1205,9 +1202,8 @@
{
u32 from, to, dummy;

- if (!(boot_cpu_data.x86_capability & X86_FEATURE_MCA)) {
+ if (!test_bit(X86_FEATURE_MCA, &boot_cpu_data.x86_capability))
return;
- }

rdmsr(LASTBRANCHFROMIP, from, dummy);
rdmsr(LASTBRANCHTOIP, to, dummy);