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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 C33A0C3A5A0 for ; Mon, 20 Apr 2020 14:20:09 +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 9D17C20722 for ; Mon, 20 Apr 2020 14:20:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D17C20722 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.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.89) (envelope-from ) id 1jQXHB-0005Pf-Fz; Mon, 20 Apr 2020 14:19:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQXH9-0005PD-KD for xen-devel@lists.xenproject.org; Mon, 20 Apr 2020 14:19:55 +0000 X-Inumbo-ID: 0030ca42-8312-11ea-9e09-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0030ca42-8312-11ea-9e09-bc764e2007e4; Mon, 20 Apr 2020 14:19:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0BDA8ABD7; Mon, 20 Apr 2020 14:19:50 +0000 (UTC) Subject: Re: [PATCH v15 1/3] mem_sharing: don't reset vCPU info page during fork reset To: Tamas K Lengyel References: <20200420074516.GQ28601@Air-de-Roger> From: Jan Beulich Message-ID: <686dafe9-54f6-3224-d2ff-8cfb99734b2c@suse.com> Date: Mon, 20 Apr 2020 16:19:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Tamas K Lengyel , Wei Liu , Andrew Cooper , George Dunlap , Xen-devel , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 20.04.2020 16:15, Tamas K Lengyel wrote: > On Mon, Apr 20, 2020 at 1:45 AM Roger Pau Monné wrote: >> >> On Fri, Apr 17, 2020 at 10:06:31AM -0700, Tamas K Lengyel wrote: >>> When a forked VM is being reset while having vm_events active, re-copying the >>> vCPU info page can lead to events being lost. This seems to only affect a >>> subset of events (interrupts), while not others (cpuid, MTF, EPT) thus it was >> >> I'm slightly lost by the sentence, is the guest or the hypervisor >> the one losing events? >> >> Ie: interrupts are events from a guest PoV, but cpuid or EPT is not >> something that triggers events that are injected to the guest. I think >> the commit message needs clarification. > > Sorry, what I meant was software interrupts are not triggered anymore, > ie. int3 and it's associated event is not sent to the monitor > application (VM_EVENT_REASON_SOFTWARE_BREAKPOINT). > >> >>> not discovered beforehand. Only copying vCPU info page contents during initial >>> fork fixes the problem. >> >> Hm, I'm not sure I understand why this is causing issues. When you >> reset a fork you should reset the vcpu info page, or else event masks would >> be in a wrong state? > > When we reset a fork we only want to 1) discard any memory allocated > for it 2) reset the vCPU registers. We don't want to reset event > channels or anything else. We have active vm_events on the domain and > the whole point of doing a fork reset is to avoid having to > reinitialize all that as it's quite slow. So for an arbitrary piece of state, what are the criteria to establish whether to copy or re-init them during a fork? Is it really now and forever only memory that wants resetting? I have to admit I'm confused by you also mentioning CPU registers - aren't they to be copied rather than reset? Jan