From: Pete Zaitcev <zaitcev@redhat.com>
To: schwidefsky@de.ibm.com
Cc: zaitcev@redhat.com, linux-kernel@vger.kernel.org
Subject: s390(64) per_cpu in modules (ipv6)
Date: Tue, 29 Jun 2004 23:35:37 -0700 [thread overview]
Message-ID: <20040629233537.523db68c@lembas.zaitcev.lan> (raw)
Hi, Martin,
I tried to build ipv6 as a module in 2.6.7, and it bombs, producing a
module which wants per_cpu____icmpv6_socket (obviously, undefined).
The problem appears to be caused by this:
#define __get_got_cpu_var(var,offset) \
(*({ unsigned long *__ptr; \
asm ( "larl %0,per_cpu__"#var"@GOTENT" : "=a" (__ptr) ); \
((typeof(&per_cpu__##var))((*__ptr) + offset)); \
}))
The net/ipv6/icmp.c has this:
static DEFINE_PER_CPU(struct socket *, __icmpv6_socket) = NULL;
It is a static variable, and all references to it come from asm code.
The gcc does not know that they are present and optimizes the variable
away. It simply emits no code to define per_cpu____icmpv6_socket
whatsoever, as verified with gcc -S.
If the DEFINE_PER_CPU() is used without static, or if a bogus
reference is added to the C code (a printk), everything works.
I tried to add a fake input argument to the asm, like this:
--- linux-2.6.7-1.459/include/asm-s390/percpu.h 2004-06-16 01:20:04.000000000 -0400
+++ linux-2.6.7-1.459.z1/include/asm-s390/percpu.h 2004-06-29 22:03:23.000000000 -0400
@@ -15,7 +15,7 @@
#if defined(__s390x__) && defined(MODULE)
#define __get_got_cpu_var(var,offset) \
(*({ unsigned long *__ptr; \
- asm ( "larl %0,per_cpu__"#var"@GOTENT" : "=a" (__ptr) ); \
+ asm ( "larl %0,per_cpu__"#var"@GOTENT" : "=a" (__ptr) : "a" (&per_cpu__##var) ); \
((typeof(&per_cpu__##var))((*__ptr) + offset)); \
}))
#undef __get_cpu_var
It seems to work fine, but I'm wondering if a better fix can be found.
Ideas?
-- Pete
next reply other threads:[~2004-06-30 6:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-30 6:35 Pete Zaitcev [this message]
2004-06-30 6:45 ` s390(64) per_cpu in modules (ipv6) William Lee Irwin III
2004-06-30 6:46 ` Roland Dreier
2004-10-15 1:41 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2004-06-30 13:04 Martin Schwidefsky
2004-06-30 16:07 ` Roland Dreier
2004-06-30 20:55 ` Pete Zaitcev
2004-07-01 13:05 ` Arnd Bergmann
[not found] <OFC25D1557.60BFB654-ON42256F2E.00327ABF-42256F2E.0032D239@de.ibm.com>
2004-10-17 2:51 ` Rusty Russell
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=20040629233537.523db68c@lembas.zaitcev.lan \
--to=zaitcev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.