From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAdvV-0001n9-HA for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:16:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAdvR-0005Bo-Gb for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:16:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAdvR-0005Be-AI for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:16:53 -0500 Message-ID: <54B3BB27.1040704@redhat.com> Date: Mon, 12 Jan 2015 13:16:39 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20150112115944.3504.66763.stgit@PASHA-ISP> <20150112120117.3504.54187.stgit@PASHA-ISP> In-Reply-To: <20150112120117.3504.54187.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v7 16/21] replay: bottom halves List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com On 12/01/2015 13:01, Pavel Dovgalyuk wrote: > - bh->next = ctx->first_bh; > - /* Make sure that the members are ready before putting bh into list */ > - smp_wmb(); > - ctx->first_bh = bh; > + if (replay_mode != REPLAY_MODE_NONE) { > + /* Slower way, but this is a queue and not a stack. > + Replay will process the BH in the same order they > + came into the queue. */ > + last = &ctx->first_bh; > + while (*last) { > + last = &(*last)->next; > + } > + smp_wmb(); > + *last = bh; > + } else { > + bh->next = ctx->first_bh; > + /* Make sure that the members are ready before putting bh into list */ > + smp_wmb(); > + ctx->first_bh = bh; > + } I am not sure I understand the reason for this, but feel free to change the list to a QSIMPLEQ, and introduce QSIMPLEQ_INSERT_TAIL_RCU that has the appropriate barriers. Paolo