Skip to contentSkip to conversation

rtdm over x86_64

Xenomai-core Paul 3 participants 6 messages Feb 3, 2007

lore
Share & tools
lore

Paul

author
#0 lore raw

Hi Jan

Just a small patch to get the ball rolling with an x86_64 support..

The attached resolves a compile time warning of:

kernel/xenomai/skins/rtdm/core.c: In function ‘_rtdm_ioctl’:
kernel/xenomai/skins/rtdm/core.c:408: warning: comparison is always false due to limited range of data type

Regards, Paul.

rtdm/rtdm.h +1 -1
Index: include/rtdm/rtdm.h
===================================================================
@@ -248,7 +248,7 @@ int     _rtdm_open   (rtdm_user_info_t *
 int     _rtdm_socket (rtdm_user_info_t *user_info, int protocol_family,
                       int socket_type, int protocol);
 int     _rtdm_close  (rtdm_user_info_t *user_info, int fd, int forced);
-int     _rtdm_ioctl  (rtdm_user_info_t *user_info, int fd, int request, ...);
+int     _rtdm_ioctl  (rtdm_user_info_t *user_info, int fd, unsigned int request, ...);
 ssize_t _rtdm_read   (rtdm_user_info_t *user_info, int fd, void *buf,
                       size_t nbyte);
 ssize_t _rtdm_write  (rtdm_user_info_t *user_info, int fd, const void *buf,
skins/rtdm/core.c +1 -1
Index: ksrc/skins/rtdm/core.c
===================================================================
@@ -393,7 +393,7 @@ do {                                    
 } while (0)
 
 
-int _rtdm_ioctl(rtdm_user_info_t *user_info, int fd, int request, ...)
+int _rtdm_ioctl(rtdm_user_info_t *user_info, int fd, unsigned int request, ...)
 {
     va_list args;
     void    *arg;
#1 lore raw
Quoted 10 lines · Paul

Hi Jan

Just a small patch to get the ball rolling with an x86_64 support..

The attached resolves a compile time warning of:

kernel/xenomai/skins/rtdm/core.c: In function ‘_rtdm_ioctl’:
kernel/xenomai/skins/rtdm/core.c:408: warning: comparison is always false due to limited range of data type

Yeah, when looking at this issue with 64-bit glasses, this urgently needs fixing (I wonder why ia64 didn't stumble yet?).

Your patch points in the right direction, but it needs a bit fine-tuning and also has to include the ioctl handlers of drivers. I will work out a fix and inform you. I'll have to rely on your test lab. :)

But first I need some build environment. A quick shot ended here when trying to configure a patch and prepared 2.6.19 kernel:

# make ARCH=x86_64 CC="gcc -m64" oldconfig
...
init/Kconfig:572: can't open file "arch/x86_64/xenomai/Kconfig"

Anyone any idea? Is something missing, or is the prepare script broken?

Jan

PS: Once we have in-tree RTDM services and drivers running, are you interested in a RTnet excursion over x64? I should be able to make this compile, but for testing...

#2 lore raw
Quoted 8 lines · Jan Kiszka

But first I need some build environment. A quick shot ended here when trying to configure a patch and prepared 2.6.19 kernel:

# make ARCH=x86_64 CC="gcc -m64" oldconfig
...
init/Kconfig:572: can't open file "arch/x86_64/xenomai/Kconfig"

Anyone any idea? Is something missing, or is the prepare script broken?

Obviously a missing commit. Philippe?

#3 lore raw
In reply to Jan Kiszka
Quoted 8 lines · Jan Kiszka

But first I need some build environment. A quick shot ended here when trying to configure a patch and prepared 2.6.19 kernel:

# make ARCH=x86_64 CC="gcc -m64" oldconfig
...
init/Kconfig:572: can't open file "arch/x86_64/xenomai/Kconfig"

Anyone any idea? Is something missing, or is the prepare script broken?

It's a bit early for building the x86_64 stack; you may want to fix the compilation issues over ppc64 or ia64. I'm working on the missing x86_64 bits (task switching and a few other details) before even starting to fix the build issues.

Signature · 1 line
Philippe.
#4 lore raw
Quoted 9 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka

But first I need some build environment. A quick shot ended here when trying to configure a patch and prepared 2.6.19 kernel:

# make ARCH=x86_64 CC="gcc -m64" oldconfig
...
init/Kconfig:572: can't open file "arch/x86_64/xenomai/Kconfig"
Quoted 7 lines
Quoted 1 line

Anyone any idea? Is something missing, or is the prepare script broken?

It's a bit early for building the x86_64 stack; you may want to fix the compilation issues over ppc64 or ia64. I'm working on the missing x86_64 bits (task switching and a few other details) before even starting to fix the build issues.

OK, I'm just lacking cross-compilers for other 64-bit archs.

Anyway, here is a first patch for the signedness/width issue of RTDM IOCTLs. It unfortunately slightly breaks the driver API, but it looks like it's required for 64-bit support (no IOCTL based on _IOR or _IOWR should be accepted ATM).

Whoever has a full 64-bit environment is welcome to build and run this (e.g. using xeno_timerbench). Feedback welcome. Will then commit this chunk. Meanwhile I'm going to meditate about what to do /wrt 2.3...

Jan

rtdm/rtdm_driver.h +1 -1
Index: include/rtdm/rtdm_driver.h
===================================================================
@@ -198,7 +198,7 @@ typedef
 typedef
     int     (*rtdm_ioctl_handler_t)  (struct rtdm_dev_context   *context,
                                       rtdm_user_info_t          *user_info,
-                                      int                       request,
+                                      unsigned int              request,
                                       void                      *arg);
 
 /**
skins/rtdm/core.c +2 -2
Index: ksrc/skins/rtdm/core.c
===================================================================
@@ -403,9 +403,9 @@ int _rtdm_ioctl(rtdm_user_info_t *user_i
     arg = va_arg(args, void *);
     va_end(args);
 
-    MAJOR_FUNCTION_WRAPPER_TH(ioctl, request, arg);
+    MAJOR_FUNCTION_WRAPPER_TH(ioctl, (unsigned int)request, arg);
 
-    if (unlikely(ret < 0) && request == RTIOC_DEVICE_INFO) {
+    if (unlikely(ret < 0) && (unsigned int)request == RTIOC_DEVICE_INFO) {
         struct rtdm_device *dev = context->device;
         struct rtdm_device_info dev_info;
 
drivers/serial/16550A.c +2 -1
Index: ksrc/drivers/serial/16550A.c
===================================================================
@@ -550,7 +550,8 @@ int rt_16550_close(struct rtdm_dev_conte
 
 
 int rt_16550_ioctl(struct rtdm_dev_context *context,
-                   rtdm_user_info_t *user_info, int request, void *arg)
+                   rtdm_user_info_t *user_info,
+                   unsigned int request, void *arg)
 {
     struct rt_16550_context *ctx;
     int                     err = 0;
drivers/can/rtcan_raw.c +2 -1
Index: ksrc/drivers/can/rtcan_raw.c
===================================================================
@@ -412,7 +412,8 @@ static int rtcan_raw_setsockopt(struct r
 
 
 int rtcan_raw_ioctl(struct rtdm_dev_context *context,
-		    rtdm_user_info_t *user_info, int request, void *arg)
+		    rtdm_user_info_t *user_info,
+		    unsigned int request, void *arg)
 {
     int ret = 0;
 
drivers/testing/timerbench.c +4 -2
Index: ksrc/drivers/testing/timerbench.c
===================================================================
@@ -234,7 +234,8 @@ int rt_tmbench_close(struct rtdm_dev_con
 
 
 int rt_tmbench_ioctl_nrt(struct rtdm_dev_context *context,
-                         rtdm_user_info_t *user_info, int request, void *arg)
+                         rtdm_user_info_t *user_info,
+                         unsigned int request, void *arg)
 {
     struct rt_tmbench_context   *ctx;
     int                         err = 0;
@@ -413,7 +414,8 @@ int rt_tmbench_ioctl_nrt(struct rtdm_dev
 
 
 int rt_tmbench_ioctl_rt(struct rtdm_dev_context *context,
-                        rtdm_user_info_t *user_info, int request, void *arg)
+                        rtdm_user_info_t *user_info,
+                        unsigned int request, void *arg)
 {
     struct rt_tmbench_context   *ctx;
     int                         err = 0;
drivers/testing/switchtest.c +2 -2
Index: ksrc/drivers/testing/switchtest.c
===================================================================
@@ -389,7 +389,7 @@ static int rtswitch_close(struct rtdm_de
 
 static int rtswitch_ioctl_nrt(struct rtdm_dev_context *context,
                               rtdm_user_info_t *user_info,
-                              int request,
+                              unsigned int request,
                               void *arg)
 {
 	rtswitch_context_t *ctx = (rtswitch_context_t *) context->dev_private;
@@ -492,7 +492,7 @@ static int rtswitch_ioctl_nrt(struct rtd
 
 static int rtswitch_ioctl_rt(struct rtdm_dev_context *context,
                              rtdm_user_info_t *user_info,
-                             int request,
+                             unsigned int request,
                              void *arg)
 {
 	rtswitch_context_t *ctx = (rtswitch_context_t *) context->dev_private;
drivers/testing/irqbench.c +4 -4
Index: ksrc/drivers/testing/irqbench.c
===================================================================
@@ -237,8 +237,8 @@ static int rt_irqbench_close(struct rtdm
 }
 
 static int rt_irqbench_ioctl_nrt(struct rtdm_dev_context *context,
-				 rtdm_user_info_t *user_info, int request,
-				 void *arg)
+				 rtdm_user_info_t *user_info,
+				 unsigned int request, void *arg)
 {
 	struct rt_irqbench_context *ctx;
 	struct rttst_irqbench_config config_buf;
@@ -435,8 +435,8 @@ static int rt_irqbench_ioctl_nrt(struct 
 }
 
 static int rt_irqbench_ioctl_rt(struct rtdm_dev_context *context,
-				rtdm_user_info_t *user_info, int request,
-				void *arg)
+				rtdm_user_info_t *user_info,
+				unsigned int request, void *arg)
 {
 	struct rt_irqbench_context *ctx;
 	int err = 0;
author
#5 lore raw
In reply to Jan Kiszka
Quoted 2 lines · Jan Kiszka

Yeah, when looking at this issue with 64-bit glasses, this urgently needs fixing (I wonder why ia64 didn't stumble yet?).

Perhaps different compiler and/or warning flags ?
Using gcc-4.1 at the moment..

Quoted 3 lines

init/Kconfig:572: can't open file "arch/x86_64/xenomai/Kconfig"

Anyone any idea? Is something missing, or is the prepare script broken?

I must admit, saw the first of the commits announced on
http://cia.navi.cx/stats/project/xenomai and butchered a tree to see what else was needed.. I'll wait for Philippe to finish his commits before preempting him again.

Quoted 3 lines

PS: Once we have in-tree RTDM services and drivers running, are you interested in a RTnet excursion over x64? I should be able to make this compile, but for testing...

RTnet across a local net and/or a machine in your lab via the internet - Could be fun :)
If you have some ready to run code, I can set aside an afternoon to run some
tests - Perhaps even set up an ssh session so that you can monitor the results.

Regards, Paul.