Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1997601pxk; Mon, 14 Sep 2020 01:47:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD1s402ATsbjQFDUl3Hnet6f+AUxp7JcB4aEwkySfF/jA2nzQgA4zoQydPzgQMg9tb+Nba X-Received: by 2002:a50:d65e:: with SMTP id c30mr16211073edj.57.1600073237976; Mon, 14 Sep 2020 01:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600073237; cv=none; d=google.com; s=arc-20160816; b=Xi0qZWLjIxDtlKiHTMPQR8ZSsXS5mihQNWLW0DEKgDm6ZY24udfB50fbGmEKNx8WD7 PW7jQLOvkY9qSbkI3VRU3Byos8pdQfTApBRaXK3MEmVBY+O5e+O/mososlDiTsqQp7aB Ihvk7CGQavQc5vdDJ1Rtbn+Fmp1VjTK1y3w6OAMA7cW3tJGevLweJkOjQPKXHZG1Shkh K++3s2uuaZ8A5FBQlenWudZinB77Mgo7FD3n26WCBSkgsRIu33fSy0q6n7Q6PtRatTLp ElSkMXyQC6Og6rEGkTBy3XVkWAHvPSVtjQZQB+UI1ZnKWA5huHJUEbO8I67sLiipySK6 5pPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=XuGmVWQ/C1VQzn4NF907Rd7tGA3RzQj75SvBymACUwY=; b=sJ77/q61B//NRb5O7iHkAs1sgvJ5uRr5GT16593nFCaqLCAP3AbxPNrv5h9Zarz/Rh KrJQVam620x8rQCL4vU25UDjItsgOhykHFjNRxku/6UK9zANAofwwqpRy1QAHF5mv4Pj xzlclP+YPmXF7WWRtO3rBqaQq4L9FdL667xE1wuDayi1w/DOc64H4JbF60xDr+dNgPxt SAJ2fUkJ+kyhtfXEd/z6h8D0O3guNDJ41tpWs+7V9Si77jvocAgefYxhDVuZX5CemEhI kNcxhCBpfSJUWVi7iD+m5zdGj+R+xjSVkErBIUNgJy6zo2qgX9rYSk+dmpJ3lhxKQN/D 8O0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KAuZQWGn; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si6488014ejz.749.2020.09.14.01.46.55; Mon, 14 Sep 2020 01:47:17 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KAuZQWGn; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbgINIqP (ORCPT + 99 others); Mon, 14 Sep 2020 04:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbgINIqL (ORCPT ); Mon, 14 Sep 2020 04:46:11 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C2FC06174A; Mon, 14 Sep 2020 01:46:10 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id g4so16751747edk.0; Mon, 14 Sep 2020 01:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XuGmVWQ/C1VQzn4NF907Rd7tGA3RzQj75SvBymACUwY=; b=KAuZQWGnWOXAmoIJ5RdYKX9qoFTKc0Gcvcq8zH+aq2w+X3GwZ73Oa2h/MdKH/g9IPu W0N7nAjtS9/XVhZjl6FB7tDoHdpmsKUVcwFdfCVB9lLE1OGIREhBvPZ08timIm12KiyJ 0J5oE4+as6cuGA50OvJV2j5KrvDcM+fLZRaKPjoA4MAhx66D79/A2DVGEz1/NSu7lxAj JN+dUtBCntrGR3q0x8xqkxIM8p6XY7hXSUzJHwmKNyVWiMZt6YQg4iDiLtlzf5yKa5Bo YIchxne8SZJqBrGQQXayKoq5qbcbf++luzrFUzN8cPKLWOIn19EGYuygx2zNGbGrBudZ Vb5Q== 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; bh=XuGmVWQ/C1VQzn4NF907Rd7tGA3RzQj75SvBymACUwY=; b=e4H+kOpGp01+T5WRQ8yU7DDCA/wibU1BxCJ6OHz/oJbO+mkVSoOk2nekDJrs5f3Rp3 0l2fHEkQMixN3XCdBSOzAN3Zt7i1u18MKWVKuzLb4liX6G4NU7h+cJN/363JU1vgj0jf KGkvPkQ2Y4u+qF5yo87gUjd6JhIueFtBwAE7utxaa9hj8R65RS7ZnhuAiErb8gHvwDLB BMw8WcCjUVKVZJHUpEL3Y0OFUU7o5qGdVD3NS1+Z4/6VDhD/uXwAWOC1f/iYuHL3515e bOkJOiUJGBMYOtnguap8a+4WU/pDjtY7X+vLcqZfpsocI7wXrMnb9863NewBQbTraDQ9 V59Q== X-Gm-Message-State: AOAM5316hhMT5g6M/O5QCseRy5jeAZ4GAj/5Jmiq7ZcZDZbw1QfcYKSU 8W4XbZkVWAIe2Z59/jN9plY= X-Received: by 2002:aa7:d059:: with SMTP id n25mr16026892edo.270.1600073169140; Mon, 14 Sep 2020 01:46:09 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id bz5sm7156811ejc.83.2020.09.14.01.46.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2020 01:46:08 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 4F55527C0054; Mon, 14 Sep 2020 04:46:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 14 Sep 2020 04:46:04 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudeiiedgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpeffhffvuffkfhggtggujges thdtredttddtvdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpedvleeigedugfegveejhfej veeuveeiteejieekvdfgjeefudehfefhgfegvdegjeenucfkphephedvrdduheehrdduud durdejudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtd eigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehf ihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D6FC306467D; Mon, 14 Sep 2020 04:46:01 -0400 (EDT) Date: Mon, 14 Sep 2020 16:46:00 +0800 From: Boqun Feng To: 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 Cc: "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: <20200914084600.GA45838@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> References: <20200910143455.109293-1-boqun.feng@gmail.com> <20200910143455.109293-9-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910143455.109293-9-boqun.feng@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thoughts? Regards, Boqun > #define XTKBD_EMUL0 0xe0 > #define XTKBD_EMUL1 0xe1 > -- > 2.28.0 >