Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Joel Soete <soete.joel@tiscali.be>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: randolph@tausq.org, parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] [RFC] rewrite kernel spinlock code to work better with gcc
Date: Sat, 29 Nov 2003 23:50:37 +0000	[thread overview]
Message-ID: <3FC930CD.9070105@tiscali.be> (raw)
In-Reply-To: <200311261654.hAQGsUCa011684@hiauly1.hia.nrc.ca>


John David Anglin wrote:
>>+/* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
>>+   and GCC only guarantees 8-byte alignment for stack locals, we can't
>>+   be assured of 16-byte alignment for atomic lock data even if we
>>+   specify "__attribute ((aligned(16)))" in the type declaration.  So,
>>+   we use a struct containing an array of four ints for the atomic lock
>>+   type and dynamically select the 16-byte aligned int from the array
>>+   for the semaphore.  */
>>+#define __PA_LDCW_ALIGNMENT 16
>>+#define __ldcw_align(a) ({ \
>>+  unsigned long __ret = (unsigned long) a;                     		\
>>+  __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); \
>>+  (unsigned int *) __ret;                                               \
>>+})
> 
> 
> Change cast to "volatile unsigned int *".
> 
> 
>> typedef struct {
>>-	volatile unsigned int __attribute__((aligned(16))) lock;
>>+	volatile unsigned int lock[4];
>> } spinlock_t;
>> #endif
> 
> 
> Is the struct necessary?  For example,
> 
hmm i supposed that came from 2.4 struct:
typedef struct {
#ifdef CONFIG_PA20
	volatile unsigned int lock;
#else
	volatile unsigned int __attribute__((aligned(16))) lock;
#endif
#ifdef CONFIG_DEBUG_SPINLOCK
	volatile unsigned long owner_pc;
	volatile unsigned long owner_cpu;
#endif
} spinlock_t;

But I don't know yet if CONFIG_DEBUG_SPINLOCK is still foreseen for 2.6

Thanks,
	Joel

  reply	other threads:[~2003-11-29 23:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-26  7:07 [parisc-linux] [RFC] rewrite kernel spinlock code to work better with gcc Randolph Chung
2003-11-26 16:54 ` John David Anglin
2003-11-29 23:50   ` Joel Soete [this message]
2003-11-29 23:35 ` Joel Soete
2003-11-30  0:43 ` [parisc-linux] spinlock 2.4 re-organise a la 2.6 [was: [RFC] rewrite kernel spinlock code to work better with gcc] Joel Soete
2003-11-30  3:37   ` Grant Grundler
2003-11-30 10:39     ` Joel Soete
2003-11-30 10:57     ` Joel Soete
2003-11-30 16:31     ` Joel Soete
2003-11-30 21:10       ` Grant Grundler
2003-12-01  7:00         ` Joel Soete
2003-11-30  0:51 ` [parisc-linux] [RFC] rewrite kernel spinlock code to work better with gcc Joel Soete
2003-12-01 15:14 ` Joel Soete
2003-12-01 18:30   ` John David Anglin
2003-12-02 16:42     ` Joel Soete

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=3FC930CD.9070105@tiscali.be \
    --to=soete.joel@tiscali.be \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=randolph@tausq.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