Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1010441rdb; Mon, 19 Feb 2024 00:51:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTK1I9bI9nptN3l/WcuNyQrHjLOHNJd0RQ02Rfx56KE08flm98IZeLznZzpF0fcbD+GXIyWSHRP6x+WROiAXdygpyiuEMkhGDKS9AUmw== X-Google-Smtp-Source: AGHT+IFLqqzvEA7eEJ8K/f/LWqFdqPCopsLQltW4A83RgYGRM2sDSm0jULxqVp4gxr3fS8kCmFf2 X-Received: by 2002:a05:6870:610a:b0:21e:8b52:8d77 with SMTP id s10-20020a056870610a00b0021e8b528d77mr6932447oae.20.1708332666079; Mon, 19 Feb 2024 00:51:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708332666; cv=pass; d=google.com; s=arc-20160816; b=s6Y8r/CPccBEGYIs2o6lxZS7GQh0c2s6BB1xuv7HX4wPlkisuP5LL9edEMCBDcSpgr jZelVadueK/bv0jaVqvxSU6PDsoU7GEq8W2t0kMBUxjyDtQbnleeoy9c0z9Aezb8DaYZ Fc65s2cNSPRlm6iyFcTfkORyghUPGsZaQG27PYhDj99h823UUBT71yb2a0Hy+47tBc0f Nx6WiSFBbGc1YTQdkbtosNWq4BQpTTuQZm8unKF4X+9+quoZ4/TL9wPx4jU6UeJYQB8g dZA1uufITGLCd7zgDE6ieDkH9KKFOvTzbW0aRrNOtdv5YnFQqaasHy+MYJ6MNejbel3P orjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YRor0UnYHSNe/aG6gklj1vt8VeeWGWl2cEZjRGp9u9k=; fh=085oS1yyf5kX9qNxDuDBeQjXOhxwKWygNYWYyGVvWXs=; b=Zf0IO8h8vyPudcoCtIgum3tQh6CWO6EbVxv+UsGJeS+x4LJrROgYBKGIT0bcdGIOrB lFeKeq7GEGasVCyKm4sAXJsZE6+DobXhPP8NitcsWDVrWrjVrKKK+tEQUjHBOKHF9c26 k5KxDdvZjatKe+TNv9MDbm8oJMcw30TAciwLZwsaiZsEeXokgJNGdgbfG6axATalzkRg TTl2bUIJq9KBtGItZYvlgx+S7xWu5fsvIb34rdSRD6TykFl/H/m2bVegVVdB+KUe7u/g x6+t5Nqx5pTg/bhP0ftl0J4sfRO6AFrRlc6D4LwEHWsqwraq2MWinCTXozkvjadsGXNd DEQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f+PyqisD; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-70967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c30-20020a63725e000000b005dc12a99c6esi4031067pgn.355.2024.02.19.00.51.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:51:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f+PyqisD; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-70967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C1A4B282374 for ; Mon, 19 Feb 2024 08:51:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ECDD21A1C; Mon, 19 Feb 2024 08:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f+PyqisD" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8754D2135A; Mon, 19 Feb 2024 08:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708332658; cv=none; b=LEIDA0p51dezfm6UYK1+rQE8ONiN036zlMHyfq7wQtxCBvVCQuuyFdyrT0HIRt82QUk5B3NQbs40YxTGsIGn827RPX1050G1oDRTcUvJxrKbSejgGEjztOZzvkcQyttBdBIIIOPGC35FYopzNRKDVbHkOcqaVS65Tnk1K6Fu+yg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708332658; c=relaxed/simple; bh=Gdta+sVIghXZf3QcsNLG8QdvkbpOc6nIYPto/FbjQvc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TNKZfPhHXUYwkk5tQNh1yJnLGpX1qYQZyFUbikeBN81KaBC2fBFKL92HWkhykA2MDyyXwK72GfQ0XcOvsdRa2YUdXZl7DS3Dsr9xodYnQKiWogxVKqPXMdAGBk8BdQWVDq5osWG2WPtXG50jVTJcQBKAxd984GhLRoDaUEQF2zU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f+PyqisD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B934C433C7; Mon, 19 Feb 2024 08:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708332658; bh=Gdta+sVIghXZf3QcsNLG8QdvkbpOc6nIYPto/FbjQvc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f+PyqisDcAC14HikWSUp/Z/VjeWy3jqmgEHCrZb4vs0NIrpjJ8ZF0KoLUU/CT3gMg isOPrvk/flo5SEC1O/LpqHHZWt8Qa4McEC1goD+k6IEdNb+ZevFKpN31mIuGPFtz/R DBVVp7q9BgBvIiqJ6S0oEDumtv1eHK2aKrmABIEk= Date: Mon, 19 Feb 2024 09:50:54 +0100 From: Greg KH To: Saurabh Sengar Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, ssengar@microsoft.com Subject: Re: [PATCH 2/6] uio_hv_generic: Query the ringbuffer size for device Message-ID: <2024021920-wincing-dyslexic-aae1@gregkh> References: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> <1708193020-14740-3-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1708193020-14740-3-git-send-email-ssengar@linux.microsoft.com> On Sat, Feb 17, 2024 at 10:03:36AM -0800, Saurabh Sengar wrote: > Query the ring buffer size from pre defined table per device. > Keep the size as is if the device doesn't have any preferred > ring size. What is the "as is" size? > > Signed-off-by: Saurabh Sengar > --- > drivers/uio/uio_hv_generic.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c > index 20d9762331bd..4bda6b52e49e 100644 > --- a/drivers/uio/uio_hv_generic.c > +++ b/drivers/uio/uio_hv_generic.c > @@ -238,6 +238,7 @@ hv_uio_probe(struct hv_device *dev, > struct hv_uio_private_data *pdata; > void *ring_buffer; > int ret; > + size_t ring_size = hv_dev_ring_size(channel); > > /* Communicating with host has to be via shared memory not hypercall */ > if (!channel->offermsg.monitor_allocated) { > @@ -245,12 +246,14 @@ hv_uio_probe(struct hv_device *dev, > return -ENOTSUPP; > } > > + if (!ring_size) > + ring_size = HV_RING_SIZE * PAGE_SIZE; Why the magic * PAGE_SIZE here? Where is it documented that ring_size is in pages? And what happens when PAGE_SIZE is changed? Why are you relying on that arbritrary value to dictate your buffer sizes to a device that has no relationship with PAGE_SIZE? Yes, I know you are copying what was there today, but you have the chance to rethink and most importantly, DOCUMENT this decision properly now. thanks, greg k-h