linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kcov: fix struct layout for kcov_remote_arg
@ 2019-12-06 13:31 Andrey Konovalov
  2019-12-06 13:45 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Konovalov @ 2019-12-06 13:31 UTC (permalink / raw)
  To: linux-usb, linux-kernel, Greg Kroah-Hartman, Alan Stern
  Cc: Felipe Balbi, Chunfeng Yun, Jacky . Cao @ sony . com,
	Dmitry Vyukov, Alexander Potapenko, Marco Elver,
	Andrey Konovalov

Make the layout of kcov_remote_arg the same for 32-bit and 64-bit code.
This makes it more convenient to write userspace apps that can be compiled
into 32-bit or 64-bit binaries and still work with the same 64-bit kernel.
Also use proper __u32 types in uapi headers instead of unsigned ints.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---

Changes v1->v2:
- Use __aligned_u64 instead of adding a __u32 reserved field.

 Documentation/dev-tools/kcov.rst | 10 +++++-----
 include/uapi/linux/kcov.h        | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kcov.rst
index 36890b026e77..1c4e1825d769 100644
--- a/Documentation/dev-tools/kcov.rst
+++ b/Documentation/dev-tools/kcov.rst
@@ -251,11 +251,11 @@ selectively from different subsystems.
 .. code-block:: c
 
     struct kcov_remote_arg {
-	unsigned	trace_mode;
-	unsigned	area_size;
-	unsigned	num_handles;
-	uint64_t	common_handle;
-	uint64_t	handles[0];
+	__u32		trace_mode;
+	__u32		area_size;
+	__u32		num_handles;
+	__aligned_u64	common_handle;
+	__aligned_u64	handles[0];
     };
 
     #define KCOV_INIT_TRACE			_IOR('c', 1, unsigned long)
diff --git a/include/uapi/linux/kcov.h b/include/uapi/linux/kcov.h
index 409d3ad1e6e2..1d0350e44ae3 100644
--- a/include/uapi/linux/kcov.h
+++ b/include/uapi/linux/kcov.h
@@ -9,11 +9,11 @@
  * and the comment before kcov_remote_start() for usage details.
  */
 struct kcov_remote_arg {
-	unsigned int	trace_mode;	/* KCOV_TRACE_PC or KCOV_TRACE_CMP */
-	unsigned int	area_size;	/* Length of coverage buffer in words */
-	unsigned int	num_handles;	/* Size of handles array */
-	__u64		common_handle;
-	__u64		handles[0];
+	__u32		trace_mode;	/* KCOV_TRACE_PC or KCOV_TRACE_CMP */
+	__u32		area_size;	/* Length of coverage buffer in words */
+	__u32		num_handles;	/* Size of handles array */
+	__aligned_u64	common_handle;
+	__aligned_u64	handles[0];
 };
 
 #define KCOV_REMOTE_MAX_HANDLES		0x100
-- 
2.24.0.393.g34dc348eaf-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] kcov: fix struct layout for kcov_remote_arg
  2019-12-06 13:31 [PATCH v2] kcov: fix struct layout for kcov_remote_arg Andrey Konovalov
@ 2019-12-06 13:45 ` Marco Elver
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2019-12-06 13:45 UTC (permalink / raw)
  To: Andrey Konovalov
  Cc: linux-usb, LKML, Greg Kroah-Hartman, Alan Stern, Felipe Balbi,
	Chunfeng Yun, Jacky . Cao @ sony . com, Dmitry Vyukov,
	Alexander Potapenko

On Fri, 6 Dec 2019 at 14:31, Andrey Konovalov <andreyknvl@google.com> wrote:
>
> Make the layout of kcov_remote_arg the same for 32-bit and 64-bit code.
> This makes it more convenient to write userspace apps that can be compiled
> into 32-bit or 64-bit binaries and still work with the same 64-bit kernel.
> Also use proper __u32 types in uapi headers instead of unsigned ints.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>

Acked-by: Marco Elver <elver@google.com>

Thanks!

> ---
>
> Changes v1->v2:
> - Use __aligned_u64 instead of adding a __u32 reserved field.
>
>  Documentation/dev-tools/kcov.rst | 10 +++++-----
>  include/uapi/linux/kcov.h        | 10 +++++-----
>  2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kcov.rst
> index 36890b026e77..1c4e1825d769 100644
> --- a/Documentation/dev-tools/kcov.rst
> +++ b/Documentation/dev-tools/kcov.rst
> @@ -251,11 +251,11 @@ selectively from different subsystems.
>  .. code-block:: c
>
>      struct kcov_remote_arg {
> -       unsigned        trace_mode;
> -       unsigned        area_size;
> -       unsigned        num_handles;
> -       uint64_t        common_handle;
> -       uint64_t        handles[0];
> +       __u32           trace_mode;
> +       __u32           area_size;
> +       __u32           num_handles;
> +       __aligned_u64   common_handle;
> +       __aligned_u64   handles[0];
>      };
>
>      #define KCOV_INIT_TRACE                    _IOR('c', 1, unsigned long)
> diff --git a/include/uapi/linux/kcov.h b/include/uapi/linux/kcov.h
> index 409d3ad1e6e2..1d0350e44ae3 100644
> --- a/include/uapi/linux/kcov.h
> +++ b/include/uapi/linux/kcov.h
> @@ -9,11 +9,11 @@
>   * and the comment before kcov_remote_start() for usage details.
>   */
>  struct kcov_remote_arg {
> -       unsigned int    trace_mode;     /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
> -       unsigned int    area_size;      /* Length of coverage buffer in words */
> -       unsigned int    num_handles;    /* Size of handles array */
> -       __u64           common_handle;
> -       __u64           handles[0];
> +       __u32           trace_mode;     /* KCOV_TRACE_PC or KCOV_TRACE_CMP */
> +       __u32           area_size;      /* Length of coverage buffer in words */
> +       __u32           num_handles;    /* Size of handles array */
> +       __aligned_u64   common_handle;
> +       __aligned_u64   handles[0];
>  };
>
>  #define KCOV_REMOTE_MAX_HANDLES                0x100
> --
> 2.24.0.393.g34dc348eaf-goog
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-06 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 13:31 [PATCH v2] kcov: fix struct layout for kcov_remote_arg Andrey Konovalov
2019-12-06 13:45 ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).