From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751309AbdARWu1 convert rfc822-to-8bit (ORCPT ); Wed, 18 Jan 2017 17:50:27 -0500 Received: from userp1050.oracle.com ([156.151.31.82]:40397 "EHLO userp1050.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbdARWu0 (ORCPT ); Wed, 18 Jan 2017 17:50:26 -0500 Subject: Re: [PATCH v2 3/3] xen: optimize xenbus driver for multiple concurrent xenstore accesses To: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <20170116141533.8946-1-jgross@suse.com> <20170116141533.8946-4-jgross@suse.com> From: Boris Ostrovsky Message-ID: Date: Wed, 18 Jan 2017 15:14:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170116141533.8946-4-jgross@suse.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8BIT X-Source-IP: userp1040.oracle.com [156.151.31.81] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/16/2017 09:15 AM, Juergen Gross wrote: > + > +static uint32_t xs_request_enter(struct xb_req_data *req) > +{ > + uint32_t rq_id; > + > + req->type = req->msg.type; > + > + spin_lock(&xs_state_lock); > + for (;;) { > + if (req->msg.tx_id != 0) > + break; > + if (xs_suspend_active) { > + spin_unlock(&xs_state_lock); > + wait_event(xs_state_enter_wq, xs_suspend_active == 0); > + spin_lock(&xs_state_lock); > + continue; > + } > + if (req->type == XS_TRANSACTION_START) > + xs_state_users++; > + break; > + } > + xs_state_users++; > + rq_id = xs_request_id++; > + spin_unlock(&xs_state_lock); > + > + return rq_id; > +} I should have noticed this last time but I've been looking at this code again and I don't think I understand why you are incrementing count for XS_TRANSACTION_START inside the loop. In fact, why not just 'while(xs_suspend_active) {}' loop? -boris