diff mbox series

[RFC,09/11] HID: hyperv: Make ringbuffer at least take two pages

Message ID 20200721014135.84140-10-boqun.feng@gmail.com (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series Hyper-V: Support PAGE_SIZE larger than 4K | expand

Commit Message

Boqun Feng July 21, 2020, 1:41 a.m. UTC
When PAGE_SIZE > HV_HYP_PAGE_SIZE, we need the ringbuffer size to be at
least 2 * PAGE_SIZE: one page for the header and at least one page of
the data part (because of the alignment requirement for double mapping).

So make sure the ringbuffer sizes to be at least 2 * PAGE_SIZE when
using vmbus_open() to establish the vmbus connection.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 drivers/hid/hid-hyperv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Kelley (LINUX) July 22, 2020, 11:36 p.m. UTC | #1
From: Boqun Feng <boqun.feng@gmail.com> Sent: Monday, July 20, 2020 6:42 PM
> 
> When PAGE_SIZE > HV_HYP_PAGE_SIZE, we need the ringbuffer size to be at
> least 2 * PAGE_SIZE: one page for the header and at least one page of
> the data part (because of the alignment requirement for double mapping).
> 
> So make sure the ringbuffer sizes to be at least 2 * PAGE_SIZE when
> using vmbus_open() to establish the vmbus connection.
> 
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> ---
>  drivers/hid/hid-hyperv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> index 0b6ee1dee625..36c5e157c691 100644
> --- a/drivers/hid/hid-hyperv.c
> +++ b/drivers/hid/hid-hyperv.c
> @@ -104,8 +104,8 @@ struct synthhid_input_report {
> 
>  #pragma pack(pop)
> 
> -#define INPUTVSC_SEND_RING_BUFFER_SIZE		(40 * 1024)
> -#define INPUTVSC_RECV_RING_BUFFER_SIZE		(40 * 1024)
> +#define INPUTVSC_SEND_RING_BUFFER_SIZE		(128 * 1024)
> +#define INPUTVSC_RECV_RING_BUFFER_SIZE		(128 * 1024)

Use max(40 * 1024, 2 * PAGE_SIZE) like in patch 8 of the series?

> 
> 
>  enum pipe_prot_msg_type {
> --
> 2.27.0
Boqun Feng July 23, 2020, 1:28 a.m. UTC | #2
On Wed, Jul 22, 2020 at 11:36:15PM +0000, Michael Kelley wrote:
> From: Boqun Feng <boqun.feng@gmail.com> Sent: Monday, July 20, 2020 6:42 PM
> > 
> > When PAGE_SIZE > HV_HYP_PAGE_SIZE, we need the ringbuffer size to be at
> > least 2 * PAGE_SIZE: one page for the header and at least one page of
> > the data part (because of the alignment requirement for double mapping).
> > 
> > So make sure the ringbuffer sizes to be at least 2 * PAGE_SIZE when
> > using vmbus_open() to establish the vmbus connection.
> > 
> > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > ---
> >  drivers/hid/hid-hyperv.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> > index 0b6ee1dee625..36c5e157c691 100644
> > --- a/drivers/hid/hid-hyperv.c
> > +++ b/drivers/hid/hid-hyperv.c
> > @@ -104,8 +104,8 @@ struct synthhid_input_report {
> > 
> >  #pragma pack(pop)
> > 
> > -#define INPUTVSC_SEND_RING_BUFFER_SIZE		(40 * 1024)
> > -#define INPUTVSC_RECV_RING_BUFFER_SIZE		(40 * 1024)
> > +#define INPUTVSC_SEND_RING_BUFFER_SIZE		(128 * 1024)
> > +#define INPUTVSC_RECV_RING_BUFFER_SIZE		(128 * 1024)
> 
> Use max(40 * 1024, 2 * PAGE_SIZE) like in patch 8 of the series?
> 

Sure! Will change it in next version.

Regards,
Boqun

> > 
> > 
> >  enum pipe_prot_msg_type {
> > --
> > 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index 0b6ee1dee625..36c5e157c691 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -104,8 +104,8 @@  struct synthhid_input_report {
 
 #pragma pack(pop)
 
-#define INPUTVSC_SEND_RING_BUFFER_SIZE		(40 * 1024)
-#define INPUTVSC_RECV_RING_BUFFER_SIZE		(40 * 1024)
+#define INPUTVSC_SEND_RING_BUFFER_SIZE		(128 * 1024)
+#define INPUTVSC_RECV_RING_BUFFER_SIZE		(128 * 1024)
 
 
 enum pipe_prot_msg_type {