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=-16.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 9949FC432BE for ; Wed, 1 Sep 2021 17:12:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 43FE260FDC for ; Wed, 1 Sep 2021 17:12:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 43FE260FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLTmS-0004bW-Hh for qemu-devel@archiver.kernel.org; Wed, 01 Sep 2021 13:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLTlf-0003BT-Qc for qemu-devel@nongnu.org; Wed, 01 Sep 2021 13:11:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43679) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLTle-0004Nz-CR for qemu-devel@nongnu.org; Wed, 01 Sep 2021 13:11:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630516277; 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=9B7gfTC6qOcig/q1llT1UAEMVz4wMrt8GESi/Qozfrw=; b=YZAWAtEoSk1ie3UvYRkf3XQcBY/kHCoxk9miVPXPptxwcUexfjdqm3Yeko/IASmHZzvIRg QmDaBVmRYYVETFsJGgGtCb47pGPpnoLPJqc1E6Hr3SY/7g7ldlpalfo7dWaYuuhtxbOOAE +m1/4E91qQpdOpnNOf9mTP//QsGYZEg= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-g08wLQcNMHaNKZlRUWKYcA-1; Wed, 01 Sep 2021 13:11:14 -0400 X-MC-Unique: g08wLQcNMHaNKZlRUWKYcA-1 Received: by mail-wr1-f70.google.com with SMTP id q14-20020a5d574e000000b00157b0978ddeso137383wrw.5 for ; Wed, 01 Sep 2021 10:11:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=9B7gfTC6qOcig/q1llT1UAEMVz4wMrt8GESi/Qozfrw=; b=AegB/CDuIs5tD5Rsyb74WkQDTINU6s/gmlqeW3lKqD/mw5nVB9JV471f4cK3FG8sz9 Wfz6pJWKSCHhG/kJKIDaTBeGlNYsRGtbV9Sbmq4YeLwCjloaH40Bgk7ctyObz7gZdxUU rK9fjaJ7vTb4Z5u8kGT/3zUiuSWEbikDcPpmGBVvEbIQ817q0g4Q5q/q/DmTxRsZYL5s p6QdLHCD4ebKGo+5wBMeYoMq5dtLA40i7b8Ifw+g0OgideGXWLLIU65MuHcUTJlB3pIE jiCpBQzTdp33L3g1LTowqz6ag/fGAIL5zy2NgSBEbFDt7P9N/j477Hhp31AIO4JcAfbe FBwg== X-Gm-Message-State: AOAM532JKOyRLvoVSaUiiilgAPaX2xLV41kUyXSF/D5fCu09xePTbDUk 5AHZKgGzjoMK5UJrOaTdBsRu8oWNjqD5XMJ/RXEg+X2/+YlrElO44qBgOKq8fmVS6xWZwui/L5b nvG8Nc6od0lFDbkA= X-Received: by 2002:a1c:7dd0:: with SMTP id y199mr497090wmc.148.1630516273712; Wed, 01 Sep 2021 10:11:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHpZd8GHH67reu+kltnpAXkFMTQzIrCw4lVUQgnuoRlaqUzcRl4DplC7ojiN29V7Pb++5GtQ== X-Received: by 2002:a1c:7dd0:: with SMTP id y199mr497066wmc.148.1630516273522; Wed, 01 Sep 2021 10:11:13 -0700 (PDT) Received: from [192.168.3.132] (p4ff23f71.dip0.t-ipconnect.de. [79.242.63.113]) by smtp.gmail.com with ESMTPSA id k1sm47623wrz.61.2021.09.01.10.11.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Sep 2021 10:11:12 -0700 (PDT) Subject: Re: [PATCH v4 2/3] memory: Extract mtree_info_as() from mtree_info() To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20210901161943.4174212-1-philmd@redhat.com> <20210901161943.4174212-3-philmd@redhat.com> From: David Hildenbrand Organization: Red Hat Message-ID: <6623ad05-5e50-cadf-7486-22bfc41ff13e@redhat.com> Date: Wed, 1 Sep 2021 19:11:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210901161943.4174212-3-philmd@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.392, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.029, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Gerd Hoffmann , Peter Xu , Peter Maydell Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 01.09.21 18:19, Philippe Mathieu-Daudé wrote: > While mtree_info() handles both ASes and flatviews cases, > the two cases share basically no code. Split mtree_info_as() > out of mtree_info() to simplify. > > Suggested-by: Peter Maydell > Signed-off-by: Philippe Mathieu-Daudé > --- > softmmu/memory.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/softmmu/memory.c b/softmmu/memory.c > index 3eb6f52de67..5be7d5e7412 100644 > --- a/softmmu/memory.c > +++ b/softmmu/memory.c > @@ -3284,18 +3284,12 @@ static void mtree_info_flatview(bool dispatch_tree, bool owner) > g_hash_table_unref(views); > } > > -void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) > +static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled) > { > MemoryRegionListHead ml_head; > MemoryRegionList *ml, *ml2; > AddressSpace *as; > > - if (flatview) { > - mtree_info_flatview(dispatch_tree, owner); > - > - return; > - } > - > QTAILQ_INIT(&ml_head); > > QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { > @@ -3316,6 +3310,15 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) > } > } > > +void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) > +{ > + if (flatview) { > + mtree_info_flatview(dispatch_tree, owner); > + } else { > + mtree_info_as(dispatch_tree, owner, disabled); > + } > +} > + > void memory_region_init_ram(MemoryRegion *mr, > Object *owner, > const char *name, > Reviewed-by: David Hildenbrand I'd just have squashed that into #1. -- Thanks, David / dhildenb