[PATCH v6 7/7] dm: support asyncio in ioeventfd


Conghui Chen
 

Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO
request will be processed in asyncio path by kernel and hypervisor.

Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio.c | 4 +++-
devicemodel/include/public/hsm_ioctl_defs.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/devicemodel/hw/pci/virtio/virtio.c b/devicemodel/hw/pci/virtio/virtio.c
index 546ec6f31..e289a880b 100644
--- a/devicemodel/hw/pci/virtio/virtio.c
+++ b/devicemodel/hw/pci/virtio/virtio.c
@@ -2000,7 +2000,9 @@ int virtio_register_ioeventfd(struct virtio_base *base, int idx, bool is_registe

if (!is_register)
ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN;
-
+ else
+ /* enable asyncio by default */
+ ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO;
/* register ioeventfd for kick */
if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) {
/*
diff --git a/devicemodel/include/public/hsm_ioctl_defs.h b/devicemodel/include/public/hsm_ioctl_defs.h
index 56b3b7ed7..be99b5bf7 100644
--- a/devicemodel/include/public/hsm_ioctl_defs.h
+++ b/devicemodel/include/public/hsm_ioctl_defs.h
@@ -226,6 +226,7 @@ struct acrn_ioeventfd {
#define ACRN_IOEVENTFD_FLAG_PIO 0x01
#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
+#define ACRN_IOEVENTFD_FLAG_ASYNCIO 0x08
/** file descriptor of the eventfd of this ioeventfd */
int32_t fd;
/** flag for ioeventfd ioctl */
--
2.25.1


Yu Wang
 

On Fri, Sep 23, 2022 at 09:54:55AM +0800, Conghui Chen wrote:
Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO
request will be processed in asyncio path by kernel and hypervisor.

Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio.c | 4 +++-
devicemodel/include/public/hsm_ioctl_defs.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/devicemodel/hw/pci/virtio/virtio.c b/devicemodel/hw/pci/virtio/virtio.c
index 546ec6f31..e289a880b 100644
--- a/devicemodel/hw/pci/virtio/virtio.c
+++ b/devicemodel/hw/pci/virtio/virtio.c
@@ -2000,7 +2000,9 @@ int virtio_register_ioeventfd(struct virtio_base *base, int idx, bool is_registe

if (!is_register)
ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN;
-
+ else
+ /* enable asyncio by default */
+ ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO;
There's a concern. If the asynio kernel hasn't merged, then the upstream
kernel can not work with the new acrn-dm, right?...

/* register ioeventfd for kick */
if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) {
/*
diff --git a/devicemodel/include/public/hsm_ioctl_defs.h b/devicemodel/include/public/hsm_ioctl_defs.h
index 56b3b7ed7..be99b5bf7 100644
--- a/devicemodel/include/public/hsm_ioctl_defs.h
+++ b/devicemodel/include/public/hsm_ioctl_defs.h
@@ -226,6 +226,7 @@ struct acrn_ioeventfd {
#define ACRN_IOEVENTFD_FLAG_PIO 0x01
#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
+#define ACRN_IOEVENTFD_FLAG_ASYNCIO 0x08
/** file descriptor of the eventfd of this ioeventfd */
int32_t fd;
/** flag for ioeventfd ioctl */
--
2.25.1






Conghui Chen
 

Hi Yu,

-----Original Message-----
From: Wang, Yu1 <yu1.wang@...>
Sent: Friday, September 23, 2022 12:07 PM
To: acrn-dev@...
Cc: Chen, Conghui <conghui.chen@...>
Subject: Re: [acrn-dev] [PATCH v6 7/7] dm: support asyncio in ioeventfd

On Fri, Sep 23, 2022 at 09:54:55AM +0800, Conghui Chen wrote:
Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO
request will be processed in asyncio path by kernel and hypervisor.

Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio.c | 4 +++-
devicemodel/include/public/hsm_ioctl_defs.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/devicemodel/hw/pci/virtio/virtio.c
b/devicemodel/hw/pci/virtio/virtio.c
index 546ec6f31..e289a880b 100644
--- a/devicemodel/hw/pci/virtio/virtio.c
+++ b/devicemodel/hw/pci/virtio/virtio.c
@@ -2000,7 +2000,9 @@ int virtio_register_ioeventfd(struct virtio_base
*base, int idx, bool is_registe

if (!is_register)
ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN;
-
+ else
+ /* enable asyncio by default */
+ ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO;
There's a concern. If the asynio kernel hasn't merged, then the upstream
kernel can not work with the new acrn-dm, right?...
The upstream kernel use the flag like this:

flags & ACRN_IOEVENTFD_FLAG_PIO

So, the new flag has no effect on it.

Regards,
Conghui.




/* register ioeventfd for kick */
if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) {
/*
diff --git a/devicemodel/include/public/hsm_ioctl_defs.h
b/devicemodel/include/public/hsm_ioctl_defs.h
index 56b3b7ed7..be99b5bf7 100644
--- a/devicemodel/include/public/hsm_ioctl_defs.h
+++ b/devicemodel/include/public/hsm_ioctl_defs.h
@@ -226,6 +226,7 @@ struct acrn_ioeventfd {
#define ACRN_IOEVENTFD_FLAG_PIO 0x01
#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
+#define ACRN_IOEVENTFD_FLAG_ASYNCIO 0x08
/** file descriptor of the eventfd of this ioeventfd */
int32_t fd;
/** flag for ioeventfd ioctl */
--
2.25.1






Yu Wang
 

On Fri, Sep 23, 2022 at 02:19:44PM +0800, Chen, Conghui wrote:
Hi Yu,

-----Original Message-----
From: Wang, Yu1 <yu1.wang@...>
Sent: Friday, September 23, 2022 12:07 PM
To: acrn-dev@...
Cc: Chen, Conghui <conghui.chen@...>
Subject: Re: [acrn-dev] [PATCH v6 7/7] dm: support asyncio in ioeventfd

On Fri, Sep 23, 2022 at 09:54:55AM +0800, Conghui Chen wrote:
Add a new flag in ioeventfd ioctl to support asyncio. After that, the IO
request will be processed in asyncio path by kernel and hypervisor.

Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio.c | 4 +++-
devicemodel/include/public/hsm_ioctl_defs.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/devicemodel/hw/pci/virtio/virtio.c
b/devicemodel/hw/pci/virtio/virtio.c
index 546ec6f31..e289a880b 100644
--- a/devicemodel/hw/pci/virtio/virtio.c
+++ b/devicemodel/hw/pci/virtio/virtio.c
@@ -2000,7 +2000,9 @@ int virtio_register_ioeventfd(struct virtio_base
*base, int idx, bool is_registe

if (!is_register)
ioeventfd.flags = ACRN_IOEVENTFD_FLAG_DEASSIGN;
-
+ else
+ /* enable asyncio by default */
+ ioeventfd.flags = ACRN_IOEVENTFD_FLAG_ASYNCIO;
There's a concern. If the asynio kernel hasn't merged, then the upstream
kernel can not work with the new acrn-dm, right?...
The upstream kernel use the flag like this:

flags & ACRN_IOEVENTFD_FLAG_PIO

So, the new flag has no effect on it.
Then how acrn-dm knows if the asynio is really enabled or not? We need
some logs to indicate the asynio status.


Regards,
Conghui.




/* register ioeventfd for kick */
if (base->device_caps & (1UL << VIRTIO_F_VERSION_1)) {
/*
diff --git a/devicemodel/include/public/hsm_ioctl_defs.h
b/devicemodel/include/public/hsm_ioctl_defs.h
index 56b3b7ed7..be99b5bf7 100644
--- a/devicemodel/include/public/hsm_ioctl_defs.h
+++ b/devicemodel/include/public/hsm_ioctl_defs.h
@@ -226,6 +226,7 @@ struct acrn_ioeventfd {
#define ACRN_IOEVENTFD_FLAG_PIO 0x01
#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
+#define ACRN_IOEVENTFD_FLAG_ASYNCIO 0x08
/** file descriptor of the eventfd of this ioeventfd */
int32_t fd;
/** flag for ioeventfd ioctl */
--
2.25.1






Conghui Chen
 

Hi Yu,



The upstream kernel use the flag like this:

flags & ACRN_IOEVENTFD_FLAG_PIO

So, the new flag has no effect on it.
Then how acrn-dm knows if the asynio is really enabled or not? We need
some logs to indicate the asynio status
Sure, will log to show the asyncio status.


Regards,
Conghui.