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=-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 64863C433DF for ; Fri, 19 Jun 2020 11:49:04 +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 3897A21532 for ; Fri, 19 Jun 2020 11:49:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3897A21532 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 1jmFVa-0007hf-PC; Fri, 19 Jun 2020 11:48:34 +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 1jmFVZ-0007ha-FB for xen-devel@lists.xenproject.org; Fri, 19 Jun 2020 11:48:33 +0000 X-Inumbo-ID: cca81a6e-b222-11ea-bb69-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cca81a6e-b222-11ea-bb69-12813bfff9fa; Fri, 19 Jun 2020 11:48:32 +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 8DE85AD18; Fri, 19 Jun 2020 11:48:30 +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> <1542506040.10138544.1592566594292.JavaMail.zimbra@cert.pl> From: Jan Beulich Message-ID: <8f38c905-c5ed-06d7-db4e-e8024e897b43@suse.com> Date: Fri, 19 Jun 2020 13:48:33 +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: <1542506040.10138544.1592566594292.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 13:36, 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. >> >> Thanks, Roger. > > > Somebody previously suggested that this limit could be lifted this way, > so I would like to hear some more opinions on that. I did suggest the limit can be lifted, but not by processing all pieces in one go. Whether batches of 32 or 64 or 128 are chosen is a different thing, but you can't do arbitrary amounts without any preemption checks. Jan