linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Drivers: hv: vmbbus: Miscellaneous cleanup
@ 2017-11-14 17:51 kys
  2017-11-14 17:52 ` [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers kys
  2017-11-14 17:52 ` [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local kys
  0 siblings, 2 replies; 7+ messages in thread
From: kys @ 2017-11-14 17:51 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: K. Y. Srinivasan

From: K. Y. Srinivasan <kys@microsoft.com>

Miscellaneous cleanup.

Michael Kelley (1):
  Drivers: hv: vmbus: Remove x86-isms from arch independent drivers

Stephen Hemminger (1):
  vmbus: make hv_get_ringbuffer_availbytes local

 arch/x86/hyperv/hv_init.c       |   21 ++++++++++++++-------
 arch/x86/include/asm/mshyperv.h |    4 ++--
 drivers/hv/hv.c                 |    3 ---
 drivers/hv/ring_buffer.c        |   23 +++++++++++++++++++++++
 drivers/hv/vmbus_drv.c          |    5 ++---
 include/linux/hyperv.h          |   22 ----------------------
 6 files changed, 41 insertions(+), 37 deletions(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers
  2017-11-14 17:51 [PATCH 0/2] Drivers: hv: vmbbus: Miscellaneous cleanup kys
@ 2017-11-14 17:52 ` kys
  2017-11-28 15:33   ` Greg KH
  2017-11-14 17:52 ` [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local kys
  1 sibling, 1 reply; 7+ messages in thread
From: kys @ 2017-11-14 17:52 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Michael Kelley, K. Y. Srinivasan

From: Michael Kelley <mikelley@microsoft.com>

hv_is_hypercall_page_setup() is used to check if Hyper-V is
initialized, but a 'hypercall page' is an x86 implementation detail
that isn't necessarily present on other architectures. Rename to the
architecture independent hv_is_hyperv_initialized() and add check
that x86_hyper is pointing to Hyper-V.  Use this function instead of
direct references to x86-specific data structures in vmbus_drv.c,
and remove now redundant call in hv_init(). Also remove 'x86' from
the string name passed to cpuhp_setup_state().

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 arch/x86/hyperv/hv_init.c       |   21 ++++++++++++++-------
 arch/x86/include/asm/mshyperv.h |    4 ++--
 drivers/hv/hv.c                 |    3 ---
 drivers/hv/vmbus_drv.c          |    5 ++---
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index aeb8edf..e5372c9 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -239,17 +239,24 @@ void hyperv_report_panic(struct pt_regs *regs, long err)
 }
 EXPORT_SYMBOL_GPL(hyperv_report_panic);
 
-bool hv_is_hypercall_page_setup(void)
+bool hv_is_hyperv_initialized(void)
 {
 	union hv_x64_msr_hypercall_contents hypercall_msr;
 
-	/* Check if the hypercall page is setup */
+	/*
+	 * Ensure that we're really on Hyper-V, and not a KVM or Xen
+	 * emulation of Hyper-V
+	 */
+	if (x86_hyper != &x86_hyper_ms_hyperv)
+		return false;
+
+	/*
+	 * Verify that earlier initialization succeeded by checking
+	 * that the hypercall page is setup
+	 */
 	hypercall_msr.as_uint64 = 0;
 	rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
 
-	if (!hypercall_msr.enable)
-		return false;
-
-	return true;
+	return hypercall_msr.enable;
 }
-EXPORT_SYMBOL_GPL(hv_is_hypercall_page_setup);
+EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized);
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index bd89104..740dc97 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -311,11 +311,11 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
 void hyperv_setup_mmu_ops(void);
 void hyper_alloc_mmu(void);
 void hyperv_report_panic(struct pt_regs *regs, long err);
-bool hv_is_hypercall_page_setup(void);
+bool hv_is_hyperv_initialized(void);
 void hyperv_cleanup(void);
 #else /* CONFIG_HYPERV */
 static inline void hyperv_init(void) {}
-static inline bool hv_is_hypercall_page_setup(void) { return false; }
+static inline bool hv_is_hyperv_initialized(void) { return false; }
 static inline void hyperv_cleanup(void) {}
 static inline void hyperv_setup_mmu_ops(void) {}
 #endif /* CONFIG_HYPERV */
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 8267439..fe96aab 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -49,9 +49,6 @@ struct hv_context hv_context = {
  */
 int hv_init(void)
 {
-	if (!hv_is_hypercall_page_setup())
-		return -ENOTSUPP;
-
 	hv_context.cpu_context = alloc_percpu(struct hv_per_cpu_context);
 	if (!hv_context.cpu_context)
 		return -ENOMEM;
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 4f3faf5..398643b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -37,7 +37,6 @@
 #include <linux/sched/task_stack.h>
 
 #include <asm/hyperv.h>
-#include <asm/hypervisor.h>
 #include <asm/mshyperv.h>
 #include <linux/notifier.h>
 #include <linux/ptrace.h>
@@ -1053,7 +1052,7 @@ static int vmbus_bus_init(void)
 	 * Initialize the per-cpu interrupt state and
 	 * connect to the host.
 	 */
-	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/hyperv:online",
+	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online",
 				hv_synic_init, hv_synic_cleanup);
 	if (ret < 0)
 		goto err_alloc;
@@ -1717,7 +1716,7 @@ static int __init hv_acpi_init(void)
 {
 	int ret, t;
 
-	if (x86_hyper != &x86_hyper_ms_hyperv)
+	if (!hv_is_hyperv_initialized())
 		return -ENODEV;
 
 	init_completion(&probe_event);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local
  2017-11-14 17:51 [PATCH 0/2] Drivers: hv: vmbbus: Miscellaneous cleanup kys
  2017-11-14 17:52 ` [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers kys
@ 2017-11-14 17:52 ` kys
  2017-11-28 15:34   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: kys @ 2017-11-14 17:52 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin
  Cc: Stephen Hemminger, K. Y. Srinivasan

From: Stephen Hemminger <stephen@networkplumber.org>

hv_get_ringbuffer_availbytes is only used by the debug info
routine so make it static. Also, add READ_ONCE() to avoid any
possible issues with potentially volatile index values.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/ring_buffer.c |   23 +++++++++++++++++++++++
 include/linux/hyperv.h   |   22 ----------------------
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 12eb8ca..50e0714 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -140,6 +140,29 @@ static u32 hv_copyto_ringbuffer(
 	return start_write_offset;
 }
 
+/*
+ *
+ * hv_get_ringbuffer_availbytes()
+ *
+ * Get number of bytes available to read and to write to
+ * for the specified ring buffer
+ */
+static void
+hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
+			     u32 *read, u32 *write)
+{
+	u32 read_loc, write_loc, dsize;
+
+	/* Capture the read/write indices before they changed */
+	read_loc = READ_ONCE(rbi->ring_buffer->read_index);
+	write_loc = READ_ONCE(rbi->ring_buffer->write_index);
+	dsize = rbi->ring_datasize;
+
+	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
+		read_loc - write_loc;
+	*read = dsize - *write;
+}
+
 /* Get various debug metrics for the specified ring buffer. */
 void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
 				 struct hv_ring_buffer_debug_info *debug_info)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 6c93366..93bd6fc 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -127,28 +127,6 @@ struct hv_ring_buffer_info {
 	u32 priv_read_index;
 };
 
-/*
- *
- * hv_get_ringbuffer_availbytes()
- *
- * Get number of bytes available to read and to write to
- * for the specified ring buffer
- */
-static inline void
-hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
-			     u32 *read, u32 *write)
-{
-	u32 read_loc, write_loc, dsize;
-
-	/* Capture the read/write indices before they changed */
-	read_loc = rbi->ring_buffer->read_index;
-	write_loc = rbi->ring_buffer->write_index;
-	dsize = rbi->ring_datasize;
-
-	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
-		read_loc - write_loc;
-	*read = dsize - *write;
-}
 
 static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
 {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers
  2017-11-14 17:52 ` [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers kys
@ 2017-11-28 15:33   ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2017-11-28 15:33 UTC (permalink / raw)
  To: kys
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin, Michael Kelley

On Tue, Nov 14, 2017 at 10:52:07AM -0700, kys@exchange.microsoft.com wrote:
> From: Michael Kelley <mikelley@microsoft.com>
> 
> hv_is_hypercall_page_setup() is used to check if Hyper-V is
> initialized, but a 'hypercall page' is an x86 implementation detail
> that isn't necessarily present on other architectures. Rename to the
> architecture independent hv_is_hyperv_initialized() and add check
> that x86_hyper is pointing to Hyper-V.  Use this function instead of
> direct references to x86-specific data structures in vmbus_drv.c,
> and remove now redundant call in hv_init(). Also remove 'x86' from
> the string name passed to cpuhp_setup_state().
> 
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  arch/x86/hyperv/hv_init.c       |   21 ++++++++++++++-------
>  arch/x86/include/asm/mshyperv.h |    4 ++--
>  drivers/hv/hv.c                 |    3 ---
>  drivers/hv/vmbus_drv.c          |    5 ++---
>  4 files changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index aeb8edf..e5372c9 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -239,17 +239,24 @@ void hyperv_report_panic(struct pt_regs *regs, long err)
>  }
>  EXPORT_SYMBOL_GPL(hyperv_report_panic);
>  
> -bool hv_is_hypercall_page_setup(void)
> +bool hv_is_hyperv_initialized(void)
>  {
>  	union hv_x64_msr_hypercall_contents hypercall_msr;
>  
> -	/* Check if the hypercall page is setup */
> +	/*
> +	 * Ensure that we're really on Hyper-V, and not a KVM or Xen
> +	 * emulation of Hyper-V
> +	 */
> +	if (x86_hyper != &x86_hyper_ms_hyperv)
> +		return false;
> +
> +	/*
> +	 * Verify that earlier initialization succeeded by checking
> +	 * that the hypercall page is setup
> +	 */
>  	hypercall_msr.as_uint64 = 0;
>  	rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
>  
> -	if (!hypercall_msr.enable)
> -		return false;
> -
> -	return true;
> +	return hypercall_msr.enable;
>  }
> -EXPORT_SYMBOL_GPL(hv_is_hypercall_page_setup);
> +EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized);
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index bd89104..740dc97 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -311,11 +311,11 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
>  void hyperv_setup_mmu_ops(void);
>  void hyper_alloc_mmu(void);
>  void hyperv_report_panic(struct pt_regs *regs, long err);
> -bool hv_is_hypercall_page_setup(void);
> +bool hv_is_hyperv_initialized(void);
>  void hyperv_cleanup(void);
>  #else /* CONFIG_HYPERV */
>  static inline void hyperv_init(void) {}
> -static inline bool hv_is_hypercall_page_setup(void) { return false; }
> +static inline bool hv_is_hyperv_initialized(void) { return false; }
>  static inline void hyperv_cleanup(void) {}
>  static inline void hyperv_setup_mmu_ops(void) {}
>  #endif /* CONFIG_HYPERV */
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 8267439..fe96aab 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -49,9 +49,6 @@ struct hv_context hv_context = {
>   */
>  int hv_init(void)
>  {
> -	if (!hv_is_hypercall_page_setup())
> -		return -ENOTSUPP;
> -
>  	hv_context.cpu_context = alloc_percpu(struct hv_per_cpu_context);
>  	if (!hv_context.cpu_context)
>  		return -ENOMEM;
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 4f3faf5..398643b 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -37,7 +37,6 @@
>  #include <linux/sched/task_stack.h>
>  
>  #include <asm/hyperv.h>
> -#include <asm/hypervisor.h>
>  #include <asm/mshyperv.h>
>  #include <linux/notifier.h>
>  #include <linux/ptrace.h>
> @@ -1053,7 +1052,7 @@ static int vmbus_bus_init(void)
>  	 * Initialize the per-cpu interrupt state and
>  	 * connect to the host.
>  	 */
> -	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/hyperv:online",
> +	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online",
>  				hv_synic_init, hv_synic_cleanup);
>  	if (ret < 0)
>  		goto err_alloc;
> @@ -1717,7 +1716,7 @@ static int __init hv_acpi_init(void)
>  {
>  	int ret, t;
>  
> -	if (x86_hyper != &x86_hyper_ms_hyperv)
> +	if (!hv_is_hyperv_initialized())
>  		return -ENODEV;
>  
>  	init_completion(&probe_event);
> -- 
> 1.7.1


Does not apply to 4.15-rc1 :(

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local
  2017-11-14 17:52 ` [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local kys
@ 2017-11-28 15:34   ` Greg KH
  2017-11-28 15:58     ` KY Srinivasan
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2017-11-28 15:34 UTC (permalink / raw)
  To: kys
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, sthemmin, Stephen Hemminger

On Tue, Nov 14, 2017 at 10:52:08AM -0700, kys@exchange.microsoft.com wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
> 
> hv_get_ringbuffer_availbytes is only used by the debug info
> routine so make it static. Also, add READ_ONCE() to avoid any
> possible issues with potentially volatile index values.
> 
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/hv/ring_buffer.c |   23 +++++++++++++++++++++++
>  include/linux/hyperv.h   |   22 ----------------------
>  2 files changed, 23 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> index 12eb8ca..50e0714 100644
> --- a/drivers/hv/ring_buffer.c
> +++ b/drivers/hv/ring_buffer.c
> @@ -140,6 +140,29 @@ static u32 hv_copyto_ringbuffer(
>  	return start_write_offset;
>  }
>  
> +/*
> + *
> + * hv_get_ringbuffer_availbytes()
> + *
> + * Get number of bytes available to read and to write to
> + * for the specified ring buffer
> + */
> +static void
> +hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
> +			     u32 *read, u32 *write)
> +{
> +	u32 read_loc, write_loc, dsize;
> +
> +	/* Capture the read/write indices before they changed */
> +	read_loc = READ_ONCE(rbi->ring_buffer->read_index);
> +	write_loc = READ_ONCE(rbi->ring_buffer->write_index);
> +	dsize = rbi->ring_datasize;
> +
> +	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
> +		read_loc - write_loc;
> +	*read = dsize - *write;
> +}
> +
>  /* Get various debug metrics for the specified ring buffer. */
>  void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
>  				 struct hv_ring_buffer_debug_info *debug_info)
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> index 6c93366..93bd6fc 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -127,28 +127,6 @@ struct hv_ring_buffer_info {
>  	u32 priv_read_index;
>  };
>  
> -/*
> - *
> - * hv_get_ringbuffer_availbytes()
> - *
> - * Get number of bytes available to read and to write to
> - * for the specified ring buffer
> - */
> -static inline void
> -hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
> -			     u32 *read, u32 *write)
> -{
> -	u32 read_loc, write_loc, dsize;
> -
> -	/* Capture the read/write indices before they changed */
> -	read_loc = rbi->ring_buffer->read_index;
> -	write_loc = rbi->ring_buffer->write_index;
> -	dsize = rbi->ring_datasize;
> -
> -	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
> -		read_loc - write_loc;
> -	*read = dsize - *write;
> -}
>  
>  static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
>  {
> -- 
> 1.7.1

This breaks the build.

Please be more careful...

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local
  2017-11-28 15:34   ` Greg KH
@ 2017-11-28 15:58     ` KY Srinivasan
  2017-11-28 16:32       ` Stephen Hemminger
  0 siblings, 1 reply; 7+ messages in thread
From: KY Srinivasan @ 2017-11-28 15:58 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, Stephen Hemminger,
	Stephen Hemminger



> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Tuesday, November 28, 2017 7:35 AM
> To: KY Srinivasan <kys@microsoft.com>
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; vkuznets@redhat.com;
> jasowang@redhat.com; leann.ogasawara@canonical.com;
> marcelo.cerri@canonical.com; Stephen Hemminger
> <sthemmin@microsoft.com>; Stephen Hemminger
> <stephen@networkplumber.org>
> Subject: Re: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local
> 
> On Tue, Nov 14, 2017 at 10:52:08AM -0700, kys@exchange.microsoft.com
> wrote:
> > From: Stephen Hemminger <stephen@networkplumber.org>
> >
> > hv_get_ringbuffer_availbytes is only used by the debug info
> > routine so make it static. Also, add READ_ONCE() to avoid any
> > possible issues with potentially volatile index values.
> >
> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  drivers/hv/ring_buffer.c |   23 +++++++++++++++++++++++
> >  include/linux/hyperv.h   |   22 ----------------------
> >  2 files changed, 23 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> > index 12eb8ca..50e0714 100644
> > --- a/drivers/hv/ring_buffer.c
> > +++ b/drivers/hv/ring_buffer.c
> > @@ -140,6 +140,29 @@ static u32 hv_copyto_ringbuffer(
> >  	return start_write_offset;
> >  }
> >
> > +/*
> > + *
> > + * hv_get_ringbuffer_availbytes()
> > + *
> > + * Get number of bytes available to read and to write to
> > + * for the specified ring buffer
> > + */
> > +static void
> > +hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
> > +			     u32 *read, u32 *write)
> > +{
> > +	u32 read_loc, write_loc, dsize;
> > +
> > +	/* Capture the read/write indices before they changed */
> > +	read_loc = READ_ONCE(rbi->ring_buffer->read_index);
> > +	write_loc = READ_ONCE(rbi->ring_buffer->write_index);
> > +	dsize = rbi->ring_datasize;
> > +
> > +	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
> > +		read_loc - write_loc;
> > +	*read = dsize - *write;
> > +}
> > +
> >  /* Get various debug metrics for the specified ring buffer. */
> >  void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info
> *ring_info,
> >  				 struct hv_ring_buffer_debug_info
> *debug_info)
> > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> > index 6c93366..93bd6fc 100644
> > --- a/include/linux/hyperv.h
> > +++ b/include/linux/hyperv.h
> > @@ -127,28 +127,6 @@ struct hv_ring_buffer_info {
> >  	u32 priv_read_index;
> >  };
> >
> > -/*
> > - *
> > - * hv_get_ringbuffer_availbytes()
> > - *
> > - * Get number of bytes available to read and to write to
> > - * for the specified ring buffer
> > - */
> > -static inline void
> > -hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
> > -			     u32 *read, u32 *write)
> > -{
> > -	u32 read_loc, write_loc, dsize;
> > -
> > -	/* Capture the read/write indices before they changed */
> > -	read_loc = rbi->ring_buffer->read_index;
> > -	write_loc = rbi->ring_buffer->write_index;
> > -	dsize = rbi->ring_datasize;
> > -
> > -	*write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
> > -		read_loc - write_loc;
> > -	*read = dsize - *write;
> > -}
> >
> >  static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info
> *rbi)
> >  {
> > --
> > 1.7.1
> 
> This breaks the build.
> 
> Please be more careful...

Sorry about that. I did not have a build issue on the tree I tested. I will rebase and send.

K. Y
> 
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local
  2017-11-28 15:58     ` KY Srinivasan
@ 2017-11-28 16:32       ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2017-11-28 16:32 UTC (permalink / raw)
  To: KY Srinivasan, Greg KH
  Cc: linux-kernel, devel, olaf, apw, vkuznets, jasowang,
	leann.ogasawara, marcelo.cerri, Stephen Hemminger

This patch required a patch that is still going through net-next.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-28 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 17:51 [PATCH 0/2] Drivers: hv: vmbbus: Miscellaneous cleanup kys
2017-11-14 17:52 ` [PATCH 1/2] Drivers: hv: vmbus: Remove x86-isms from arch independent drivers kys
2017-11-28 15:33   ` Greg KH
2017-11-14 17:52 ` [PATCH 2/2] vmbus: make hv_get_ringbuffer_availbytes local kys
2017-11-28 15:34   ` Greg KH
2017-11-28 15:58     ` KY Srinivasan
2017-11-28 16:32       ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).