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=-11.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, 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 73482C4338F for ; Sat, 21 Aug 2021 13:34:02 +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 E06B36120D for ; Sat, 21 Aug 2021 13:34:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E06B36120D 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]:47604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHR8K-0002JJ-Rv for qemu-devel@archiver.kernel.org; Sat, 21 Aug 2021 09:34:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHR6w-0001d3-7c for qemu-devel@nongnu.org; Sat, 21 Aug 2021 09:32:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHR6q-0005y8-EP for qemu-devel@nongnu.org; Sat, 21 Aug 2021 09:32:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629552746; 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=PYO23ymwNKUnv7XC44fv/VI2/37P/M5Vesj9Glph70k=; b=eX2hk6QrtXJq5hzJWmqsqSatcS48LdJeuMGCfwkZngZMijDihSHUMejfXtJ/zgx5DxM3Z5 q9/DQ2EuQ4yAxsNUVWGcGlXhCGNEBazd+X5RDrpBOpXeGbcqj78d8Qy3qiV2izx9gBUwuY H4N6bKqKNnF7FWaplaeXs//FFN0LUkY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-MNom7O_9O2qpfmUzPKmfOg-1; Sat, 21 Aug 2021 09:32:21 -0400 X-MC-Unique: MNom7O_9O2qpfmUzPKmfOg-1 Received: by mail-wm1-f72.google.com with SMTP id x125-20020a1c3183000000b002e73f079eefso774460wmx.0 for ; Sat, 21 Aug 2021 06:32:21 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PYO23ymwNKUnv7XC44fv/VI2/37P/M5Vesj9Glph70k=; b=o7Yz9q7Z7ApDneDhQIDldnkhQL8icp2hzssosmJzvqjLChNWjbqb7s+MZLXSLVq32e UOCEa1riOAaUuo5gppc9FR6oBQwUrfG53XtkM3wkcjarKGfkRnyeoriEZEdmb2aRIkDq p5aphY/aYWV7BM3m9bQSo0Q+T2kAHTAMR2kT7HZk+uziF9ugmV+3Fx44NETKtCjGENdq hszLhLEdR39+1tTDZFJbt39Se4lW4R0FK1U+NKW60o+Fknbb6QsmMIaoSYk1+w+8vBdu 53ZfD1SdtkYV4adoTQbdTuJsXoxlt9OeJK2C1vzjXazwKz1F4AZGCY4QO6SN5rcsSteg L5Cg== X-Gm-Message-State: AOAM530qmuJRTZsD9My8Mz7lmOcdC+NcvjSjIQC82EzXyR71OYFBpSFP zFUimT9TN3yq8mbYdpcu9U72kMMOqTAF8ZzBPcZbA7jx1Lj4AHKkFfEa65eIQkGkUbs0G3WvaJD 3J90R7dACsd1tWN8= X-Received: by 2002:a5d:65c2:: with SMTP id e2mr3922283wrw.191.1629552740627; Sat, 21 Aug 2021 06:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy777ZyjHq9l+vTqeSeU5IRWcXF4zGVB8hM0mKcAQe5uilILJt9c7hg9y8cMfoDlangBPQtsg== X-Received: by 2002:a5d:65c2:: with SMTP id e2mr3922265wrw.191.1629552740440; Sat, 21 Aug 2021 06:32:20 -0700 (PDT) Received: from [192.168.1.36] (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id t7sm4980520wrq.90.2021.08.21.06.32.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Aug 2021 06:32:19 -0700 (PDT) Subject: Re: [PATCH] softmmu/physmem: Improve guest memory allocation failure error message To: Bin Meng References: <20210820155211.3153137-1-philmd@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: Date: Sat, 21 Aug 2021 15:32:18 +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: 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.49, 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: Igor Mammedov , Paolo Bonzini , "qemu-devel@nongnu.org Developers" , Peter Xu , David Hildenbrand Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 8/21/21 12:01 PM, Bin Meng wrote: > On Fri, Aug 20, 2021 at 11:52 PM Philippe Mathieu-Daudé > wrote: >> >> When Linux refuses to overcommit a seriously wild allocation we get: >> >> $ qemu-system-i386 -m 40000000 >> qemu-system-i386: cannot set up guest memory 'pc.ram': Cannot allocate memory >> >> Slighly improve the error message, displaying the memory size > > typo: Slightly Oops. >> if (!new_block->host) { >> + g_autofree char *size_s = size_to_str(new_block->max_length); > > Does g_autofree work with every compiler we support? > > Looks it only applies to GCC and clang? > https://www.gitmemory.com/issue/linuxwacom/libwacom/142/518787578 Which are the only two supported by the project AFAIK. g_autofree depends on glib, minimum available since commit 00f2cfbbec6 ("glib: bump min required glib library version to 2.48"). Merged here: commit 3590b27c7a2be7a24b4b265 Merge: d013d220c71 57b9f113fce Date: Thu Aug 22 17:57:09 2019 +0100 Merge remote-tracking branch 'remotes/berrange/tags/autofree-pull-request' into staging require newer glib2 to enable autofree'ing of stack variables exiting scope > Tested-by: Bin Meng Thanks!