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=-18.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, 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 0C461C433EF for ; Wed, 22 Sep 2021 17:42:56 +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 C868F611B0 for ; Wed, 22 Sep 2021 17:42:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C868F611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.192975.343732 (Exim 4.92) (envelope-from ) id 1mT6Gd-00067V-40; Wed, 22 Sep 2021 17:42:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 192975.343732; Wed, 22 Sep 2021 17:42:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mT6Gd-00067O-0Z; Wed, 22 Sep 2021 17:42:47 +0000 Received: by outflank-mailman (input) for mailman id 192975; Wed, 22 Sep 2021 17:42: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 1mT6Gb-00067I-8Z for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 17:42:45 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 2bb333d3-ef26-49f8-86cf-69b74f0549dc; Wed, 22 Sep 2021 17:42:44 +0000 (UTC) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-ggp9NKr6NNmscOmBfPvVtQ-1; Wed, 22 Sep 2021 13:42:42 -0400 Received: by mail-wr1-f71.google.com with SMTP id e1-20020adfa741000000b0015e424fdd01so2851944wrd.11 for ; Wed, 22 Sep 2021 10:42:42 -0700 (PDT) Received: from [192.168.1.36] (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id w1sm6588014wmc.19.2021.09.22.10.42.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 10:42:41 -0700 (PDT) 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: 2bb333d3-ef26-49f8-86cf-69b74f0549dc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632332564; h=from:from:reply-to:subject:subject: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=uVaOmuvSmYMdDMUDJJ0nLDELyFbMOLlDnDD2b93jvo8=; b=Htwu1n9DeDxsziaCPMz9t6wz0Mw0GtG++cWp/nBcFvG6MM6eM5UywOJvFWeioZrknvIQMD BBYgMXFCWrpjbf59/YJNDt/e8o6cbWAEIRHGKmLGfdTK7EBPQeGgjt1uf/R6xGfw+B7q+X 6GVImcLQ8pK8m9UKXmhJNv9hUnuVK+E= X-MC-Unique: ggp9NKr6NNmscOmBfPvVtQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=uVaOmuvSmYMdDMUDJJ0nLDELyFbMOLlDnDD2b93jvo8=; b=oitZFyFq4UYLAInIGuCa5ZDaOwFcYbFyXQl6JorvRTAlYrf8vS9eA4sxlegKK86LUU UW5D/gYhRqxAwvdfbtcdCn4qSeso9gv/0stCHA23gQ1cxrgYPQ4bB3/XZ4gZIn3n85gj lXgFvpBgoaDUUNZAE3j8p7QmB5jcoasfqy+jVlZCABzifFkX97rf/MXlwGNPP0OoqHtj uWnlS90B1Zg4bmMdzZO5RhNUgWIGLA8+G2pBpmJUPYzMkTRKkuKR5CihC3BM7q4rjqMf E50ujdWcGBLe8JoOwKVQ/NCTHdVHcnpwzKSAZY3RI0MPx0rot3GseXskfol6iM9UloJ9 VmJw== X-Gm-Message-State: AOAM530+9d9hW8flowghdwAN0C3dmPOjMS3fKddXxEmKqchux8d2uKaW ewYslyIqZQrofHjOZhBOHUbR10iuy0UOvHvClkiWjgNJXyGTjmqDdDtf1r59O+qUd2FqznMhZIg ZtemzrT+bix+fOP5RIZ//DFSd/u0= X-Received: by 2002:a1c:7310:: with SMTP id d16mr326728wmb.30.1632332561639; Wed, 22 Sep 2021 10:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMUMMi8eLqjRXCSalitvGzPda/oA8H6U5KYwVIDPTTCJLTISya0LAgbbYFrl2db1iXLKfbNQ== X-Received: by 2002:a1c:7310:: with SMTP id d16mr326712wmb.30.1632332561486; Wed, 22 Sep 2021 10:42:41 -0700 (PDT) Message-ID: Date: Wed, 22 Sep 2021 19:42:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [RFC PATCH v2 11/16] softmmu/memory: add memory_region_try_add_subregion function To: Damien Hedde , qemu-devel@nongnu.org Cc: Peter Maydell , "Michael S. Tsirkin" , David Hildenbrand , Peter Xu , mirela.grujic@greensocs.com, Alistair Francis , Gerd Hoffmann , Ani Sinha , Eric Blake , Stefano Stabellini , xen-devel@lists.xenproject.org, Paul Durrant , Markus Armbruster , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Eduardo Habkost , "Dr. David Alan Gilbert" , Eric Auger , Paolo Bonzini , qemu-riscv@nongnu.org, =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , mark.burton@greensocs.com, edgari@xilinx.com, Igor Mammedov References: <20210922161405.140018-1-damien.hedde@greensocs.com> <20210922161405.140018-12-damien.hedde@greensocs.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= In-Reply-To: <20210922161405.140018-12-damien.hedde@greensocs.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 9/22/21 18:14, Damien Hedde wrote: > It allows to try to add a subregion to a memory region with error > handling. Like memory_region_add_subregion_overlap, it handles > priority as well. > Apart the error handling, the behavior is the same. It can be used > to do the simple memory_region_add_subregion() (with no overlap) by > setting the priority parameter to 0. > > This commit is a preparation to further use this function in the > context of qmp command which needs error handling support. > > Signed-off-by: Damien Hedde > --- > > Adding a new function is obviously not ideal. But there is ~900 > occurrences of memory_region_add_subregion[_overlap] calls in the code > base. We do not really see an alternative here. > --- > include/exec/memory.h | 22 ++++++++++++++++++++++ > softmmu/memory.c | 22 ++++++++++++++-------- > 2 files changed, 36 insertions(+), 8 deletions(-) Reviewed-by: Philippe Mathieu-Daudé