Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8EF8C433DF for ; Wed, 3 Jun 2020 15:08:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B719E20738 for ; Wed, 3 Jun 2020 15:08:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B719E20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jgUzM-0007T5-6w; Wed, 03 Jun 2020 15:07:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jgUzL-0007T0-AL for xen-devel@lists.xenproject.org; Wed, 03 Jun 2020 15:07:31 +0000 X-Inumbo-ID: f18f2b52-a5ab-11ea-9947-bc764e2007e4 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f18f2b52-a5ab-11ea-9947-bc764e2007e4; Wed, 03 Jun 2020 15:07:30 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: /WgkDs/icnrRkxrfZ5EuDKaR7SvsXSddDbMaxvp4qdegV01Q6FsqD1EMTL1E0Vr9ftNRBzjE7J Zw6bIsqlRad+xFB959P+xnslb3FHqVgUeSA59fQ+GfFMjbHJfk9QS0spNVsCmjkvavwzxkVLam muX/9JsZs7FiwkPbIRpa9XKwVEGonQfH/pDUSP7zccolISm2o8DSh5M7vjybKk8+CZHXtS4GzH Hee0dRXPss9u7aJMIWcggEGiHL5z6qDdUwUiTUUq2tzs5BVX6mjTixpyWjC4SS54M/uqUkgtGu n4o= X-SBRS: 2.7 X-MesageID: 19425457 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,467,1583211600"; d="scan'208";a="19425457" Date: Wed, 3 Jun 2020 17:07:21 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Tamas K Lengyel Subject: Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events Message-ID: <20200603150721.GF1195@Air-de-Roger> References: <20200603125237.100041-1-tamas@tklengyel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200603125237.100041-1-tamas@tklengyel.com> X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Petre Pircalabu , Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Alexandru Isaila , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Wed, Jun 03, 2020 at 06:52:37AM -0600, Tamas K Lengyel wrote: > For the last couple years we have received numerous reports from users of > monitor vm_events of spurious guest crashes when using events. In particular, > it has observed that the problem occurs when vm_events are being disabled. The > nature of the guest crash varied widely and has only occured occasionally. This > made debugging the issue particularly hard. We had discussions about this issue > even here on the xen-devel mailinglist with no luck figuring it out. > > The bug has now been identified as a race-condition between register event > handling and disabling the monitor vm_event interface. The default behavior > regarding emulation of register write events is changed so that they get > postponed until the corresponding vm_event handler decides whether to allow such > write to take place. Unfortunately this can only be implemented by performing the > deny/allow step when the vCPU gets scheduled. > > Due to that postponed emulation of the event if the user decides to pause the > VM in the vm_event handler and then disable events, the entire emulation step > is skipped the next time the vCPU is resumed. Even if the user doesn't pause > during the vm_event handling but exits immediately and disables vm_event, the > situation becomes racey as disabling vm_event may succeed before the guest's > vCPUs get scheduled with the pending emulation task. This has been particularly > the case with VMS that have several vCPUs as after the VM is unpaused it may > actually take a long time before all vCPUs get scheduled. > > In this patch we are reverting the default behavior to always perform emulation > of register write events when the event occurs. To postpone them can be turned > on as an option. In that case the user of the interface still has to take care > of only disabling the interface when its safe as it remains buggy. > > Fixes: 96760e2fba10 ('vm_event: deny register writes if refused by vm_event > reply'). > > Signed-off-by: Tamas K Lengyel Thanks! Reviewed-by: Roger Pau Monné I would like to get some input from Bitdefender really, and whether they are fine with this approach.