[{"id":1772088,"web_url":"http://patchwork.ozlabs.org/comment/1772088/","msgid":"<c8660368-ffec-9051-7dcb-97d13c6ba850@redhat.com>","list_archive_url":null,"date":"2017-09-20T17:18:03","subject":"Re: [Qemu-devel] [PATCH qemu v4 12/18] memory: Share FlatView's and\n\tdispatch trees between address spaces","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"content":"On 20/09/2017 13:46, Alexey Kardashevskiy wrote:\n> +    QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {\n> +        MemoryRegion *physmr = memory_region_get_flatview_root(as->root);\n> +        FlatView *new_view = g_hash_table_lookup(flat_views, physmr);\n> +\n> +        if (new_view) {\n> +            continue;\n> +        }\n> +\n> +        new_view = generate_memory_topology(physmr);\n> +        g_hash_table_insert(flat_views, physmr, new_view);\n\ngenerate_memory_topology can do the g_hash_table_lookup + insert I think?\n\n>  static void flatview_set_to_address_space(AddressSpace *as)\n>  {\n> -    FlatView *old_view = address_space_get_flatview(as);\n> +    FlatView *old_view = address_space_to_flatview(as);\n>      MemoryRegion *physmr = memory_region_get_flatview_root(as->root);\n>      FlatView *new_view = g_hash_table_lookup(flat_views, physmr);\n\nRename to address_space_set_flatview?\n\nThanks,\n\nPaolo","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=pbonzini@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy60P4fL2z9s0Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 03:18:44 +1000 (AEST)","from localhost ([::1]:49879 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duie0-0001hZ-Qc\n\tfor incoming@patchwork.ozlabs.org; Wed, 20 Sep 2017 13:18:40 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:48642)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pbonzini@redhat.com>) id 1duidW-0001gS-91\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 13:18:13 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pbonzini@redhat.com>) id 1duidS-0002c6-G0\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 13:18:10 -0400","from mx1.redhat.com ([209.132.183.28]:34474)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <pbonzini@redhat.com>) id 1duidS-0002bo-9M\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 13:18:06 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 602C125B9A;\n\tWed, 20 Sep 2017 17:18:05 +0000 (UTC)","from [10.36.117.211] (ovpn-117-211.ams2.redhat.com [10.36.117.211])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id BFAAE5D6A6;\n\tWed, 20 Sep 2017 17:18:04 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 602C125B9A","To":"Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org","References":"<20170920114637.42004-1-aik@ozlabs.ru>\n\t<20170920114637.42004-13-aik@ozlabs.ru>","From":"Paolo Bonzini <pbonzini@redhat.com>","Message-ID":"<c8660368-ffec-9051-7dcb-97d13c6ba850@redhat.com>","Date":"Wed, 20 Sep 2017 19:18:03 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170920114637.42004-13-aik@ozlabs.ru>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 20 Sep 2017 17:18:05 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH qemu v4 12/18] memory: Share FlatView's and\n\tdispatch trees between address spaces","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1772320,"web_url":"http://patchwork.ozlabs.org/comment/1772320/","msgid":"<826915f8-da16-0313-5b8c-301bb7db01d3@ozlabs.ru>","list_archive_url":null,"date":"2017-09-20T23:53:10","subject":"Re: [Qemu-devel] [PATCH qemu v4 12/18] memory: Share FlatView's and\n\tdispatch trees between address spaces","submitter":{"id":7621,"url":"http://patchwork.ozlabs.org/api/people/7621/","name":"Alexey Kardashevskiy","email":"aik@ozlabs.ru"},"content":"On 21/09/17 03:18, Paolo Bonzini wrote:\n> On 20/09/2017 13:46, Alexey Kardashevskiy wrote:\n>> +    QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {\n>> +        MemoryRegion *physmr = memory_region_get_flatview_root(as->root);\n>> +        FlatView *new_view = g_hash_table_lookup(flat_views, physmr);\n>> +\n>> +        if (new_view) {\n>> +            continue;\n>> +        }\n>> +\n>> +        new_view = generate_memory_topology(physmr);\n>> +        g_hash_table_insert(flat_views, physmr, new_view);\n> \n> generate_memory_topology can do the g_hash_table_lookup + insert I think?\n\nYeah, I suppose. But rather g_hash_table_replace() if we decide to proceed\nwith 18/18 (or even if we do not - _replace() simply inserts if there was\nno such element).\n\n\n>>  static void flatview_set_to_address_space(AddressSpace *as)\n>>  {\n>> -    FlatView *old_view = address_space_get_flatview(as);\n>> +    FlatView *old_view = address_space_to_flatview(as);\n>>      MemoryRegion *physmr = memory_region_get_flatview_root(as->root);\n>>      FlatView *new_view = g_hash_table_lookup(flat_views, physmr);\n> \n> Rename to address_space_set_flatview?\n\nSure, why not :)","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ozlabs-ru.20150623.gappssmtp.com\n\theader.i=@ozlabs-ru.20150623.gappssmtp.com\n\theader.b=\"156Zsh06\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyGm93X2Zz9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 09:53:44 +1000 (AEST)","from localhost ([::1]:51130 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duooI-0000m5-AI\n\tfor incoming@patchwork.ozlabs.org; Wed, 20 Sep 2017 19:53:42 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37607)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1duonu-0000kh-S6\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 19:53:19 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1duonr-0000TS-GB\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 19:53:18 -0400","from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]:46785)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <aik@ozlabs.ru>) id 1duonr-0000T3-A5\n\tfor qemu-devel@nongnu.org; Wed, 20 Sep 2017 19:53:15 -0400","by mail-pg0-x235.google.com with SMTP id i130so2562617pgc.3\n\tfor <qemu-devel@nongnu.org>; Wed, 20 Sep 2017 16:53:15 -0700 (PDT)","from [192.168.10.22] (124-171-134-202.dyn.iinet.net.au.\n\t[124.171.134.202]) by smtp.googlemail.com with ESMTPSA id\n\tj14sm108735pgs.15.2017.09.20.16.53.12\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 16:53:13 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ozlabs-ru.20150623.gappssmtp.com; s=20150623;\n\th=subject:to:references:from:message-id:date:user-agent:mime-version\n\t:in-reply-to:content-language:content-transfer-encoding;\n\tbh=0WQ+t5irGiDwOUulJfWszYCBz/KdugpeTDTtyWEb5m8=;\n\tb=156Zsh06qv3fE6RcUZJWk0LddoTFwG9kjdUmacP8Di51AuXSg8dRWRzZt/XvDifZhC\n\tHqHNG8mjPf6AlEYyZFa14m11wjlzTqw1hBNhHtrv2+8maOmgv5AGIDhCamwOPya276sA\n\tBcHifjL2H0cC8DO71FjMk3ZRu/LRsoMdA/pvIvtLbph/BLPouQZBTQO1+g/4UButOC+/\n\tk4a0tmscnwp+2JIBKq9dB+VmQ9OxjOkbhiZSgAGj3pFM7+/tLfIqtNCS4uFWJuuy1fpa\n\t0ZlQO38g08hwGNYPy5JhembKaD+iDhryc36tXhtwnOQ4eBMgNAIdimt6WhqKBtKiKO8u\n\tGTSw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=0WQ+t5irGiDwOUulJfWszYCBz/KdugpeTDTtyWEb5m8=;\n\tb=jVQb6YVMjkYeo2oKgvf76IC8parShXTDmAerFmfI00G9Zde2XBcur9UKIHCpP4c3AY\n\tThkjNxP5dCcfuYE8pRxh1XkxjaAuVl5uoMBFjc0MM+j5Y+dlG92Geeqg7T7omQ2kgbDN\n\tC76t0Bgo4dbUAjV3t3LyWvNTr5ATu04MywTO11hJfZrT/wiIy9xKPMhdYLrl4oO4LVYA\n\tfDBKEsPjH8uMYWWAJs/8WB53BXNTabfV/Sr5b3+uqqpGbjcG3R3aXSFypH8PgwFHlZLg\n\tXBaq08RbdwCtAfVBaQLjTJOm6vLMwDneGa2eK8OOs9/40ghXrlJoWtpK8OxQ9bPJlRiQ\n\tx1pA==","X-Gm-Message-State":"AHPjjUjhFaJZN9BRpS6L/cpmgnrJG8PmbjFWi4kGNg/kgcEBfuhyA+6w\n\t0RakSkCjqJ6Iil7/qdzGd3Zzg8tk","X-Google-Smtp-Source":"AOwi7QAw5VFYEZrrGOAKdS7PQUde0C4BKTbTjBs53GyukdYTd4thjKTdiI3wVgSf/XA4fJT5b+tasw==","X-Received":"by 10.101.75.201 with SMTP id p9mr3872688pgr.281.1505951594068; \n\tWed, 20 Sep 2017 16:53:14 -0700 (PDT)","To":"Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org","References":"<20170920114637.42004-1-aik@ozlabs.ru>\n\t<20170920114637.42004-13-aik@ozlabs.ru>\n\t<c8660368-ffec-9051-7dcb-97d13c6ba850@redhat.com>","From":"Alexey Kardashevskiy <aik@ozlabs.ru>","Message-ID":"<826915f8-da16-0313-5b8c-301bb7db01d3@ozlabs.ru>","Date":"Thu, 21 Sep 2017 09:53:10 +1000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<c8660368-ffec-9051-7dcb-97d13c6ba850@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-AU","Content-Transfer-Encoding":"7bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400e:c05::235","Subject":"Re: [Qemu-devel] [PATCH qemu v4 12/18] memory: Share FlatView's and\n\tdispatch trees between address spaces","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]