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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 AF16BC43603 for ; Wed, 18 Dec 2019 15:30:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75ACF206CB for ; Wed, 18 Dec 2019 15:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576683027; bh=VoDZA28QIA8ZuEkr4fUTI8rp1iZfr1x38wiooqnNZsw=; h=To:Subject:Date:From:Cc:In-Reply-To:References:List-ID:From; b=fFUNO5SGZYq5HJmF3kC7RFzuOB7LvqWnTx5q0OEZaAY8DM1crpCaz7HAN1OzxQXyw 50ivjEZJ3UqrxLXfFVoaVVFLn7JAHf7cGyfbr4heGff/papQZ2tTepIju6DqRtqezr P5LlQoDrMQ+5f9TwUSMZDA35AtSc1r5qa8GGAlpk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbfLRPa1 (ORCPT ); Wed, 18 Dec 2019 10:30:27 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:35235 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbfLRPa1 (ORCPT ); Wed, 18 Dec 2019 10:30:27 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ihbH2-0003tk-7u; Wed, 18 Dec 2019 16:30:04 +0100 To: James Morse Subject: Re: [PATCH 7/7] KVM: arm/arm64: Elide CMOs when unmapping a range X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 18 Dec 2019 15:30:04 +0000 From: Marc Zyngier Cc: Julien Thierry , Suzuki K Poulose , James Hogan , Paul Mackerras , Paolo Bonzini , =?UTF-8?Q?Ra?= =?UTF-8?Q?dim_Kr=C4=8Dm=C3=A1=C5=99?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , , , , , In-Reply-To: <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> References: <20191213182503.14460-1-maz@kernel.org> <20191213182503.14460-8-maz@kernel.org> <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, jhogan@kernel.org, paulus@ozlabs.org, pbonzini@redhat.com, rkrcmar@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Hi James, On 2019-12-18 15:07, James Morse wrote: > Hi Marc, > > On 13/12/2019 18:25, Marc Zyngier wrote: >> If userspace issues a munmap() on a set of pages, there is no >> expectation that the pages are cleaned to the PoC. > > (Pedantry: Clean and invalidate. If the guest wrote through a device > mapping, we ditch any clean+stale lines with this path, meaning > swapout > saves the correct values) Indeed. >> So let's >> not do more work than strictly necessary, and set the magic >> flag that avoids CMOs in this case. > > I think this assumes the pages went from anonymous->free, so no-one > cares about the contents. > > If the pages are backed by a file, won't dirty pages will still get > written back before the page is free? (e.g. EFI flash 'file' mmap()ed > in) I believe so. Is that a problem? > What if this isn't the only mapping of the page? Can't it be swapped > out from another VMA? (tenuous example, poor man's memory mirroring?) Swap-out wouldn't trigger this code path, as it would use a different MMU notifier event (MMU_NOTIFY_CLEAR vs MMU_NOTIFY_UNMAP), I believe. Thanks, M. -- Jazz is not dead. It just smells funny... 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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, 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 797EFC43603 for ; Wed, 18 Dec 2019 15:30:29 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 0A782206CB for ; Wed, 18 Dec 2019 15:30:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A782206CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 76C804A65C; Wed, 18 Dec 2019 10:30:28 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VbU87L7SFQxt; Wed, 18 Dec 2019 10:30:27 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 846144A4CD; Wed, 18 Dec 2019 10:30:27 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5CDCC4A4CD for ; Wed, 18 Dec 2019 10:30:26 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vcq-s0rlBiST for ; Wed, 18 Dec 2019 10:30:25 -0500 (EST) Received: from inca-roads.misterjones.org (inca-roads.misterjones.org [213.251.177.50]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 468884A483 for ; Wed, 18 Dec 2019 10:30:25 -0500 (EST) Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ihbH2-0003tk-7u; Wed, 18 Dec 2019 16:30:04 +0100 To: James Morse Subject: Re: [PATCH 7/7] KVM: arm/arm64: Elide CMOs when unmapping a range X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Date: Wed, 18 Dec 2019 15:30:04 +0000 From: Marc Zyngier In-Reply-To: <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> References: <20191213182503.14460-1-maz@kernel.org> <20191213182503.14460-8-maz@kernel.org> <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, jhogan@kernel.org, paulus@ozlabs.org, pbonzini@redhat.com, rkrcmar@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Cc: kvm-ppc@vger.kernel.org, Wanpeng Li , kvm@vger.kernel.org, James Hogan , Joerg Roedel , linux-mips@vger.kernel.org, Sean Christopherson , Paul Mackerras , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , Vitaly Kuznetsov , kvmarm@lists.cs.columbia.edu, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi James, On 2019-12-18 15:07, James Morse wrote: > Hi Marc, > > On 13/12/2019 18:25, Marc Zyngier wrote: >> If userspace issues a munmap() on a set of pages, there is no >> expectation that the pages are cleaned to the PoC. > > (Pedantry: Clean and invalidate. If the guest wrote through a device > mapping, we ditch any clean+stale lines with this path, meaning > swapout > saves the correct values) Indeed. >> So let's >> not do more work than strictly necessary, and set the magic >> flag that avoids CMOs in this case. > > I think this assumes the pages went from anonymous->free, so no-one > cares about the contents. > > If the pages are backed by a file, won't dirty pages will still get > written back before the page is free? (e.g. EFI flash 'file' mmap()ed > in) I believe so. Is that a problem? > What if this isn't the only mapping of the page? Can't it be swapped > out from another VMA? (tenuous example, poor man's memory mirroring?) Swap-out wouldn't trigger this code path, as it would use a different MMU notifier event (MMU_NOTIFY_CLEAR vs MMU_NOTIFY_UNMAP), I believe. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 79404C43603 for ; Wed, 18 Dec 2019 15:30:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3EAE7206CB for ; Wed, 18 Dec 2019 15:30:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qWx+G/bF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EAE7206CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:From:Date: MIME-Version:Subject:To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=atc5DbzXCpCqy/WS/H+sTp5htc0Ug2y4IoAOZYMGdqY=; b=qWx+G/bFQJaT8zUjduRbN/jDp 60vVvSGxK06b2sWyyYHhROK0CX45wZD5QtO6aTOAoH4ylAsCltfOGts/4YU4qvwXu7KyjsB6U1FdS sRsRtA6bQgv4ZqeYE7LDXb9BoZoHVilpfHHn85oufD/t5tCny2t+KX0tTWim7xnI1dwsrz57AdKBS YvrskYN3tT/dQrDLHGH5QryF/urm3G5q5ZoY7Dvc7CmkBaXwJfcUEinerPnkL2pmVquelD55+LyIf z66+IdHSNe99XHEg0dohoqu9LQv7zWSNRY2tvbBWEkQl7NsGDo7C1kcUSNKiwYl+nuDO3MLvYosg8 8u/qUEWKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ihbHN-00015A-H4; Wed, 18 Dec 2019 15:30:25 +0000 Received: from inca-roads.misterjones.org ([213.251.177.50]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ihbHK-00014c-RX for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2019 15:30:24 +0000 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ihbH2-0003tk-7u; Wed, 18 Dec 2019 16:30:04 +0100 To: James Morse Subject: Re: [PATCH 7/7] KVM: arm/arm64: Elide CMOs when unmapping a range X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Date: Wed, 18 Dec 2019 15:30:04 +0000 From: Marc Zyngier In-Reply-To: <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> References: <20191213182503.14460-1-maz@kernel.org> <20191213182503.14460-8-maz@kernel.org> <0c832b27-7041-a6c8-31c0-d71a25c6f5b8@arm.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, jhogan@kernel.org, paulus@ozlabs.org, pbonzini@redhat.com, rkrcmar@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191218_073023_038316_93D2DCE3 X-CRM114-Status: GOOD ( 10.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm-ppc@vger.kernel.org, Wanpeng Li , kvm@vger.kernel.org, =?UTF-8?Q?Ra?= =?UTF-8?Q?dim_Kr=C4=8Dm=C3=A1=C5=99?= , James Hogan , Joerg Roedel , Suzuki K Poulose , linux-mips@vger.kernel.org, Sean Christopherson , Paul Mackerras , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , Vitaly Kuznetsov , kvmarm@lists.cs.columbia.edu, Julien Thierry , Jim Mattson Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi James, On 2019-12-18 15:07, James Morse wrote: > Hi Marc, > > On 13/12/2019 18:25, Marc Zyngier wrote: >> If userspace issues a munmap() on a set of pages, there is no >> expectation that the pages are cleaned to the PoC. > > (Pedantry: Clean and invalidate. If the guest wrote through a device > mapping, we ditch any clean+stale lines with this path, meaning > swapout > saves the correct values) Indeed. >> So let's >> not do more work than strictly necessary, and set the magic >> flag that avoids CMOs in this case. > > I think this assumes the pages went from anonymous->free, so no-one > cares about the contents. > > If the pages are backed by a file, won't dirty pages will still get > written back before the page is free? (e.g. EFI flash 'file' mmap()ed > in) I believe so. Is that a problem? > What if this isn't the only mapping of the page? Can't it be swapped > out from another VMA? (tenuous example, poor man's memory mirroring?) Swap-out wouldn't trigger this code path, as it would use a different MMU notifier event (MMU_NOTIFY_CLEAR vs MMU_NOTIFY_UNMAP), I believe. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel