Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2020021pxk; Mon, 14 Sep 2020 02:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz/bm90mOy8NSQeOdIW4hGPf5OM1fB2L5s/mMYb4iRT6VG5jKxqx0qDxu43YJo4WvGcpa/ X-Received: by 2002:a17:906:4754:: with SMTP id j20mr14238157ejs.293.1600075955848; Mon, 14 Sep 2020 02:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600075955; cv=none; d=google.com; s=arc-20160816; b=OaxINScnf1odjQ6HiIH/5OGeaTLMd4QsA21W7StrwBhhuRO68wIWv0IdI3/Uefq57D W17JvZg+VTo+Ue3WBANXfrhVMspIMazBigm+DKlk1He7tnxQxRAPgkO0IWAxgdngNB0c mQYL2oncjeUT65ggjTuw9JuFm3A1fl52ZTxSBLb8yLRW6CPi70Di2CduDTY8yuDlvXj2 qTswvE0QvurHmRBJj9UBoUmtoa/BTN7v3wE3HsSCMKV1GZPH6zgmYykbgqGCGpBnv2SN IUINAiYIMx3Ox/72sGpKz64hzIJV3OURQzSRCO3JyFLmCHy1rl4lWeQqCPIceYImvxtl A2wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pZLqqybXXQgA/IZC4tJFYXMy5fXU6skvhtRUlKnQzKw=; b=XPEsAHx59eoNpKmhzZqWYXTNAKiV7DYhZ3t9zJBBRnZGL6WYG5PRM9r+7pV6MtHUzk 2cOf3EaBq7W8Ma9bvzwBjglU+leZVZ2ZuMQNPmneiQ+DqTTI+iPQawImJmhSJR18emYR 7Kbj8hnNRRt3Li69u7m06RA8uJo5fJBrr3NEccPsTK+fbHl5ZGZOlsRdqyqCYHmD0yD9 PCs0473o+81gWnC/08XrOkTb/4+DAGor3ZWPWjwWJCT3gPXerAIvnZ/S40FOXQMug9Xr QSbwOknGkrmAzNNT7C1UZn8Y2aAqy3sBiTfOOB8LLa5x1DQpEmu4PXjfekm4XwQoWsDS CF6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si6808712eds.232.2020.09.14.02.32.13; Mon, 14 Sep 2020 02:32:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726383AbgINJaX (ORCPT + 99 others); Mon, 14 Sep 2020 05:30:23 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38662 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbgINJaV (ORCPT ); Mon, 14 Sep 2020 05:30:21 -0400 Received: by mail-wm1-f67.google.com with SMTP id l9so10496257wme.3; Mon, 14 Sep 2020 02:30:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pZLqqybXXQgA/IZC4tJFYXMy5fXU6skvhtRUlKnQzKw=; b=Qs653CAq8kBIy4n9EnBci2wA52LsG89rVNHYyO/vwdF/3ybOJF9+B6ehZLik5n24aq Ext9LBc1+KIfdiVwE6z2StB3jBRGvbQUQazdtVdlF2K3UXi/mzgNoE/G935A8RYxH6S6 vOkdcDMSUqEAZzDLanUPb+6DH1GrCTxPgFRw5fnn+TSz0w7CpSbeDTZ7cm495Abc3kKs Oc2mGXM0+5D5UVdW6uLU9wujwtVc+Wg1+TXAND64+oxirBzc51MAOvXTFBkal5X5y4jT L1Fgj2S116J0ATpP3l5C93JLd4xhnmyif/5Bn1UYwl0akFtr+/CY+ney/T0tkW7LPOf1 R5Pw== X-Gm-Message-State: AOAM533Entn7xCaKjDj5A/4xPDBsVa5ZfQ8X+0MbPVyvKyrhhYAFOv6J KmeNhhAqVbD97Ovmw7zds20= X-Received: by 2002:a7b:c1c3:: with SMTP id a3mr15248600wmj.68.1600075818330; Mon, 14 Sep 2020 02:30:18 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id 185sm19690077wma.18.2020.09.14.02.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 02:30:17 -0700 (PDT) Date: Mon, 14 Sep 2020 09:30:16 +0000 From: Wei Liu To: Boqun Feng Cc: linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , "David S. Miller" , Jakub Kicinski , "James E.J. Bottomley" , "Martin K. Petersen" , Michael Kelley , will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org Subject: Re: [PATCH v3 08/11] Input: hyperv-keyboard: Make ringbuffer at least take two pages Message-ID: <20200914093016.lsfrfk4c7kyj6tn3@liuwe-devbox-debian-v2> References: <20200910143455.109293-1-boqun.feng@gmail.com> <20200910143455.109293-9-boqun.feng@gmail.com> <20200914084600.GA45838@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914084600.GA45838@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 04:46:00PM +0800, Boqun Feng wrote: > On Thu, Sep 10, 2020 at 10:34:52PM +0800, Boqun Feng wrote: > > 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 > > --- > > drivers/input/serio/hyperv-keyboard.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c > > index df4e9f6f4529..6ebc61e2db3f 100644 > > --- a/drivers/input/serio/hyperv-keyboard.c > > +++ b/drivers/input/serio/hyperv-keyboard.c > > @@ -75,8 +75,8 @@ struct synth_kbd_keystroke { > > > > #define HK_MAXIMUM_MESSAGE_SIZE 256 > > > > -#define KBD_VSC_SEND_RING_BUFFER_SIZE (40 * 1024) > > -#define KBD_VSC_RECV_RING_BUFFER_SIZE (40 * 1024) > > +#define KBD_VSC_SEND_RING_BUFFER_SIZE max(40 * 1024, (int)(2 * PAGE_SIZE)) > > +#define KBD_VSC_RECV_RING_BUFFER_SIZE max(40 * 1024, (int)(2 * PAGE_SIZE)) > > > > Hmm.. just realized there is a problem here, if PAGE_SIZE = 16k, then > 40 * 1024 > 2 * PAGE_SIZE, however in the ring buffer size should also > be page aligned, otherwise vmbus_open() will fail. > > I plan to modify this as > > in linux/hyperv.h: > > #define VMBUS_RING_SIZE(payload_sz) PAGE_ALIGN(sizeof(struct hv_ring_buffer) + (playload_sz)) > > and here: > > #define KBD_VSC_SEND_RING_BUFFER_SIZE VMBUS_RING_SIZE(36 * 1024) > #define KBD_VSC_RECV_RING_BUFFER_SIZE VMBUS_RING_SIZE(36 * 1024) > > and the similar change for patch #9. OOI why do you reduce the size by 4k here? Wei. > > Thoughts? > > Regards, > Boqun > > > #define XTKBD_EMUL0 0xe0 > > #define XTKBD_EMUL1 0xe1 > > -- > > 2.28.0 > >