Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1029195rdb; Mon, 19 Feb 2024 01:40:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXc5tw8qg/OniMMcPd0Wq96yRe8zI8/BEf+RrVIdq2PIxwxnS7xv2sy96bu6PJpt2a6Lsvy261FpAJJsTxtFLF/vMuiO7EfOX84dQ2kjA== X-Google-Smtp-Source: AGHT+IEZJJxhfwJmcK3V00jALp5+oWQjmCg7ZX1j3OD0zCIiEbeEWodwvXGLiO4B4uInAPV8+yCv X-Received: by 2002:a05:6102:2923:b0:470:66d9:49e6 with SMTP id cz35-20020a056102292300b0047066d949e6mr223279vsb.19.1708335635189; Mon, 19 Feb 2024 01:40:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708335635; cv=pass; d=google.com; s=arc-20160816; b=tcf2hcuiru2NgKfItm19/+lEAFRkYEEk+q+lR95v4ImuQwVcHKZ+YFhB6s9dcJcPKI azuGbLXEgglpUXfINJlLU1g8G154TORsQxoOCySvZff6CS2mEuOFZT82ryl99IukvTzJ hZ+MOfn41sRt1r5SqZB564SFEIM3GTsVQp6Y3oiHrbl03Ivtmhy6a6u0Ge7A1qbH7RdU bd9UBYCLusOcypm1fIFpnLd487Fwalme8/xNx6Ia7zN1oQzuUm6wvRNoqu1Fu1WzGMNl IplpYEhq2lG8zU+53lzmFNDL1eOkQYGaTMiVvn8yXVMrHOD+Q8FiCbcAPr9L0yT2+Ijc QphA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=ELvZ5Y3ANrK+RgjK2Cz1IwCcePKRlLVuyLn+tsrpu80=; fh=dXBlqzMxyT08c6C/n3ZCDDv3TZXLsVX+sfoP6ClkdWY=; b=mEdIEBLAUR7ONR1/f2E7E8ZoxLCqi64qXqxzSW9WNkrafjoCqb+Ku/nl3VEd87aZVK UZZBlqgUPNYNhgeaYZHw6Kfz1FvWUwaOApJqh/T+/0Vi2vHd8ZcE0lGQiwBzXyguayBd PZS/yOwxMDNwUBfNSr5tE/CxZt+D0pvEouGN+sWADSkx1xYpEoQ3c9og3pbLC7GBdY6I Wy86s6H7ORL+hppDITtaLzoOwlCDddyEfEUCfpJjPFU91HBkiSLb7y8Ajm8UlpKvtPYP eHZ9iEwLMQOuGZL/gpenGaM6Jj4SiQKfch0pnZ+dLRfZm25lHW0jYcSFu4dFnvsqNMeb bh/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lq9ubTHt; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-71049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j1-20020ac86641000000b0042dd6dea889si5547875qtp.155.2024.02.19.01.40.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 01:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=lq9ubTHt; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-71049-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BF18C1C20845 for ; Mon, 19 Feb 2024 09:40:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 840FE24203; Mon, 19 Feb 2024 09:40:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="lq9ubTHt" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55E9425569; Mon, 19 Feb 2024 09:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708335625; cv=none; b=Ili8wbZTG+2DHajfS0xVDMl0fOej3wLhqMR4lwCzMFxL/xFQVcHhmrRu5j2tKdi5YLSlqTzWAYpcQPSiJtcztC5p0vvkHeBUgruJhZbZNfjFd8AyK06z4ixNz+SpkpEZeTtPcRsIGEiLWHRv6wZDn1wpmmdiqaxlEawNtev2zXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708335625; c=relaxed/simple; bh=+0z+WLSqM9PLe9yU45IvLUSUrPaur/xg7coLCs8rcdU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HGCmJbwi4RqCz6X88uf7QjjenddDgYO093SA3mnI+jkgaswokpampC/CnkSFTRWCN+Hr8hEQ2Jf6ukiEcDAq/iPPOJMsWtGMQX2SdJxx3UXyCy4AwLlmtftjUaAQSgUQGhIuqxqFNIp9n5HRz6+f7Tvxosq1ay7bWtpq1Pl1e34= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=lq9ubTHt; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1127) id 0200320835FB; Mon, 19 Feb 2024 01:40:23 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0200320835FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708335624; bh=ELvZ5Y3ANrK+RgjK2Cz1IwCcePKRlLVuyLn+tsrpu80=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lq9ubTHtST3vhh96PIlNVg6zcGkA5oGUWBSYPuT2M3oTjiND+HFtSpsRTWV+R0gSU 2GNU5xMZKGxNhYF6tW7LQtI/thJo2OPoScD2fEaUccSqmqlkmEs2mAfUBo+rvaQe9+ k5vMVrAT193H6tabZQDfsUBWpf8oLZ4Ge6N6ea74= Date: Mon, 19 Feb 2024 01:40:23 -0800 From: Saurabh Singh Sengar To: Greg KH 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: <20240219094023.GB32526@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> <1708193020-14740-3-git-send-email-ssengar@linux.microsoft.com> <2024021920-wincing-dyslexic-aae1@gregkh> 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: <2024021920-wincing-dyslexic-aae1@gregkh> User-Agent: Mutt/1.5.21 (2010-09-15) On Mon, Feb 19, 2024 at 09:50:54AM +0100, Greg KH wrote: > 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? I will elaborate more here. > > > > > 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. I agree PAGE_SIZE is not accurate here and we should use HV_HYP_PAGE_SIZE. This can be further improved by using VMBUS_RING_SIZE macro. However, I propose addressing this improvement in a separate patch, given the are significant changes already present in this series. - Saurabh > > thanks, > > greg k-h