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.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 1174DC433E1 for ; Tue, 9 Jun 2020 09:48:57 +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 D460C20812 for ; Tue, 9 Jun 2020 09:48:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a5x7gf+r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D460C20812 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 1jias5-0003Gs-8F; Tue, 09 Jun 2020 09:48:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jias3-0003Gm-I3 for xen-devel@lists.xenproject.org; Tue, 09 Jun 2020 09:48:39 +0000 X-Inumbo-ID: 64c93976-aa36-11ea-bb8b-bc764e2007e4 Received: from mail-wr1-x42c.google.com (unknown [2a00:1450:4864:20::42c]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 64c93976-aa36-11ea-bb8b-bc764e2007e4; Tue, 09 Jun 2020 09:48:38 +0000 (UTC) Received: by mail-wr1-x42c.google.com with SMTP id q11so20566612wrp.3 for ; Tue, 09 Jun 2020 02:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=qH71riF6UY44PzwH7v4sc6MNHeLQWvJcZsyR+nDZOO0=; b=a5x7gf+r6s+3csOk/6scB9zRxic1oThNw4BDRZ8xzYvs3JFFO75XfX5WTTe7j12H8e vogh5SetXTULNqVvIMvkmU7V6cp6U0nEfyh3OfwM/mOjaWkXwPujRhD5ZyzjAf5zKKmF GHN4iTjJ0WWSaXVrVhe8ENwoUTQQhiHMiAW1youGEgNYz6F92hnVtFrZ7ddiO2/iv8ln 40PeC9sJOEeqTFLf18DqGiypx9ExL87bNMPDKsV8IziAWhQU9O2kQEXwHY/F3vI5qDex wiNTV/iwJn6oPsPGPWAS0VZOEsrmLGIGEfIJkOKgOVGoowfk6D66P6IjqWvlhMaoOfUr YFPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :content-language:thread-index; bh=qH71riF6UY44PzwH7v4sc6MNHeLQWvJcZsyR+nDZOO0=; b=F7iJr06nnoDXsrHNkmCzsYLEvQovj5nbNFpGG2KGR9+6t3tV56oem4GoxJ/6B625Uc J1GPnUsaE+mziB0rNcCwjTMyFF+xCeWYVdzMveUCF5Ha5D2SzXVGQQ6zWsbU653rgaGB gB4geAnCYH9PQuW0HWCMWlijMNLKfexd8CJzlSx7f4Xtu7ePVVMhUxCDNzJyj7Pad031 v2G+QRw0o+DyXipKG+F3YlEyWjE3ClM9yfSDnNNYcDre/Y7OiyTseQD9VuDDSa1uspsC gyfmR8JpcPNlxkhz5bBgyx0NMcfAq2CzzuNXolE8jQJ+uF7tnPJ/vheerfJB7LW8BQ0p 4qsA== X-Gm-Message-State: AOAM530IAIOva3SFFYJMGhZXru0KW+/rK++YAoI2QsvOnpft+ahY8ttS 9LSqF5WLavpdsXSeG5FFOP0= X-Google-Smtp-Source: ABdhPJyXJwZeBfjygdsVH/to0pOIFKrHh9NSVRlx6z0f+M1rXGqd1/eyI66FcY+SZGtR1p7RxjBnEQ== X-Received: by 2002:adf:91c2:: with SMTP id 60mr3689399wri.41.1591696118013; Tue, 09 Jun 2020 02:48:38 -0700 (PDT) Received: from CBGR90WXYV0 ([54.239.6.186]) by smtp.gmail.com with ESMTPSA id 125sm2427590wmc.23.2020.06.09.02.48.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2020 02:48:37 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: "'Jan Beulich'" , "'Tamas K Lengyel'" References: <20200603125237.100041-1-tamas@tklengyel.com> <64ea771f-a7c1-cfc1-e135-632ec4c7fc93@suse.com> In-Reply-To: <64ea771f-a7c1-cfc1-e135-632ec4c7fc93@suse.com> Subject: RE: [PATCH v4 for-4.14] x86/monitor: revert default behavior when monitoring register write events Date: Tue, 9 Jun 2020 10:48:35 +0100 Message-ID: <006f01d63e43$25e98440$71bc8cc0$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQHMIvrjc9D1klp/MRCvYm/ZI0jSTQG6VnbhqNZtXKA= 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: , Reply-To: paul@xen.org Cc: 'Petre Pircalabu' , 'Stefano Stabellini' , 'Julien Grall' , 'Wei Liu' , 'Andrew Cooper' , 'Ian Jackson' , 'George Dunlap' , 'Alexandru Isaila' , xen-devel@lists.xenproject.org, =?utf-8?Q?'Roger_Pau_Monn=C3=A9'?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Jan Beulich > Sent: 09 June 2020 10:37 > To: Tamas K Lengyel > Cc: xen-devel@lists.xenproject.org; Andrew Cooper = ; Wei Liu ; > Roger Pau Monn=C3=A9 ; George Dunlap = ; Ian Jackson > ; Julien Grall ; Stefano = Stabellini > ; Alexandru Isaila ; = Petre Pircalabu > ; Paul Durrant > Subject: Re: [PATCH v4 for-4.14] x86/monitor: revert default behavior = when monitoring register write > events >=20 > On 03.06.2020 14:52, 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 >=20 > Applicable parts > Acked-by: Jan Beulich >=20 Release-acked-by: Paul Durrant