From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751047AbdAXQI1 (ORCPT ); Tue, 24 Jan 2017 11:08:27 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33165 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbdAXQI0 (ORCPT ); Tue, 24 Jan 2017 11:08:26 -0500 Date: Tue, 24 Jan 2017 08:08:18 -0800 From: Stephen Hemminger To: Dexuan Cui Cc: "gregkh@linuxfoundation.org" , "driverdev-devel@linuxdriverproject.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "olaf@aepfle.de" , Rolf Neugebauer , "jasowang@redhat.com" , "linux-kernel@vger.kernel.org" , "apw@canonical.com" Subject: Re: [PATCH] Drivers: hv: vmbus: finally fix hv_need_to_signal_on_read() Message-ID: <20170124080818.48c26a6c@xeon-e3> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Jan 2017 06:54:46 +0000 Dexuan Cui wrote: > +static inline void > +init_cached_read_index(struct vmbus_channel *channel) > +{ > + struct hv_ring_buffer_info *rbi = &channel->inbound; > + > + rbi->cached_read_index = rbi->ring_buffer->read_index; > +} Looks good thanks. This should go in right away. Which versions are impacted? Should it also go to stable? In a future patch, the API function names for interacting with the ring buffer should be changed to all have common prefix (hv_) and maybe do a little rethinking about what needs to be in ring buffer and what could be local variables. For example, the cached_read_index is only useful over the span of the loop reading from the ring buffer. For me, it would be cleaner with a ring_buffer iterator object which could abstract the API better. struct vmbus_ringbuffer_iter iter; vmbus_begin_read(&iter, channel); while ((desc = vmbus_next_read(&iter), channel) { ... } vmbus_end_read(&iter, channel);