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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8FB19C54EE9 for ; Tue, 20 Sep 2022 05:30:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.409150.652071 (Exim 4.92) (envelope-from ) id 1oaVpR-0007eG-UE; Tue, 20 Sep 2022 05:29:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 409150.652071; Tue, 20 Sep 2022 05:29:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oaVpR-0007e9-RP; Tue, 20 Sep 2022 05:29:53 +0000 Received: by outflank-mailman (input) for mailman id 409150; Tue, 20 Sep 2022 05:29:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oaVpQ-0007e0-8i for xen-devel@lists.xenproject.org; Tue, 20 Sep 2022 05:29:52 +0000 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [2a00:1450:4864:20::42b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3fba9b16-38a5-11ed-9647-05401a9f4f97; Tue, 20 Sep 2022 07:29:51 +0200 (CEST) Received: by mail-wr1-x42b.google.com with SMTP id y5so2444527wrh.3 for ; Mon, 19 Sep 2022 22:29:51 -0700 (PDT) Received: from [192.168.1.115] ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id t18-20020adfdc12000000b0022762b0e2a2sm510363wri.6.2022.09.19.22.29.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Sep 2022 22:29:49 -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 X-Inumbo-ID: 3fba9b16-38a5-11ed-9647-05401a9f4f97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date; bh=vLavNPct5HZ2zw6lCN44DF82TIWb7S+NcGLLhGiFgbY=; b=EK29FpxAwJTevxxTP1Jl5+8Y1nnFTDF4cikh0gdLoXjAqssLIc3NK6aJqtIC/sl76l dQN74iwKJIJ8m0vzpT+oBMXb5MWlRMSIdHBzXKYK5Up+7xMeAWU2OrFa0PkuuSntFnfD X7ztP7+ETA8Fnzon/RDPQskBBm2PsWXO/DiTgFqR7DYzUYuJeytUDF0rJT4iCR/ALlAA RNwcv8k60hb5BUXFwIL4fqj+86FL8NznWTo23V8HDCS9Sc8g3g84j4YS3ADG95ZJ5qc0 HY0W7gF2cKRT2O+FinLEbnd2WC7FWDJUGcCanGw3nw0m2niEWG4+ilLXeWs4pDnNwah0 Td6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date; bh=vLavNPct5HZ2zw6lCN44DF82TIWb7S+NcGLLhGiFgbY=; b=vaqYOl7d58NCNJ7xLmS77CWfvHAQkcPWly4fEyHOfOSdRTb22H6vHDEkuw4a+f4blR gdeFBxU1ce/RNyPwl6IBChlsYgQ4iLXSFaBMIGgwJtVXn7MiiC1bWRZyuAVdG+IrBMFD QyZxqKiEtMtW2/P8MVivqIMoCs0/2mC1PQ2/GHW1dq+k4+K995GWY3QkBSGGT3/qScqY 7Il1xiIKq0COIvmTEHzpj4SpAqdtk0Sf4A7sm5hTG3t33YExj4Q0OCL0ei6kqbFDNRWO dIUE9h+1J5HM3BZf2D3QT7B+miD8pF2N1AAe6M4gzWMhN3skpQCVnAXRsvNGW4a3FrhL bOgw== X-Gm-Message-State: ACrzQf0gj7KyoJKuF9/ZCv3KenwF3/diaNtHzCA+r/9mZS1zACd95IXU hH8fRd7jSF1LIo5ygpBol40= X-Google-Smtp-Source: AMsMyM7ISxf8TowQHPXzwCB3gJbnhv9fjXayvDOx/H9iOPRnaX40Rdq5is+DoWs7bHq7Ygny4DwhKA== X-Received: by 2002:adf:eec3:0:b0:22a:d159:456c with SMTP id a3-20020adfeec3000000b0022ad159456cmr12283036wrp.463.1663651790518; Mon, 19 Sep 2022 22:29:50 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Message-ID: <63a4afba-546b-5c4c-94f8-c689b8fa0e0b@amsat.org> Date: Tue, 20 Sep 2022 07:29:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 9/9] exec/address-spaces: Inline legacy functions Content-Language: en-US From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= To: Bernhard Beschow , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Magnus Damm , Aleksandar Rikalo , Bandan Das , Matthew Rosato , Daniel Henrique Barboza , Sergio Lopez , Alexey Kardashevskiy , Xiaojuan Yang , Cameron Esfahani , Michael Rolnik , Song Gao , Jagannathan Raman , Greg Kurz , Kamil Rytarowski , Peter Xu , Joel Stanley , Alistair Francis , "Dr. David Alan Gilbert" , Paolo Bonzini , haxm-team@intel.com, Roman Bolshakov , Markus Armbruster , Eric Auger , David Gibson , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , Christian Borntraeger , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Stefan Hajnoczi , qemu-block@nongnu.org, Eduardo Habkost , =?UTF-8?Q?Herv=c3=a9_Poussineau?= , qemu-ppc@nongnu.org, Cornelia Huck , Palmer Dabbelt , Helge Deller , Stefano Stabellini , qemu-riscv@nongnu.org, Stafford Horne , Paul Durrant , Havard Skinnemoen , Elena Ufimtseva , Alexander Graf , Thomas Huth , Alex Williamson , Wenchao Wang , Tony Krowiak , Marcel Apfelbaum , qemu-s390x@nongnu.org, =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Mark Cave-Ayland , Eric Farman , Reinoud Zandijk , Alexander Bulekov , Yanan Wang , "Edgar E. Iglesias" , Gerd Hoffmann , Tyrone Ting , xen-devel@lists.xenproject.org, Yoshinori Sato , John Snow , Richard Henderson , Darren Kenny , kvm@vger.kernel.org, Qiuhao Li , John G Johnson , Bin Meng , Sunil Muthuswamy , Max Filippov , qemu-arm@nongnu.org, Marcelo Tosatti , Peter Maydell , Anthony Perard , Andrew Jeffery , Artyom Tarasenko , Halil Pasic , "Maciej S. Szmigiero" , Jason Wang , David Hildenbrand , Laurent Vivier , Alistair Francis , Jason Herne References: <20220919231720.163121-1-shentey@gmail.com> <20220919231720.163121-10-shentey@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 20/9/22 07:15, Philippe Mathieu-Daudé wrote: > On 20/9/22 01:17, Bernhard Beschow wrote: >> The functions just access a global pointer and perform some pointer >> arithmetic on top. Allow the compiler to see through this by inlining. > > I thought about this while reviewing the previous patch, ... > >> Signed-off-by: Bernhard Beschow >> --- >>   include/exec/address-spaces.h | 30 ++++++++++++++++++++++++++---- >>   softmmu/physmem.c             | 28 ---------------------------- >>   2 files changed, 26 insertions(+), 32 deletions(-) >> >> diff --git a/include/exec/address-spaces.h >> b/include/exec/address-spaces.h >> index b31bd8dcf0..182af27cad 100644 >> --- a/include/exec/address-spaces.h >> +++ b/include/exec/address-spaces.h >> @@ -23,29 +23,51 @@ >>   #ifndef CONFIG_USER_ONLY >> +#include "hw/boards.h" > > ... but I'm not a fan of including this header here. It is restricted to > system emulation, but still... Let see what the others think. > >>   /** >>    * Get the root memory region.  This is a legacy function, provided for >>    * compatibility. Prefer using SysBusState::system_memory directly. >>    */ >> -MemoryRegion *get_system_memory(void); >> +inline MemoryRegion *get_system_memory(void) >> +{ >> +    assert(current_machine); >> + >> +    return ¤t_machine->main_system_bus.system_memory; >> +} Maybe we can simply declare them with __attribute__ ((const)) in the previous patch? See https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes