From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1948640AbcBSPGP (ORCPT ); Fri, 19 Feb 2016 10:06:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34817 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1948016AbcBSPGN (ORCPT ); Fri, 19 Feb 2016 10:06:13 -0500 Subject: Re: [PATCH v2 08/14] KVM: x86: remove notifiers from PIT discard policy To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= 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> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Yuki Shibuya From: Paolo Bonzini Message-ID: <56C72F62.5060307@redhat.com> Date: Fri, 19 Feb 2016 16:06:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160219150434.GA25910@potion.brq.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/02/2016 16:04, Radim Krčmář 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 added > notifiers, which is the reason for re-introducing a mutex. > > Userspace can (and SHOULDN'T) call this function multiple times, > concurrently, so the mutex prevents a situations where, e.g. only one > notifier is registered in the end. Yes, I understand why you added the mutex here; good catch indeed. The 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. Paolo