From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 44A7FC433DB for ; Wed, 17 Feb 2021 08:32:59 +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 DD9A864E2E for ; Wed, 17 Feb 2021 08:32:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD9A864E2E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.86172.161501 (Exim 4.92) (envelope-from ) id 1lCIGM-0004WT-S5; Wed, 17 Feb 2021 08:32:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 86172.161501; Wed, 17 Feb 2021 08:32:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lCIGM-0004WM-Oy; Wed, 17 Feb 2021 08:32:46 +0000 Received: by outflank-mailman (input) for mailman id 86172; Wed, 17 Feb 2021 08:32:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lCIGL-0004WF-9t for xen-devel@lists.xenproject.org; Wed, 17 Feb 2021 08:32:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c3520f3e-9c25-49a3-a2a9-7d6541cc38b4; Wed, 17 Feb 2021 08:32:44 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C9768B03B; Wed, 17 Feb 2021 08:32:43 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c3520f3e-9c25-49a3-a2a9-7d6541cc38b4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613550763; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y1/G31dhI4NC4cwy4l2zlxtzFa6ohofSNDIQI8F53Pw=; b=s7GiXzDf+V2G28i/DNoOpz+/fHAFXBTq4LqFcn8GZVBxgwW15yo7T69b/NvTlJq+ictmwF 0jcFNJ5/cda49mAcpJFFzimyGxrgT87wZwSoUWnqyPrHgZSrWD51HNhoyztFC7+6AarTQF XeHaduEo8t2MoawFe7oDQWGxomWtUog= Subject: Ping: [PATCH] x86emul: de-duplicate scatters to the same linear address From: Jan Beulich To: Andrew Cooper Cc: Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , "xen-devel@lists.xenproject.org" References: <6064996d-943f-1be3-9bfd-e872149da2a1@suse.com> <2e559806-5bc0-0f61-8e23-95e0dba34c41@suse.com> Message-ID: Date: Wed, 17 Feb 2021 09:32:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <2e559806-5bc0-0f61-8e23-95e0dba34c41@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 05.02.2021 12:28, Jan Beulich wrote: > On 05.02.2021 11:41, Andrew Cooper wrote: >> On 10/11/2020 13:26, Jan Beulich wrote: >>> The SDM specifically allows for earlier writes to fully overlapping >>> ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access() >>> would crash it if varying data was written to the same address. Detect >>> overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would >>> be quite a bit more difficult. >> >> Are you saying that there is currently a bug if a guest does encode such >> an instruction, and we emulate it? > > That is my take on it, yes. > >>> Note that due to cache slot use being linear address based, there's no >>> similar issue with multiple writes to the same physical address (mapped >>> through different linear addresses). >>> >>> Since this requires an adjustment to the EVEX Disp8 scaling test, >>> correct a comment there at the same time. >>> >>> Signed-off-by: Jan Beulich >>> --- >>> TBD: The SDM isn't entirely unambiguous about the faulting behavior in >>> this case: If a fault would need delivering on the earlier slot >>> despite the write getting squashed, we'd have to call ops->write() >>> with size set to zero for the earlier write(s). However, >>> hvm/emulate.c's handling of zero-byte accesses extends only to the >>> virtual-to-linear address conversions (and raising of involved >>> faults), so in order to also observe #PF changes to that logic >>> would then also be needed. Can we live with a possible misbehavior >>> here? >> >> Do you have a chapter/section reference? > > The instruction pages. They say in particular > > "If two or more destination indices completely overlap, the “earlier” > write(s) may be skipped." > > and > > "Faults are delivered in a right-to-left manner. That is, if a fault > is triggered by an element and delivered ..." > > To me this may or may not mean the skipping of indices includes the > skipping of faults (which a later element then would raise anyway). Does the above address your concerns / questions? If not, what else do I need to provide? Jan