Re: [Qemu-devel] [PATCH v10 01/10] userfault: update kernel header for UFFD_FEATURE_*

2017-09-21 Thread Alexey Perevalov

On 09/20/2017 09:43 PM, Dr. David Alan Gilbert wrote:

* Alexey Perevalov (a.pereva...@samsung.com) wrote:

This commit adds modification for UFFD_FEATURE_SIGBUS and
UFFD_FEATURE_THREAD_ID.

Signed-off-by: Alexey Perevalov 

This should be replaced with just running the
scripts/update-linux-headers.sh
against a 4.14-rc1 checkout.

That can be done as a separate patch or the first patch
of this series.

Ok, in case of separate patch it's reasonably to
send modification for all headers.


--
Best regards,
Alexey Perevalov



Dave


---
  linux-headers/linux/userfaultfd.h | 16 +++-
  1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/linux-headers/linux/userfaultfd.h 
b/linux-headers/linux/userfaultfd.h
index 9701772..b43cf0d 100644
--- a/linux-headers/linux/userfaultfd.h
+++ b/linux-headers/linux/userfaultfd.h
@@ -23,7 +23,9 @@
   UFFD_FEATURE_EVENT_REMOVE |  \
   UFFD_FEATURE_EVENT_UNMAP |   \
   UFFD_FEATURE_MISSING_HUGETLBFS | \
-  UFFD_FEATURE_MISSING_SHMEM)
+  UFFD_FEATURE_MISSING_SHMEM | \
+  UFFD_FEATURE_SIGBUS |\
+  UFFD_FEATURE_THREAD_ID)
  #define UFFD_API_IOCTLS   \
((__u64)1 << _UFFDIO_REGISTER |   \
 (__u64)1 << _UFFDIO_UNREGISTER | \
@@ -78,6 +80,9 @@ struct uffd_msg {
struct {
__u64   flags;
__u64   address;
+   union {
+   __u32 ptid;
+   } feat;
} pagefault;
  
  		struct {

@@ -153,6 +158,13 @@ struct uffdio_api {
 * UFFD_FEATURE_MISSING_SHMEM works the same as
 * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem
 * (i.e. tmpfs and other shmem based APIs).
+*
+* UFFD_FEATURE_SIGBUS feature means no page-fault
+* (UFFD_EVENT_PAGEFAULT) event will be delivered, instead
+* a SIGBUS signal will be sent to the faulting process.
+*
+* UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will
+* be returned, if feature is not requested 0 will be returned.
 */
  #define UFFD_FEATURE_PAGEFAULT_FLAG_WP(1<<0)
  #define UFFD_FEATURE_EVENT_FORK   (1<<1)
@@ -161,6 +173,8 @@ struct uffdio_api {
  #define UFFD_FEATURE_MISSING_HUGETLBFS(1<<4)
  #define UFFD_FEATURE_MISSING_SHMEM(1<<5)
  #define UFFD_FEATURE_EVENT_UNMAP  (1<<6)
+#define UFFD_FEATURE_SIGBUS(1<<7)
+#define UFFD_FEATURE_THREAD_ID (1<<8)
__u64 features;
  
  	__u64 ioctls;

--
1.9.1


--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK







Re: [Qemu-devel] [PATCH v10 01/10] userfault: update kernel header for UFFD_FEATURE_*

2017-09-20 Thread Dr. David Alan Gilbert
* Alexey Perevalov (a.pereva...@samsung.com) wrote:
> This commit adds modification for UFFD_FEATURE_SIGBUS and
> UFFD_FEATURE_THREAD_ID.
> 
> Signed-off-by: Alexey Perevalov 

This should be replaced with just running the 
   scripts/update-linux-headers.sh
against a 4.14-rc1 checkout.

That can be done as a separate patch or the first patch
of this series.

Dave

> ---
>  linux-headers/linux/userfaultfd.h | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-headers/linux/userfaultfd.h 
> b/linux-headers/linux/userfaultfd.h
> index 9701772..b43cf0d 100644
> --- a/linux-headers/linux/userfaultfd.h
> +++ b/linux-headers/linux/userfaultfd.h
> @@ -23,7 +23,9 @@
>  UFFD_FEATURE_EVENT_REMOVE |  \
>  UFFD_FEATURE_EVENT_UNMAP |   \
>  UFFD_FEATURE_MISSING_HUGETLBFS | \
> -UFFD_FEATURE_MISSING_SHMEM)
> +UFFD_FEATURE_MISSING_SHMEM | \
> +UFFD_FEATURE_SIGBUS |\
> +UFFD_FEATURE_THREAD_ID)
>  #define UFFD_API_IOCTLS  \
>   ((__u64)1 << _UFFDIO_REGISTER | \
>(__u64)1 << _UFFDIO_UNREGISTER |   \
> @@ -78,6 +80,9 @@ struct uffd_msg {
>   struct {
>   __u64   flags;
>   __u64   address;
> + union {
> + __u32 ptid;
> + } feat;
>   } pagefault;
>  
>   struct {
> @@ -153,6 +158,13 @@ struct uffdio_api {
>* UFFD_FEATURE_MISSING_SHMEM works the same as
>* UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem
>* (i.e. tmpfs and other shmem based APIs).
> +  *
> +  * UFFD_FEATURE_SIGBUS feature means no page-fault
> +  * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead
> +  * a SIGBUS signal will be sent to the faulting process.
> +  *
> +  * UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will
> +  * be returned, if feature is not requested 0 will be returned.
>*/
>  #define UFFD_FEATURE_PAGEFAULT_FLAG_WP   (1<<0)
>  #define UFFD_FEATURE_EVENT_FORK  (1<<1)
> @@ -161,6 +173,8 @@ struct uffdio_api {
>  #define UFFD_FEATURE_MISSING_HUGETLBFS   (1<<4)
>  #define UFFD_FEATURE_MISSING_SHMEM   (1<<5)
>  #define UFFD_FEATURE_EVENT_UNMAP (1<<6)
> +#define UFFD_FEATURE_SIGBUS  (1<<7)
> +#define UFFD_FEATURE_THREAD_ID   (1<<8)
>   __u64 features;
>  
>   __u64 ioctls;
> -- 
> 1.9.1
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



[Qemu-devel] [PATCH v10 01/10] userfault: update kernel header for UFFD_FEATURE_*

2017-09-19 Thread Alexey Perevalov
This commit adds modification for UFFD_FEATURE_SIGBUS and
UFFD_FEATURE_THREAD_ID.

Signed-off-by: Alexey Perevalov 
---
 linux-headers/linux/userfaultfd.h | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/linux-headers/linux/userfaultfd.h 
b/linux-headers/linux/userfaultfd.h
index 9701772..b43cf0d 100644
--- a/linux-headers/linux/userfaultfd.h
+++ b/linux-headers/linux/userfaultfd.h
@@ -23,7 +23,9 @@
   UFFD_FEATURE_EVENT_REMOVE |  \
   UFFD_FEATURE_EVENT_UNMAP |   \
   UFFD_FEATURE_MISSING_HUGETLBFS | \
-  UFFD_FEATURE_MISSING_SHMEM)
+  UFFD_FEATURE_MISSING_SHMEM | \
+  UFFD_FEATURE_SIGBUS |\
+  UFFD_FEATURE_THREAD_ID)
 #define UFFD_API_IOCTLS\
((__u64)1 << _UFFDIO_REGISTER | \
 (__u64)1 << _UFFDIO_UNREGISTER |   \
@@ -78,6 +80,9 @@ struct uffd_msg {
struct {
__u64   flags;
__u64   address;
+   union {
+   __u32 ptid;
+   } feat;
} pagefault;
 
struct {
@@ -153,6 +158,13 @@ struct uffdio_api {
 * UFFD_FEATURE_MISSING_SHMEM works the same as
 * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem
 * (i.e. tmpfs and other shmem based APIs).
+*
+* UFFD_FEATURE_SIGBUS feature means no page-fault
+* (UFFD_EVENT_PAGEFAULT) event will be delivered, instead
+* a SIGBUS signal will be sent to the faulting process.
+*
+* UFFD_FEATURE_THREAD_ID pid of the page faulted task_struct will
+* be returned, if feature is not requested 0 will be returned.
 */
 #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
 #define UFFD_FEATURE_EVENT_FORK(1<<1)
@@ -161,6 +173,8 @@ struct uffdio_api {
 #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
 #define UFFD_FEATURE_MISSING_SHMEM (1<<5)
 #define UFFD_FEATURE_EVENT_UNMAP   (1<<6)
+#define UFFD_FEATURE_SIGBUS(1<<7)
+#define UFFD_FEATURE_THREAD_ID (1<<8)
__u64 features;
 
__u64 ioctls;
-- 
1.9.1