From: "Eli Chen" <eli@routefree.com>
To: <brian.kuschak@skystream.com>
Cc: <linuxppc-embedded@lists.linuxppc.org>
Subject: RE: dcache BUG()
Date: Mon, 7 May 2001 12:04:55 -0700 [thread overview]
Message-ID: <027b01c0d728$9a702b80$4b00000a@foolio1> (raw)
Brian,
I have also seen the dcache BUG, as well as bugs and warnings from other
parts of the kernel in the MontaVista 2.4.0 kernel. They all seem to be
related to a inconsistency with reference counters, which led me to suspect
a problem with atomic instructions in our kernel. I have replaced the
lwarx/stcrx pairs in include/asm-ppc/atomic.h with code that just turns off
and on interrupts, and that seemed to have made the error messages and BUGs
disappear. Please try this patch and see if you still have the same
problems. This is really just a work around for us until we find out what
is the real problem.
thanks,
Eli
diff -c -r1.1.1.2 atomic.h
*** atomic.h 2001/02/21 00:53:16 1.1.1.2
--- atomic.h 2001/05/07 18:35:10
***************
*** 5,10 ****
--- 5,25 ----
#ifndef _ASM_PPC_ATOMIC_H_
#define _ASM_PPC_ATOMIC_H_
+ struct int_control_struct
+ {
+ void (*int_cli)(void);
+ void (*int_sti)(void);
+ void (*int_restore_flags)(unsigned long);
+ void (*int_save_flags)(unsigned long *);
+ void (*int_set_lost)(unsigned long);
+ };
+
+ extern struct int_control_struct int_control;
+ #define __cli() int_control.int_cli()
+ #define __sti() int_control.int_sti()
+ #define __save_flags(flags) int_control.int_save_flags((unsigned long
*)&flags)
+ #define __restore_flags(flags) int_control.int_restore_flags((unsigned
long)flags)
+
typedef struct { volatile int counter; } atomic_t;
#define ATOMIC_INIT(i) { (i) }
***************
*** 17,80 ****
static __inline__ int atomic_add_return(int a, atomic_t *v)
{
! int t;
! __asm__ __volatile__("\n\
! 1: lwarx %0,0,%3\n\
! add %0,%2,%0\n\
! stwcx. %0,0,%3\n\
! bne- 1b"
! : "=&r" (t), "=m" (v->counter)
! : "r" (a), "r" (v), "m" (v->counter)
! : "cc");
return t;
}
static __inline__ int atomic_sub_return(int a, atomic_t *v)
{
! int t;
! __asm__ __volatile__("\n\
! 1: lwarx %0,0,%3\n\
! subf %0,%2,%0\n\
! stwcx. %0,0,%3\n\
! bne- 1b"
! : "=&r" (t), "=m" (v->counter)
! : "r" (a), "r" (v), "m" (v->counter)
! : "cc");
return t;
}
static __inline__ int atomic_inc_return(atomic_t *v)
{
! int t;
! __asm__ __volatile__("\n\
! 1: lwarx %0,0,%2\n\
! addic %0,%0,1\n\
! stwcx. %0,0,%2\n\
! bne- 1b"
! : "=&r" (t), "=m" (v->counter)
! : "r" (v), "m" (v->counter)
! : "cc");
return t;
}
static __inline__ int atomic_dec_return(atomic_t *v)
{
! int t;
! __asm__ __volatile__("\n\
! 1: lwarx %0,0,%2\n\
! addic %0,%0,-1\n\
! stwcx. %0,0,%2\n\
! bne 1b"
! : "=&r" (t), "=m" (v->counter)
! : "r" (v), "m" (v->counter)
! : "cc");
return t;
}
--- 32,91 ----
static __inline__ int atomic_add_return(int a, atomic_t *v)
{
! int flags, t;
!
! __save_flags(flags);__cli();
! t = (v)->counter;
! t = t + a;
! (v)->counter = t;
+ __restore_flags(flags);
+
return t;
}
static __inline__ int atomic_sub_return(int a, atomic_t *v)
{
! int flags, t;
!
! __save_flags(flags);__cli();
! t = (v)->counter;
! t = t - a;
! (v)->counter = t;
+ __restore_flags(flags);
+
return t;
}
static __inline__ int atomic_inc_return(atomic_t *v)
{
! int flags, t;
!
! __save_flags(flags);__cli();
!
! t = (v)->counter;
! t = t + 1;
! (v)->counter = t;
! __restore_flags(flags);
return t;
}
static __inline__ int atomic_dec_return(atomic_t *v)
{
! int flags, t;
!
! __save_flags(flags);__cli();
!
! t = (v)->counter;
! t = t - 1;
! (v)->counter = t;
! __restore_flags(flags);
return t;
}
diff -c -r1.1.1.2 hw_irq.h
*** hw_irq.h 2001/02/21 00:53:16 1.1.1.2
--- hw_irq.h 2001/05/07 18:35:27
***************
*** 7,12 ****
--- 7,13 ----
#ifndef _PPC_HW_IRQ_H
#define _PPC_HW_IRQ_H
+ #ifndef _ASM_PPC_ATOMIC_H_
struct int_control_struct
{
void (*int_cli)(void);
***************
*** 15,20 ****
--- 16,23 ----
void (*int_save_flags)(unsigned long *);
void (*int_set_lost)(unsigned long);
};
+ #endif
+
extern struct int_control_struct int_control;
extern unsigned long timer_interrupt_intercept;
extern unsigned long do_IRQ_intercept;
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next reply other threads:[~2001-05-07 19:04 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-07 19:04 Eli Chen [this message]
2001-05-07 21:04 ` dcache BUG() Dan Malek
2001-05-07 21:17 ` Dan Malek
2001-05-07 21:30 ` Tom Rini
2001-05-07 23:03 ` Dan Malek
2001-05-07 21:47 ` Eli Chen
2001-05-07 23:01 ` Dan Malek
2001-05-07 23:06 ` Gabriel Paubert
2001-05-07 23:15 ` Dan Malek
2001-05-07 23:28 ` Gabriel Paubert
2001-05-07 23:35 ` Eli Chen
2001-05-07 23:36 ` Dan Malek
2001-05-08 0:16 ` Eli Chen
2001-05-08 0:41 ` Dan Malek
2001-05-08 1:14 ` Eli Chen
2001-05-08 1:11 ` Dan Malek
2001-05-08 18:01 ` David Blythe
2001-05-08 20:27 ` Dan Malek
2001-05-08 21:34 ` David Blythe
2001-05-08 21:49 ` Dan Malek
2001-05-08 22:34 ` Ira Weiny
2001-05-08 22:53 ` Dan Malek
2001-05-08 1:37 ` Gabriel Paubert
2001-05-08 1:44 ` Dan Malek
2001-05-07 23:40 ` Gabriel Paubert
-- strict thread matches above, loose matches on Subject: below --
2001-05-12 0:44 Brian Kuschak
2001-05-12 0:57 ` Eli Chen
2001-05-14 9:28 ` Gabriel Paubert
2001-05-10 21:20 Brian Kuschak
2001-05-10 21:26 ` Dan Malek
2001-05-09 16:40 Brian Kuschak
2001-05-09 18:31 ` Dan Malek
2001-05-09 19:18 ` Gabriel Paubert
2001-05-10 18:39 ` Frank Rowand
2001-05-10 18:49 ` Gabriel Paubert
2001-05-10 19:10 ` Frank Rowand
2001-05-11 4:23 ` Paul Mielke
2001-05-11 10:09 ` Gabriel Paubert
2001-05-10 20:56 ` Dan Malek
2001-05-10 23:14 ` Cort Dougan
2001-05-11 11:01 ` Gabriel Paubert
2001-05-11 10:57 ` Gabriel Paubert
2001-05-11 18:49 ` Dan Malek
2001-05-08 17:43 Brian Kuschak
2001-05-09 11:06 ` Gabriel Paubert
2001-05-08 15:43 Brian Kuschak
2001-05-08 3:36 Brian Kuschak
2001-05-08 1:53 Brian Kuschak
2001-05-08 2:03 ` Dan Malek
2001-05-08 11:59 ` Gabriel Paubert
2001-05-08 0:40 Brian Kuschak
2001-05-07 23:01 Brian Kuschak
2001-05-07 22:19 Brian Kuschak
2001-05-07 22:35 ` Cort Dougan
2001-05-07 22:43 ` Eli Chen
2001-05-07 17:21 Brian Kuschak
2001-05-07 20:58 ` Dan Malek
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='027b01c0d728$9a702b80$4b00000a@foolio1' \
--to=eli@routefree.com \
--cc=brian.kuschak@skystream.com \
--cc=linuxppc-embedded@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).