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,URIBL_BLOCKED,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 21CFDC433E0 for ; Fri, 19 Jun 2020 12:40:00 +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 F3ACC207E8 for ; Fri, 19 Jun 2020 12:39:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3ACC207E8 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.92) (envelope-from ) id 1jmGJC-00049e-29; Fri, 19 Jun 2020 12:39:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jmGJA-00049W-FZ for xen-devel@lists.xenproject.org; Fri, 19 Jun 2020 12:39:48 +0000 X-Inumbo-ID: f5c21538-b229-11ea-bca7-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f5c21538-b229-11ea-bca7-bc764e2007e4; Fri, 19 Jun 2020 12:39:48 +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 EAF48ACA3; Fri, 19 Jun 2020 12:39:45 +0000 (UTC) Subject: Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays To: =?UTF-8?Q?Micha=c5=82_Leszczy=c5=84ski?= References: <122238637.9820857.1592523264685.JavaMail.zimbra@cert.pl> <1060400786.9820894.1592523480084.JavaMail.zimbra@cert.pl> <20200619113434.GZ735@Air-de-Roger> <1494219989.10184041.1592570120971.JavaMail.zimbra@cert.pl> From: Jan Beulich Message-ID: <4cbf963d-7cf0-3fdb-b456-db2845244dec@suse.com> Date: Fri, 19 Jun 2020 14:39:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <1494219989.10184041.1592570120971.JavaMail.zimbra@cert.pl> 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.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , "Kang, Luwei" , Tamas K Lengyel , Xen-devel , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 19.06.2020 14:35, Michał Leszczyński wrote: > ----- 19 cze 2020 o 13:34, Roger Pau Monné roger.pau@citrix.com napisał(a): > >> On Fri, Jun 19, 2020 at 01:38:00AM +0200, Michał Leszczyński wrote: >>> Replace on-stack array allocation with heap allocation >>> in order to lift the limit of 32 items in mfn/gfn arrays >>> when calling acquire_resource. >> >> I'm afraid this is not correct, you cannot allow unbounded amounts of >> items to be processed like this, it's likely that you manage to >> trigger the watchdog if the list is long enough, specially when doing >> set_foreign_p2m_entry. >> >> You need to process the items in batches (32 was IMO a good start), and >> then add support for hypercall continuations. Take a look at how >> XENMEM_populate_physmap just a couple of lines below makes use of >> hypercall_create_continuation. >> >> After processing every batch you need to check if >> hypercall_preempt_check returns true and if so use >> hypercall_create_continuation in order to encode a continuation. > > One more question. Are these continuations transparent from the caller side, > or do I also need to add something on the invoker side to properly handle these > continuations? They are (mostly) transparent to the guest, yes. "Mostly" because we have cases (iirc) where the continuation data is stored in a way that a guest could observe it. But it still wouldn't need to do anything in order for the hypercall to get continued until it completes (which may be "fails", faod). Jan