Message ID | 1708193020-14740-2-git-send-email-ssengar@linux.microsoft.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-69996-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp443963dyc; Sat, 17 Feb 2024 10:05:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLIFBGWbk7Ell4ewPY/LeNhXdbZ2eIelPbKQE1vUdQwfUCNkkqv9E+yiEbPFMvjuSXtC1JWMUDGGJzM18IFNN8a78AbA== X-Google-Smtp-Source: AGHT+IFqSQGv95U3x0lOXCvJBO4e/rCSivHiobTvraYLnfayH0Gq5C4Oxqa9dPVVgweUXK9ozEKx X-Received: by 2002:a1f:ed01:0:b0:4c0:285e:79d with SMTP id l1-20020a1fed01000000b004c0285e079dmr6661581vkh.1.1708193134754; Sat, 17 Feb 2024 10:05:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193134; cv=pass; d=google.com; s=arc-20160816; b=0Lfz50cvYpXCt1qyW/zK0gnOWqXZYXSkaKzeu/EdU8SFurqxzVHlAMQw0aSWQiRPwu l7Zgk+GYB3b6A2OzpPxnxqe2EToSK9y1X+Jv3dazagqUT7SiCtet4ARzv3etHYv3Ziti 6SrIrvMZ6FjPJUDjq6/pgnOJjJ2PQCaZ58Qs6neabRkOollNNhpfGMOVqr+F3Dfouqyr X4MqUyg+iVITMC1OULVfKZtduuDJ5GE8uPDubgoXWcmSZjvinm0R9q0mAhZYvoese0D2 uZNFlvIVObrTBMGRhIecVELC9nstjbYp+ygxD/z1KOjczKGLdwABfq/mHGuVzdf5JTPz uO6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=u7XIjROBZmicmyXMY8w3Cxhx4ZbeH5xu95iiNnPZkuo=; fh=/g2YaKiPj+3FPE7qve5VOLtb1iRxoth7NZi+8r+O0Q0=; b=iYSpF/WVx/4grRcUV6B07jWGrrRESdjZqnEFgoY6iQ69ujmyq0xHPttUEThPGH6WV2 JjvyV2M5SkDy1yWsE/PtJOzM6RfLUYT4Jqv+S6GmVi+2s517q+k2GUGXVshMdCxxCkHU BpmZ4vOzNxB5Hko2GBD1smYZ9iRpPMTDr5Ft8PgkZ4FKMgrt8m/OMv/tu740Ez9qAVLT xKh6lE7gIWVXe1XfG41c6jl5HXuC60V51ok0nV1hOqiD+rmZf38Taf05mxZRwfo7hHZe SGbIx1SJWQ571guRRYces/AZThzSWF3wiMCL7VTDxQ79y6pOi0eocqbojFvPvxufSeTV TnjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=pL8d8Dux; 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-69996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69996-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v22-20020a67af16000000b0046d238b7b44si377872vsl.417.2024.02.17.10.05.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:05:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69996-ouuuleilei=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=pL8d8Dux; 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-69996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69996-ouuuleilei=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 87DF41C20B46 for <ouuuleilei@gmail.com>; Sat, 17 Feb 2024 18:05:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 758287E78B; Sat, 17 Feb 2024 18:04:38 +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="pL8d8Dux" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA7D37D3F6; Sat, 17 Feb 2024 18:04:33 +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=1708193075; cv=none; b=VSr7IMw/C280XxXkCnYB3cyHGdJX0F+Hi/5UkLOsD0KXqt3X/ZuuQoJ5LA6BPIlLHBk6F3nNXrtz6A7ZP23NjXGRv1dB2kGx0AEdRy51V0HS8Es7Is13EmUOZMRn/xp9Iy1iQ1GdhbS9sXVbnJSmg+ZHaS1m27QModaGwynS+uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193075; c=relaxed/simple; bh=eEQdEhkRhTvXLDK0ExelfFMrd3JVa1/jnkj41RfY3Ho=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=qwjg2ZQPw0OYrqHvLbCnnKL1mEDLueM0jHx2AiWE1BEkVOskU/JD16MFKhYbLh3XZDgUJ5XTUJbAfGW/oiMozw2CEA83zPrB1HDNWfeGh+YcN9fK1NGLOtq3FaQIVJB75duzMhv887KYThWHGYvNG6yuRx7MK027e4E99B+ZuPQ= 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=pL8d8Dux; 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: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 6CB1A207FD2C; Sat, 17 Feb 2024 10:04:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6CB1A207FD2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708193067; bh=u7XIjROBZmicmyXMY8w3Cxhx4ZbeH5xu95iiNnPZkuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pL8d8DuxzHRTdH9ugapQhVN8aVGBA/ZxfXsRmiv5lSJi2dptyyvtmNo/vwAFRVzWu qfJAVc/B7oUGx4YEnra+xzf1oNvtVnzqofFViSPfeyYEL7aq13rLSFVH5Bm2m9GJZn 1UhdihCFR6WE2jaNKPfESu6MuiLMfV/sJjAam7Jo= From: Saurabh Sengar <ssengar@linux.microsoft.com> To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, gregkh@linuxfoundation.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ssengar@microsoft.com Subject: [PATCH 1/6] Drivers: hv: vmbus: Add utility function for querying ring size Date: Sat, 17 Feb 2024 10:03:35 -0800 Message-Id: <1708193020-14740-2-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> References: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170324518084726 X-GMAIL-MSGID: 1791170324518084726 |
Series |
Low speed Hyper-V devices support
|
|
Commit Message
Saurabh Singh Sengar
Feb. 17, 2024, 6:03 p.m. UTC
Add a function to query for the preferred ring buffer size of VMBus
device.
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
drivers/hv/channel_mgmt.c | 7 +++++--
drivers/hv/hyperv_vmbus.h | 5 +++++
include/linux/hyperv.h | 1 +
3 files changed, 11 insertions(+), 2 deletions(-)
Comments
On Sat, Feb 17, 2024 at 10:03:35AM -0800, Saurabh Sengar wrote: > Add a function to query for the preferred ring buffer size of VMBus > device. That says what you did, but not why you did it. > > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> > --- > drivers/hv/channel_mgmt.c | 7 +++++-- > drivers/hv/hyperv_vmbus.h | 5 +++++ > include/linux/hyperv.h | 1 + > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c > index 2f4d09ce027a..7ea444d72f9f 100644 > --- a/drivers/hv/channel_mgmt.c > +++ b/drivers/hv/channel_mgmt.c > @@ -120,7 +120,8 @@ const struct vmbus_device vmbus_devs[] = { > }, > > /* File copy */ > - { .dev_type = HV_FCOPY, > + { .pref_ring_size = 0x4000, > + .dev_type = HV_FCOPY, > HV_FCOPY_GUID, > .perf_device = false, > .allowed_in_isolated = false, > @@ -141,11 +142,13 @@ const struct vmbus_device vmbus_devs[] = { > }, > > /* Unknown GUID */ > - { .dev_type = HV_UNKNOWN, > + { .pref_ring_size = 0x11000, > + .dev_type = HV_UNKNOWN, Where do these magic numbers for the size come from? > .perf_device = false, > .allowed_in_isolated = false, > }, > }; > +EXPORT_SYMBOL_GPL(vmbus_devs); > > static const struct { > guid_t guid; > diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h > index f6b1e710f805..76ac5185a01a 100644 > --- a/drivers/hv/hyperv_vmbus.h > +++ b/drivers/hv/hyperv_vmbus.h > @@ -417,6 +417,11 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel) > return vmbus_devs[channel->device_id].perf_device; > } > > +static inline size_t hv_dev_ring_size(struct vmbus_channel *channel) > +{ > + return vmbus_devs[channel->device_id].pref_ring_size; > +} > + > static inline bool hv_is_allocated_cpu(unsigned int cpu) > { > struct vmbus_channel *channel, *sc; > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h > index 2b00faf98017..5951c7bb5712 100644 > --- a/include/linux/hyperv.h > +++ b/include/linux/hyperv.h > @@ -800,6 +800,7 @@ struct vmbus_requestor { > #define VMBUS_RQST_RESET (U64_MAX - 3) > > struct vmbus_device { > + size_t pref_ring_size; No documentation for this? What is the size in units of? thanks, greg k-h
On Sun, Feb 18, 2024 at 08:11:58AM +0100, Greg KH wrote: > On Sat, Feb 17, 2024 at 10:03:35AM -0800, Saurabh Sengar wrote: > > Add a function to query for the preferred ring buffer size of VMBus > > device. > > That says what you did, but not why you did it. I thought subsequent patch will make it clear, but I can add more info in cover letter. I will enhance this commit as well. > > > > > Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> > > --- > > drivers/hv/channel_mgmt.c | 7 +++++-- > > drivers/hv/hyperv_vmbus.h | 5 +++++ > > include/linux/hyperv.h | 1 + > > 3 files changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c > > index 2f4d09ce027a..7ea444d72f9f 100644 > > --- a/drivers/hv/channel_mgmt.c > > +++ b/drivers/hv/channel_mgmt.c > > @@ -120,7 +120,8 @@ const struct vmbus_device vmbus_devs[] = { > > }, > > > > /* File copy */ > > - { .dev_type = HV_FCOPY, > > + { .pref_ring_size = 0x4000, > > + .dev_type = HV_FCOPY, > > HV_FCOPY_GUID, > > .perf_device = false, > > .allowed_in_isolated = false, > > @@ -141,11 +142,13 @@ const struct vmbus_device vmbus_devs[] = { > > }, > > > > /* Unknown GUID */ > > - { .dev_type = HV_UNKNOWN, > > + { .pref_ring_size = 0x11000, > > + .dev_type = HV_UNKNOWN, > > Where do these magic numbers for the size come from? This value is (16 + 1) page_size, which is found sufficient for most of the slow devices. 16 page_size is for the ringbuffer and 1 page_size for the headre. This is the approximation for default case, to avoid using fall back case of 512 page_size as used by uio_hv_generic. > > > .perf_device = false, > > .allowed_in_isolated = false,> > }, > > }; > > +EXPORT_SYMBOL_GPL(vmbus_devs); > > > > static const struct { > > guid_t guid; > > diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h > > index f6b1e710f805..76ac5185a01a 100644 > > --- a/drivers/hv/hyperv_vmbus.h > > +++ b/drivers/hv/hyperv_vmbus.h > > @@ -417,6 +417,11 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel) > > return vmbus_devs[channel->device_id].perf_device; > > } > > > > +static inline size_t hv_dev_ring_size(struct vmbus_channel *channel) > > +{ > > + return vmbus_devs[channel->device_id].pref_ring_size; > > +} > > + > > static inline bool hv_is_allocated_cpu(unsigned int cpu) > > { > > struct vmbus_channel *channel, *sc; > > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h > > index 2b00faf98017..5951c7bb5712 100644 > > --- a/include/linux/hyperv.h > > +++ b/include/linux/hyperv.h > > @@ -800,6 +800,7 @@ struct vmbus_requestor { > > #define VMBUS_RQST_RESET (U64_MAX - 3) > > > > struct vmbus_device { > > + size_t pref_ring_size; > > No documentation for this? What is the size in units of? I can add a comment here like below: /* * Total memory in bytes allocated for the one complete ring buffer, * which includes the ring buffer header, of size PAGE_SIZE. This value * should be aligned to page_size. */ - Saurabh > > thanks, > > greg k-h
On Sun, Feb 18, 2024 at 12:03:06AM -0800, Saurabh Singh Sengar wrote: > On Sun, Feb 18, 2024 at 08:11:58AM +0100, Greg KH wrote: > > On Sat, Feb 17, 2024 at 10:03:35AM -0800, Saurabh Sengar wrote: > > > Add a function to query for the preferred ring buffer size of VMBus > > > device. > > > > That says what you did, but not why you did it. > > I thought subsequent patch will make it clear, but I can add more > info in cover letter. I will enhance this commit as well. Each patch should stand on its own, as it will be on its own when committed, right? I don't know anything is happening "next", nor what any of this means here, which is required. Again, what would _you_ want to see if you had to review this? Along those lines, why not get some internal review, and signed-off-by first, before asking us to review this for you? You all know this area the best, and have lots of experience with reviews, right? thanks, greg k-h
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 2f4d09ce027a..7ea444d72f9f 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -120,7 +120,8 @@ const struct vmbus_device vmbus_devs[] = { }, /* File copy */ - { .dev_type = HV_FCOPY, + { .pref_ring_size = 0x4000, + .dev_type = HV_FCOPY, HV_FCOPY_GUID, .perf_device = false, .allowed_in_isolated = false, @@ -141,11 +142,13 @@ const struct vmbus_device vmbus_devs[] = { }, /* Unknown GUID */ - { .dev_type = HV_UNKNOWN, + { .pref_ring_size = 0x11000, + .dev_type = HV_UNKNOWN, .perf_device = false, .allowed_in_isolated = false, }, }; +EXPORT_SYMBOL_GPL(vmbus_devs); static const struct { guid_t guid; diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index f6b1e710f805..76ac5185a01a 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -417,6 +417,11 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel) return vmbus_devs[channel->device_id].perf_device; } +static inline size_t hv_dev_ring_size(struct vmbus_channel *channel) +{ + return vmbus_devs[channel->device_id].pref_ring_size; +} + static inline bool hv_is_allocated_cpu(unsigned int cpu) { struct vmbus_channel *channel, *sc; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 2b00faf98017..5951c7bb5712 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -800,6 +800,7 @@ struct vmbus_requestor { #define VMBUS_RQST_RESET (U64_MAX - 3) struct vmbus_device { + size_t pref_ring_size; u16 dev_type; guid_t guid; bool perf_device;