Re: iscsi-tools in a 32bit userland running 64bit kernel

2017-02-10 Thread Matthias Lay

Hi Chris,

thx for your time and giving this detailed descriptions.

just tested your patch and it works fine for me with a 4.4.x 64bit
kernel.


f.y.i. debuglog



iscsid: in nlpayload_read
iscsid: in nlpayload_read
iscsid: created new iSCSI session sid 2 host no 7
iscsid: in kcreate_conn
iscsid: in __kipc_call
iscsid: in kwritev
iscsid: in nlpayload_read
iscsid: in nlpayload_read
iscsid: created new iSCSI connection 2:0
iscsid: in kbind_conn
iscsid: in __kipc_call
iscsid: in kwritev
iscsid: in nlpayload_read
iscsid: in nlpayload_read
iscsid: bound iSCSI connection 2:0 to session 2

**



On Thu, 9 Feb 2017 11:44:51 -0500 (EST)
Chris Leech  wrote:

> I'm curious as to what would prevent you from running a 64-bit iscsid
> in this case, but that's OK.


You are totally right this would be the best and safest solution. I will
do this in the future, but the complete switch from 32 to 64 depends on
other stuff like changing to another buildsystem and stuff like that,
that needs to be done first. 
So I have to find a "in-between-solution". 



Greetz Matze

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


Re: iscsi-tools in a 32bit userland running 64bit kernel

2017-02-09 Thread Chris Leech
I'm curious as to what would prevent you from running a 64-bit iscsid in this 
case, but that's OK.

The real fix, without breaking backwards compatibility, is going to need to be 
a kernel patch to use the 32-bit layout when talking to a compat process.  It's 
not as straightforward with netlink as ioctls, but I think it's doable if 
needed.  There are other kernel features that punt on 32/64 compat, like IP 
XFRM, and we should at least fail sanely if it's not going to be supported.

The other option, breaking the interface, is to fix the alignment in the 32-bit 
tools to match the 64-bit kernel.  This test patch should work if you define 
BUILD_32_64.  I've checked the resulting layout of everything in iscsi_if.h.  
That will build 32-bit binaries that only work on a 64-bit kernel.

-Chris

---

diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 9d15811..758dc0a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -37,6 +37,13 @@
 #define KEVENT_BASE100
 #define ISCSI_ERR_BASE 1000
 
+/* internal allignment hack to build a 32-bit binary to run a on 64-bit kernel 
*/
+#ifdef BUILD_32_64
+   #define __32_64_fix(x) __attribute__((aligned (x)))
+#else
+   #define __32_64_fix(x)
+#endif
+
 enum iscsi_uevent_e {
ISCSI_UEVENT_UNKNOWN= 0,
 
@@ -254,8 +261,7 @@ struct iscsi_uevent {
struct msg_get_host_stats {
uint32_thost_no;
} get_host_stats;
-
-   } u;
+   } __32_64_fix(sizeof(uint64_t)) u;
union {
/* messages k -> u */
int retcode;
@@ -315,7 +321,7 @@ struct iscsi_uevent {
struct msg_new_flashnode_ret {
uint32_tflashnode_idx;
} new_flashnode_ret;
-   } r;
+   } __32_64_fix(sizeof(uint64_t)) r;
 } __attribute__ ((aligned (sizeof(uint64_t;
 
 enum iscsi_param_type {

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 9d15811..758dc0a 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -37,6 +37,13 @@
 #define KEVENT_BASE			100
 #define ISCSI_ERR_BASE			1000
 
+/* internal allignment hack to build a 32-bit binary to run a on 64-bit kernel */
+#ifdef BUILD_32_64
+	#define __32_64_fix(x) __attribute__((aligned (x)))
+#else
+	#define __32_64_fix(x)
+#endif
+
 enum iscsi_uevent_e {
 	ISCSI_UEVENT_UNKNOWN		= 0,
 
@@ -254,8 +261,7 @@ struct iscsi_uevent {
 		struct msg_get_host_stats {
 			uint32_t	host_no;
 		} get_host_stats;
-
-	} u;
+	} __32_64_fix(sizeof(uint64_t)) u;
 	union {
 		/* messages k -> u */
 		int			retcode;
@@ -315,7 +321,7 @@ struct iscsi_uevent {
 		struct msg_new_flashnode_ret {
 			uint32_t	flashnode_idx;
 		} new_flashnode_ret;
-	} r;
+	} __32_64_fix(sizeof(uint64_t)) r;
 } __attribute__ ((aligned (sizeof(uint64_t;
 
 enum iscsi_param_type {


Re: iscsi-tools in a 32bit userland running 64bit kernel

2017-02-09 Thread Matthias Lay


Hi Chris,

thx for the fast reply


> Hi, unfortunately it doesn't look like this is going to work with any
> easy fix.

thx for the info.

Doesnt sound like there is a fix approaching in the next time, so I
think I will have to stick with the 32bit kernel and have to change the
VMSPLIT to 2/2 as I encounter massive IO Perfomance Issues with a big
amount of RAM.



> 
> It looks to me like the netlink message protocol between iscsid and
> the kernel isn't actually functional for this :(
> 
> The struct iscsi_uevent differs in size between 32 and 64 bit
> architectures due to internal padding for alignment.  It's so close
> to being safe that it's pretty frustrating to find this.  The
> iscsi_uevent.u union is padded out from 20 to 24 bytes, shifting the
> kernel response (iscsi_uevent.r) by 4 bytes.

what do you think would be the best solution to fix this? maybe I can
help out. 
I already have a test system up and running ;)


Greetz loomy

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


Re: iscsi-tools in a 32bit userland running 64bit kernel

2017-02-08 Thread Chris Leech

Hi, unfortunately it doesn't look like this is going to work with any easy fix.

It looks to me like the netlink message protocol between iscsid and the kernel 
isn't actually functional for this :(

The struct iscsi_uevent differs in size between 32 and 64 bit architectures due 
to internal padding for alignment.  It's so close to being safe that it's 
pretty frustrating to find this.  The iscsi_uevent.u union is padded out from 
20 to 24 bytes, shifting the kernel response (iscsi_uevent.r) by 4 bytes.

- Chris

- Original Message -
> 
> Hi guys,
> 
> I am trying to use open-iscsi as a 32bit build on a running 64bit
> kernel with 32bit emulation. just the kernel is 64bit everything else
> is 32bit.
> 
> Worked fine with a PAE kernel but thats what I want to get rid of.
> 
> 
> I found this on google groups
> https://groups.google.com/forum/#!topic/open-iscsi/ivprFF9hklY
> 
> I get the same error
> iscsid: Received iferror -22: Invalid argument
> 
> => no login possible just discovery
> 
> 
> is there a solution to use the iscsi tools in the mentioned setup?
> 
> Greetz loomy
> 
> --
> You received this message because you are subscribed to the Google Groups
> "open-iscsi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to open-iscsi+unsubscr...@googlegroups.com.
> To post to this group, send email to open-iscsi@googlegroups.com.
> Visit this group at https://groups.google.com/group/open-iscsi.
> For more options, visit https://groups.google.com/d/optout.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.