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=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 1635AC433DF for ; Fri, 19 Jun 2020 12:36:17 +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 E40D2207E8 for ; Fri, 19 Jun 2020 12:36:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E40D2207E8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cert.pl 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 1jmGFa-0003nl-Uo; Fri, 19 Jun 2020 12:36:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jmGFZ-0003ng-7L for xen-devel@lists.xenproject.org; Fri, 19 Jun 2020 12:36:05 +0000 X-Inumbo-ID: 6df5ff20-b229-11ea-bb79-12813bfff9fa Received: from bagnar.nask.net.pl (unknown [195.187.242.196]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6df5ff20-b229-11ea-bb79-12813bfff9fa; Fri, 19 Jun 2020 12:36:00 +0000 (UTC) Received: from bagnar.nask.net.pl (unknown [172.16.9.10]) by bagnar.nask.net.pl (Postfix) with ESMTP id B4C86A3479; Fri, 19 Jun 2020 14:35:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id A23B6A2C6C; Fri, 19 Jun 2020 14:35:57 +0200 (CEST) Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id PIGH2CyjRmv1; Fri, 19 Jun 2020 14:35:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by bagnar.nask.net.pl (Postfix) with ESMTP id E9BBEA3478; Fri, 19 Jun 2020 14:35:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at bagnar.nask.net.pl Received: from bagnar.nask.net.pl ([127.0.0.1]) by localhost (bagnar.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rD96HgxpXxCn; Fri, 19 Jun 2020 14:35:56 +0200 (CEST) Received: from belindir.nask.net.pl (belindir-ext.nask.net.pl [195.187.242.210]) by bagnar.nask.net.pl (Postfix) with ESMTP id B0A9AA2C6C; Fri, 19 Jun 2020 14:35:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 9CCA321000; Fri, 19 Jun 2020 14:35:26 +0200 (CEST) Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bXILZbiN6RZR; Fri, 19 Jun 2020 14:35:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by belindir.nask.net.pl (Postfix) with ESMTP id 370052247F; Fri, 19 Jun 2020 14:35:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at belindir.nask.net.pl Received: from belindir.nask.net.pl ([127.0.0.1]) by localhost (belindir.nask.net.pl [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vIObhvTjidDM; Fri, 19 Jun 2020 14:35:21 +0200 (CEST) Received: from belindir.nask.net.pl (belindir.nask.net.pl [172.16.10.10]) by belindir.nask.net.pl (Postfix) with ESMTP id 0E1AA21000; Fri, 19 Jun 2020 14:35:21 +0200 (CEST) Date: Fri, 19 Jun 2020 14:35:20 +0200 (CEST) From: =?utf-8?Q?Micha=C5=82_Leszczy=C5=84ski?= To: Roger Pau =?utf-8?Q?Monn=C3=A9?= Message-ID: <1494219989.10184041.1592570120971.JavaMail.zimbra@cert.pl> In-Reply-To: <20200619113434.GZ735@Air-de-Roger> References: <122238637.9820857.1592523264685.JavaMail.zimbra@cert.pl> <1060400786.9820894.1592523480084.JavaMail.zimbra@cert.pl> <20200619113434.GZ735@Air-de-Roger> Subject: Re: [PATCH v2 1/7] xen/mm: lift 32 item limit from mfn/gfn arrays MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.16.10.10] X-Mailer: Zimbra 8.6.0_GA_1194 (ZimbraWebClient - GC83 (Win)/8.6.0_GA_1194) Thread-Topic: xen/mm: lift 32 item limit from mfn/gfn arrays Thread-Index: 9ePTz9uC4rSX28Kka1ieARXLoMMfNw== 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" , Jan Beulich , Tamas K Lengyel , Xen-devel Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ----- 19 cze 2020 o 13:34, Roger Pau Monn=C3=A9 roger.pau@citrix.com napisa= =C5=82(a): > On Fri, Jun 19, 2020 at 01:38:00AM +0200, Micha=C5=82 Leszczy=C5=84ski wr= ote: >> 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. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > Thanks, Roger. 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 t= hese continuations? Best regards, Micha=C5=82 Leszczy=C5=84ski CERT Polska