From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi3DD-0000Cs-Vc for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:34:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi3DA-0006G3-Al for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:34:06 -0400 Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]:34558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi3DA-0006Fz-6L for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:34:04 -0400 Received: by mail-yw0-x243.google.com with SMTP id j1so2123176ywb.1 for ; Thu, 08 Sep 2016 10:34:04 -0700 (PDT) Sender: Richard Henderson References: <1470929064-4092-1-git-send-email-alex.bennee@linaro.org> <1470929064-4092-28-git-send-email-alex.bennee@linaro.org> From: Richard Henderson Message-ID: <9a40b368-e61c-01a8-99b3-9289763da9fe@twiddle.net> Date: Thu, 8 Sep 2016 10:34:00 -0700 MIME-Version: 1.0 In-Reply-To: <1470929064-4092-28-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v4 27/28] cputlb: make tlb_reset_dirty safe for MTTCG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , mttcg@greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Cc: peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite , jan.kiszka@siemens.com, mark.burton@greensocs.com, serge.fdrv@gmail.com, pbonzini@redhat.com On 08/11/2016 08:24 AM, Alex Bennée wrote: > The main use case for tlb_reset_dirty is to set the TLB_NOTDIRTY flags > in TLB entries to force the slow-path on writes. This is used to mark > page ranges containing code which has been translated so it can be > invalidated if written to. To do this safely we need to ensure the TLB > entries in question for all vCPUs are updated before we attempt to run > the code otherwise a race could be introduced. > > To achieve this we atomically set the flag in tlb_reset_dirty_range and > take care when setting it when the TLB entry is filled. > > The helper function is made static as it isn't used outside of cputlb. > > Signed-off-by: Alex Bennée > --- > cputlb.c | 55 +++++++++++++++++++++++++++++++++++---------------- > include/exec/cputlb.h | 2 -- > 2 files changed, 38 insertions(+), 19 deletions(-) Reviewed-by: Richard Henderson r~