From patchwork Thu Sep 10 14:34:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 11767955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7825618 for ; Thu, 10 Sep 2020 14:37:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7719120720 for ; Thu, 10 Sep 2020 14:37:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hzYyM5bj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l1bI5ss4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7719120720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=82VQ4E2hMu2QpFrtqJ70Mu74MbeVNeVJdE8ucYsybx4=; b=hzYyM5bjE3cjkfgPS82QMwNhK 4dzN8OG3C5Em/SHzR5FuHqwHKadZNw9lA/JocPqGF5ili69e8Z9kdmiVfFbjLceAr280fRIGgotLV 796M2O5oQU6+BoJ5U/ipdYauwSTl/SUU5q+eLKfjDBtO/ukrcgKOplTSNbpPmt5uVNzHI1fQqFiTs kHNUtLlucxL/vYy72WjjQNAXEOM1HQyBS01l/rmy1egPQZ/kdLu646s8R6Xh5PHiWhUDoWM99NtL9 +MzRKyvvq6FhpVzLLUZxRtIY0Foxd85AeT1qSsE1mNBwvFuPhDUNizCEKvZy/s8tFpYI+qW/n8SkH mrJoB3ulg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGNgG-00005m-8m; Thu, 10 Sep 2020 14:36:08 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGNfY-0008HU-FU for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 14:35:25 +0000 Received: by mail-ed1-x543.google.com with SMTP id w1so6567601edr.3 for ; Thu, 10 Sep 2020 07:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tyJXvA8EaR+XSTkGzm3iM/Tde3qccPQP5bZuy8OPyP8=; b=l1bI5ss4UryzwKjYgm10fxFz8W2McHW4Rg/aMe38ZkyRaSFJ82KHNXFdINMtHhNUaY 1o7IzPZ50slcLpR/lKAkh5A0n5jEb229Ff+nnz4O7gDwZZBO82//B1KTsqk3JkOgqgkZ vRe9sCHjSoYZke3HXkcIU++JbAKtirYO4vREVU27v+UO6DjXKjQlzVhJJOzjzEwQGjzn ssJXTSo+HEOJN5E+zvFHSZ+zMqRQZJDP/7QqhvSHmUXr7tmZoxzpHj2Oa82mWUAkHCcJ vtBUsf7uQ4zhqBSgUtp0CyA0ioCMV0e1TqUC2gyfbvjzyqclfhQczKdZPwTRiAvBKpX/ U7/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tyJXvA8EaR+XSTkGzm3iM/Tde3qccPQP5bZuy8OPyP8=; b=tpsqAoWMvUPKMAhaaaJG2/FTQ2y7JDZok/4qZIxW3xyQv7WhBpI/8bksxqHFb7fWrW zzWaq0AVTiTzNvSUokB4Vmer5VA0Uro8wC5HazdI7sQmlb9pn+q3oGMHnocwaiDdxvvF 65zl+KjxGITO8X0jJ+y4Vq0oDACJYSeBIq0M9Mqsk8/geIow81pvLQFTXxAepkpoysBf uYZkC4glbiU+Of7g+7n4N8QlZhGl8QMFPRY+mMu1kkTlj0qJQYUQy/o85DUs7XCXoZnM tEdNIhF6YfUKkHGhWKipSa+SWFSbvGyGgV55uMuAoou4rtlPrnXKrbpyaxaXn/Mx7RdE 23PQ== X-Gm-Message-State: AOAM533m0CH0XZsST6lgBsTWHQYU0av3PLorJ/EXrOjjv3q2tlgLk1Fi x//82YQxITq14TyvK0bsk6A= X-Google-Smtp-Source: ABdhPJzuJ7HW8QVBuvHdERpLFcDaQ5GApnk5ppeYFcSB3KLXqN0xGv8p0J4Q/CqLBelSwXaw3ft15Q== X-Received: by 2002:aa7:de82:: with SMTP id j2mr10109782edv.3.1599748523652; Thu, 10 Sep 2020 07:35:23 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id f21sm7441952edw.83.2020.09.10.07.35.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2020 07:35:22 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 8E5B127C00A2; Thu, 10 Sep 2020 10:35:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 10 Sep 2020 10:35:19 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehjedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeehvdevteefgfeiudettdef vedvvdelkeejueffffelgeeuhffhjeetkeeiueeuleenucfkphephedvrdduheehrdduud durdejudenucevlhhushhtvghrufhiiigvpeeknecurfgrrhgrmhepmhgrihhlfhhrohhm pegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtd eigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehf ihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id B0931306468D; Thu, 10 Sep 2020 10:35:18 -0400 (EDT) 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 Subject: [PATCH v3 09/11] HID: hyperv: Make ringbuffer at least take two pages Date: Thu, 10 Sep 2020 22:34:53 +0800 Message-Id: <20200910143455.109293-10-boqun.feng@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910143455.109293-1-boqun.feng@gmail.com> References: <20200910143455.109293-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_103524_742216_AED64A9B X-CRM114-Status: GOOD ( 16.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [boqun.feng[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, maz@kernel.org, Wei Liu , Dmitry Torokhov , Stephen Hemminger , arnd@arndb.de, "Martin K. Petersen" , Jiri Kosina , ardb@kernel.org, will@kernel.org, Haiyang Zhang , Jiri Kosina , Boqun Feng , Michael Kelley , Benjamin Tissoires , catalin.marinas@arm.com, Jakub Kicinski , "K. Y. Srinivasan" , "James E.J. Bottomley" , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 Acked-by: Jiri Kosina Reviewed-by: Michael Kelley --- Hi Jiri, Thanks for your acked-by. I make a small change in this version (casting 2 * PAGE_SIZE into int to avoid compiler warnings), and it make no functional change. If the change is inappropriate, please let me know. 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..8905559b3882 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 max(40 * 1024, (int)(2 * PAGE_SIZE)) +#define INPUTVSC_RECV_RING_BUFFER_SIZE max(40 * 1024, (int)(2 * PAGE_SIZE)) enum pipe_prot_msg_type {