From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v2 08/14] KVM: x86: remove notifiers from PIT discard policy Date: Fri, 19 Feb 2016 16:09:34 +0100 Message-ID: <20160219150933.GB25910@potion.brq.redhat.com> References: <1455736496-374-1-git-send-email-rkrcmar@redhat.com> <1455736496-374-9-git-send-email-rkrcmar@redhat.com> <56C6088A.5080207@redhat.com> <20160219150434.GA25910@potion.brq.redhat.com> <56C72F62.5060307@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Yuki Shibuya To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1949248AbcBSPJh (ORCPT ); Fri, 19 Feb 2016 10:09:37 -0500 Content-Disposition: inline In-Reply-To: <56C72F62.5060307@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 2016-02-19 16:06+0100, Paolo Bonzini: > On 19/02/2016 16:04, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >>>> ... so in patch 7 concurrent _writes_ of reinject are protected by= the >>>> lock, but reads are done outside it (in pit_timer_fn). WDYT about >>>> making reinject an atomic_t? >> There was/is no harm in having reinject non-atomic. This patch adde= d >> notifiers, which is the reason for re-introducing a mutex. >>=20 >> Userspace can (and SHOULDN'T) call this function multiple times, >> concurrently, so the mutex prevents a situations where, e.g. only on= e >> notifier is registered in the end. >=20 > Yes, I understand why you added the mutex here; good catch indeed. T= he > atomic_t is just to show that it's okay to read it outside the lock. > It's just for a bit of extra documentation. Hm, good point. I will add it. Thanks.