From: Mikko Rapeli <mikko.rapeli@iki.fi> To: Stefano Stabellini <sstabellini@kernel.org> Cc: Russell King - ARM Linux <linux@armlinux.org.uk>, linux-kernel@vger.kernel.org, David Vrabel <david.vrabel@citrix.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Juergen Gross <jgross@suse.com>, xen-devel@lists.xenproject.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace Date: Tue, 23 Aug 2016 23:38:11 +0300 [thread overview] Message-ID: <20160823203811.GO5399@lakka.kapsi.fi> (raw) In-Reply-To: <alpine.DEB.2.10.1608231100400.12392@sstabellini-ThinkPad-X260> On Tue, Aug 23, 2016 at 11:13:52AM -0700, Stefano Stabellini wrote: > On Tue, 23 Aug 2016, Russell King - ARM Linux wrote: > > On Mon, Aug 22, 2016 at 08:33:11PM +0200, Mikko Rapeli wrote: > > > xen/interface/xen.h is not exported from kernel headers so remove the > > > dependency and provide needed defines for domid_t and xen_pfn_t if they > > > are not already defined by some other e.g. Xen specific headers. > > > > I'm confused. How did we end up with a 64-bit PFN number on ARM? It's > > insane - especially as the kernel uses "unsigned long" almost everywhere > > for PFNs - we can't have physical addresses more than 44 bits (32 bit > > pfn + 4k page size). > > That's because xen_pfn_t is the type used to store pfns in structures > passed to Xen via hypercalls. The Xen hypercall ABI is shared between > ARM and ARM64. On x86_32 and x86_64 we have different sizes for pfn > types in the hypercall ABI and it caused quite a bit of trouble in the > past as it is possible to run 32bit domains on a 64bit hypervisor. > Having a common type for pfns on ARM and ARM64 helped a lot in that > respect. > > > > > Suggested by Andrew Cooper <andrew.cooper3@citrix.com> on lkml message > > > <5569F9C9.8000607@citrix.com>. > > > > > > The ifdef for ARM is ugly but did not find better solutions for it. > > > > #ifdef __arm__ > > > > maybe? Even if not, the unsightly parens are not necessary. > > Yes, I think it should be: > > #if defined(__arm__) || defined(__aarch64__) Thanks, I will send a new version with this change. > > diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h > > index 75d5968..6898ee1 100644 > > --- a/arch/arm/include/asm/xen/interface.h > > +++ b/arch/arm/include/asm/xen/interface.h > > @@ -38,7 +38,7 @@ > > * fine since it simply wouldn't be able to create any sure pfns in > > * the first place. > > */ > > -typedef uint64_t xen_pfn_t; > > +typedef __u64 xen_pfn_t; > > #define PRI_xen_pfn "llx" > > typedef uint64_t xen_ulong_t; > > #define PRI_xen_ulong "llx" > > Why this change? I will double check but I think the other fix exposed then the common "<stdint.h> definitions not available in userspace <linux/types.h>" and this was needed to please the compiler. If so, I'll add this to commit message. If you would prefer to include libc's <stdint.h> in userspace, well, join the club. drm and fuse maintainers want the same but my patches with those fixes got rejected in the past. Example: https://lkml.org/lkml/2015/6/1/160 -Mikko
WARNING: multiple messages have this Message-ID (diff)
From: mikko.rapeli@iki.fi (Mikko Rapeli) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace Date: Tue, 23 Aug 2016 23:38:11 +0300 [thread overview] Message-ID: <20160823203811.GO5399@lakka.kapsi.fi> (raw) In-Reply-To: <alpine.DEB.2.10.1608231100400.12392@sstabellini-ThinkPad-X260> On Tue, Aug 23, 2016 at 11:13:52AM -0700, Stefano Stabellini wrote: > On Tue, 23 Aug 2016, Russell King - ARM Linux wrote: > > On Mon, Aug 22, 2016 at 08:33:11PM +0200, Mikko Rapeli wrote: > > > xen/interface/xen.h is not exported from kernel headers so remove the > > > dependency and provide needed defines for domid_t and xen_pfn_t if they > > > are not already defined by some other e.g. Xen specific headers. > > > > I'm confused. How did we end up with a 64-bit PFN number on ARM? It's > > insane - especially as the kernel uses "unsigned long" almost everywhere > > for PFNs - we can't have physical addresses more than 44 bits (32 bit > > pfn + 4k page size). > > That's because xen_pfn_t is the type used to store pfns in structures > passed to Xen via hypercalls. The Xen hypercall ABI is shared between > ARM and ARM64. On x86_32 and x86_64 we have different sizes for pfn > types in the hypercall ABI and it caused quite a bit of trouble in the > past as it is possible to run 32bit domains on a 64bit hypervisor. > Having a common type for pfns on ARM and ARM64 helped a lot in that > respect. > > > > > Suggested by Andrew Cooper <andrew.cooper3@citrix.com> on lkml message > > > <5569F9C9.8000607@citrix.com>. > > > > > > The ifdef for ARM is ugly but did not find better solutions for it. > > > > #ifdef __arm__ > > > > maybe? Even if not, the unsightly parens are not necessary. > > Yes, I think it should be: > > #if defined(__arm__) || defined(__aarch64__) Thanks, I will send a new version with this change. > > diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h > > index 75d5968..6898ee1 100644 > > --- a/arch/arm/include/asm/xen/interface.h > > +++ b/arch/arm/include/asm/xen/interface.h > > @@ -38,7 +38,7 @@ > > * fine since it simply wouldn't be able to create any sure pfns in > > * the first place. > > */ > > -typedef uint64_t xen_pfn_t; > > +typedef __u64 xen_pfn_t; > > #define PRI_xen_pfn "llx" > > typedef uint64_t xen_ulong_t; > > #define PRI_xen_ulong "llx" > > Why this change? I will double check but I think the other fix exposed then the common "<stdint.h> definitions not available in userspace <linux/types.h>" and this was needed to please the compiler. If so, I'll add this to commit message. If you would prefer to include libc's <stdint.h> in userspace, well, join the club. drm and fuse maintainers want the same but my patches with those fixes got rejected in the past. Example: https://lkml.org/lkml/2015/6/1/160 -Mikko
next prev parent reply other threads:[~2016-08-23 20:38 UTC|newest] Thread overview: 171+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-08-22 18:32 [PATCH v05 00/72] Userspace compile test and fixes for exported uapi header files Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 01/72] headers_install.sh: enhance error handling Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 02/72] scripts/headers_compile_test.sh: compile test script for exported headers Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 03/72] headers_compile_test.sh: add GNU libc compatibility test Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 04/72] dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h Mikko Rapeli 2016-08-23 13:57 ` [dm-devel] " Bart Van Assche 2016-08-23 14:28 ` Bart Van Assche 2016-08-23 20:42 ` Mikko Rapeli 2016-08-25 4:24 ` Bart Van Assche 2016-08-25 4:24 ` Bart Van Assche 2016-08-25 6:57 ` [dm-devel] " Mikko Rapeli 2016-08-25 6:57 ` Mikko Rapeli 2016-08-28 6:42 ` [PATCH v06] uapi dm-log-userspace.h: use __u32, __s32, __u64 and __s64 " Mikko Rapeli 2016-08-28 16:07 ` Bart Van Assche 2016-08-22 18:32 ` [PATCH v05 05/72] hsi_char.h: use __u32 " Mikko Rapeli 2016-08-22 20:54 ` Sebastian Reichel 2016-08-22 18:32 ` [PATCH v05 06/72] include/uapi/linux/hsi/cs-protocol.h: include linux/time.h Mikko Rapeli 2016-08-22 20:52 ` Sebastian Reichel 2016-08-23 6:55 ` Mikko Rapeli 2016-08-28 7:00 ` Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 07/72] cld.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 08/72] rds.h: " Mikko Rapeli 2016-08-22 18:52 ` Sowmini Varadhan 2016-08-23 20:46 ` Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 09/72] sctp.h: use __u8 and __u32 " Mikko Rapeli 2016-08-22 18:32 ` Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 10/72] scsi_bsg_fc.h: use __u8, __u32 and __u64 " Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 11/72] scsi_netlink.h: use __u8, __u16 " Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 12/72] scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 13/72] include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 14/72] include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli 2016-08-24 15:36 ` Arnd Bergmann 2016-11-15 19:31 ` Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 15/72] include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 16/72] include/uapi/asm-generic/shmbuf.h: include fixes Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 17/72] asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 18/72] include/uapi/asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 19/72] include/uapi/linux/socket.h: include sys/socket.h in userspace Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 20/72] include/uapi/linux/rds.h: include linux/socket.h and linux/types.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 21/72] include/uapi/linux/if_pppox.h: include linux/if.h Mikko Rapeli 2016-08-22 19:37 ` Stephen Hemminger 2016-08-22 23:26 ` David Miller 2016-08-23 6:41 ` Mikko Rapeli 2016-08-22 23:33 ` David Miller 2016-08-22 18:32 ` [PATCH v05 22/72] include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and linux/in6.h Mikko Rapeli 2016-08-22 23:28 ` David Miller 2016-08-22 18:32 ` [PATCH v05 23/72] include/uapi/linux/ipv6_route.h: include linux/in6.h Mikko Rapeli 2016-08-22 23:28 ` David Miller 2016-08-22 18:32 ` [PATCH v05 24/72] " Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 25/72] include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h Mikko Rapeli 2016-08-22 23:31 ` David Miller 2016-08-22 18:32 ` [PATCH v05 26/72] include/uapi/linux/if_pppox.h: " Mikko Rapeli 2016-08-22 23:31 ` David Miller 2016-08-22 18:32 ` [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h Mikko Rapeli 2016-08-22 23:30 ` David Miller 2016-08-23 7:03 ` Frans Klaver 2016-08-23 7:05 ` David Miller 2016-08-23 8:03 ` Frans Klaver 2016-08-24 6:57 ` Frans Klaver 2016-11-15 19:39 ` Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 28/72] include/uapi/linux/packet_diag.h: include linux/netdevice.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 29/72] include/uapi/linux/llc.h: include linux/if.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 30/72] include/uapi/linux/mqueue.h: include linux/types.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 31/72] include/uapi/linux/mroute.h: include linux/in.h Mikko Rapeli 2016-08-22 23:30 ` David Miller 2016-08-22 18:32 ` [PATCH v05 32/72] include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 33/72] include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 34/72] include/uapi/linux/errqueue.h: include linux/time.h Mikko Rapeli 2016-08-22 21:32 ` kbuild test robot 2016-08-23 7:02 ` Mikko Rapeli 2016-08-22 22:03 ` kbuild test robot 2016-08-22 23:24 ` kbuild test robot 2016-08-22 18:32 ` [PATCH v05 35/72] include/uapi/asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 36/72] arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 37/72] include/uapi/linux/auto_fs.h: include linux/limits.h Mikko Rapeli 2016-08-23 0:42 ` Ian Kent 2016-08-22 18:32 ` [PATCH v05 38/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli 2016-08-22 18:32 ` Mikko Rapeli 2016-08-22 19:39 ` Stephen Hemminger 2016-08-22 23:27 ` David Miller 2016-08-22 23:27 ` David Miller 2016-08-23 6:49 ` Mikko Rapeli 2016-08-23 6:49 ` Mikko Rapeli 2016-08-22 23:31 ` David Miller 2016-08-22 23:31 ` David Miller 2016-08-22 18:32 ` [PATCH v05 39/72] include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and __u64 " Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 40/72] include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:32 ` [PATCH v05 41/72] include/uapi/linux/atm_zatm.h: include linux/time.h Mikko Rapeli 2016-08-22 23:30 ` David Miller 2016-08-22 18:32 ` [PATCH v05 42/72] include/uapi/linux/scc.h: include linux/sockios.h Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 43/72] include/uapi/linux/btrfs.h: define NULL Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 44/72] include/uapi/linux/kexec.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 45/72] include/uapi/linux/reiserfs_xattr.h: " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 46/72] include/uapi/linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 47/72] include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli 2016-08-23 3:08 ` kbuild test robot 2016-08-23 20:53 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 48/72] include/uapi/linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 49/72] arch/x86/include/uapi/asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 50/72] include/uapi/linux/fuse.h: use linux/types.h also in userspace Mikko Rapeli 2016-08-23 7:16 ` Miklos Szeredi 2016-08-23 7:39 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 51/72] include/linux/ipmi-fru.h: use linux/types.h instead of stdint.h Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 52/72] include/linux/sdb.h: use linux/types.h types " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 53/72] include/linux/xz.h: " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 54/72] include/uapi/xen/privcmd.h: fix compilation in userspace Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-23 10:02 ` Russell King - ARM Linux 2016-08-23 10:02 ` Russell King - ARM Linux 2016-08-23 10:02 ` Russell King - ARM Linux 2016-08-23 18:13 ` Stefano Stabellini 2016-08-23 18:13 ` Stefano Stabellini 2016-08-23 20:38 ` Mikko Rapeli 2016-08-23 20:38 ` Mikko Rapeli [this message] 2016-08-23 20:38 ` Mikko Rapeli 2016-08-23 21:06 ` Stefano Stabellini 2016-08-23 21:06 ` Stefano Stabellini 2016-08-23 21:06 ` Stefano Stabellini 2016-08-23 18:13 ` Stefano Stabellini 2016-08-22 18:33 ` [PATCH v05 55/72] include/uapi/xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 56/72] include/uapi/xen/evtchn.h: include xen/privcmd.h Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 57/72] coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 58/72] include/uapi/linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 59/72] include/uapi/linux/errqueue.h: include time.h in userspace Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 60/72] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-24 15:02 ` Arnd Bergmann 2016-08-24 15:02 ` Arnd Bergmann 2016-11-16 14:11 ` Mikko Rapeli 2016-11-16 14:11 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 61/72] include/uapi/rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli [not found] ` <1471890809-4383-62-git-send-email-mikko.rapeli-X3B1VOXEql0@public.gmane.org> 2016-08-23 15:03 ` Doug Ledford 2016-08-23 15:03 ` Doug Ledford 2016-08-25 14:00 ` Moni Shoua 2016-08-22 18:33 ` [PATCH v05 62/72] include/uapi/linux/openvswitch.h: use __u32 from linux/types.h Mikko Rapeli 2016-08-22 23:32 ` David Miller 2016-08-22 23:32 ` David Miller 2016-08-22 18:33 ` [PATCH v05 63/72] include/uapi/sound/Kbuild: remove sound/asoc.h from userspace Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 64/72] include/uapi/linux/ipx.h: fix conflicting defitions with glibc netipx/ipx.h Mikko Rapeli 2016-08-22 23:33 ` David Miller 2016-08-22 18:33 ` [PATCH v05 65/72] uapi fcntl.h: glibc fcntl.h header file compatibility fixes Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h " Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 23:33 ` David Miller 2016-08-23 21:21 ` Mikko Rapeli 2016-08-23 23:38 ` David Miller 2016-08-23 23:36 ` David Miller 2016-08-22 18:33 ` [PATCH v05 67/72] uapi uio.h: glibc sys/uio.h " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h " Mikko Rapeli 2016-08-22 23:33 ` David Miller 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h " Mikko Rapeli 2016-08-22 23:33 ` David Miller 2016-08-26 15:38 ` walter harms 2016-08-28 5:59 ` Mikko Rapeli 2016-08-28 12:37 ` walter harms 2016-08-29 19:34 ` David Ranch 2016-08-30 7:34 ` Mikko Rapeli 2016-11-16 19:07 ` Mikko Rapeli 2016-11-16 22:17 ` David Ranch 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 70/72] uapi time.h: glibc time.h " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 71/72] uapi term*.h: glibc termios.h " Mikko Rapeli 2016-08-22 18:33 ` [PATCH v05 72/72] uapi route.h: glibc net/route.h compat fix Mikko Rapeli 2016-08-22 18:33 ` Mikko Rapeli 2016-08-22 23:32 ` David Miller
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=20160823203811.GO5399@lakka.kapsi.fi \ --to=mikko.rapeli@iki.fi \ --cc=boris.ostrovsky@oracle.com \ --cc=david.vrabel@citrix.com \ --cc=jgross@suse.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.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: linkBe 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.