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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C9DAC433EF for ; Sun, 29 May 2022 15:04:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4842283D90; Sun, 29 May 2022 17:04:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KVTEiIlk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2622D83ECA; Sun, 29 May 2022 17:04:32 +0200 (CEST) Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0671D83C10 for ; Sun, 29 May 2022 17:04:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qv1-xf35.google.com with SMTP id l1so7979663qvh.1 for ; Sun, 29 May 2022 08:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dO61EaDHvUnlQAyS5o3rJNunRN68GjLOuHRKCq2RSk4=; b=KVTEiIlkCEISk07S0SaBWobWFsnzcq5Wkwbm0gmrr2B4mPt2S+49/UsVyF+0Exq813 iqSZjfJWE/bKDOmBxColNNcYL/7sivKJkgBYEBpAIc9jEI8Ewz7AEAi2gWx/hdmehhAx wbigOnZB7MuSxU68EMUlXlJsYc2cfAckgI9g49Muh2Qguo7xh/Vf3lO8TelVASgYK0cc qpi/6BAIBH0oMED3ZoibVKQo0azN9D6nWe3FLx7Kz/iMHwHCioVSw3+49mi+j5Tt4q89 afnTQ+vzlbkcmSx9K8mNNpqjWtyfSNLX7Mm1qsmSoGAX+RJ3/fhqoiyLQlHgHXy7jyI7 dMiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=dO61EaDHvUnlQAyS5o3rJNunRN68GjLOuHRKCq2RSk4=; b=nrZ/8AVh/RA7dAjz06DFFLElC38ea27qy4D17QQQSAaleIAzcJiwiv1G6MNOeKhTYt 3yWXrUrjFqeBLax2CuEhRa87AtGkibE21r2a4Ayp37uPnB54pur7azaP1nClmCBpUo9d 7X3X3+tPf9QA/UPHbdijNwcyDZYLEm8rz2q69X32jTl2U0A8JlMmetpyMAZ5sqhULSNC 2U6ndrtLuJgQoj2jgEkzzoR8x2/uhISY5pUBBiJBbNwOu/rF68PGm5J6JIvITQcQ4ksR oNGMKJ40wEOPEXiMSEjDtEnpF1J/OtC9+K4AtArSm4Jn0/F9jXiiaRJ6ku9ob7B5H6EZ NO+g== X-Gm-Message-State: AOAM533kb/ocQ+dv3T6c6ujc9/JF+5ldDYu6t56PgiySclC7xE9HzRBP NOrgpu7KeRxdYTxyroDhuBsXxLWhp2w= X-Google-Smtp-Source: ABdhPJyTWsmnekz5WjJoaLaAGI/RUUIBmZfNBghreDaPg2jWHZu0jMJ7YgBRi7DbGzvDg+QaUEygqQ== X-Received: by 2002:a05:6214:1bc7:b0:45b:85e:e5a4 with SMTP id m7-20020a0562141bc700b0045b085ee5a4mr42421478qvc.57.1653836667467; Sun, 29 May 2022 08:04:27 -0700 (PDT) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.googlemail.com with ESMTPSA id cn8-20020a05622a248800b002f94388d447sm5942197qtb.28.2022.05.29.08.04.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 May 2022 08:04:26 -0700 (PDT) Subject: Re: [PATCH] doc: sandbox: Add additional valgrind documentation To: Heinrich Schuchardt Cc: Simon Glass , Andrew Scull , Tom Rini , u-boot@lists.denx.de References: <20220527033646.670579-1-seanga2@gmail.com> <18afb7c6-60cd-8cff-b885-6f8ee2eed79b@gmail.com> <2d7817e2-121a-5934-38b8-eca7cea70e9a@gmx.de> From: Sean Anderson Message-ID: Date: Sun, 29 May 2022 11:04:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <2d7817e2-121a-5934-38b8-eca7cea70e9a@gmx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 5/28/22 4:20 AM, Heinrich Schuchardt wrote: > On 5/27/22 15:25, Sean Anderson wrote: >> On 5/27/22 3:14 AM, Heinrich Schuchardt wrote: >>> On 5/27/22 05:36, Sean Anderson wrote: >>>> This document some additional options which can be used with >>>> valgrind, as >>> >>> Thanks for enhancing this document >>> >>> nits >>> %s/document/documents/ >>> >>>> well as directions for future work. It also fixes up inline literals= to >>>> actually be inline literals (and not italics). The content of this >>>> documentation is primarily adapted from [1]. >>>> >>>> [1] >>>> https://lore.kernel.org/u-boot/57cb4b49-fa30-1194-9ac3-faa53e8033bd@= gmail.com/ >>>> >>>> >>>> Signed-off-by: Sean Anderson >>>> --- >>>> >>>> =C2=A0 doc/arch/sandbox.rst | 65 +++++++++++++++++++++++++++++++++++= ++++++--- >>>> =C2=A0 1 file changed, 61 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst >>>> index e1119492b4..cd5090be71 100644 >>>> --- a/doc/arch/sandbox.rst >>>> +++ b/doc/arch/sandbox.rst >>>> @@ -479,19 +479,76 @@ It is possible to run U-Boot under valgrind to= >>>> check memory allocations:: >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 valgrind ./u-boot >>>> >>>> -For more detailed results, enable `CONFIG_VALGRIND`. There are many= >>>> false >>>> -positives due to `malloc` itself. Suppress these with:: >>>> +For more detailed results, enable ``CONFIG_VALGRIND``. There are >>>> many false >>>> +positives due to ``malloc`` itself. Suppress these with:: >>> >>> What do you mean by 'malloc itself'? Is it the internal implementatio= n >>> of malloc? Or is it the act of calling malloc()? >>> >>> This paragraph should explain what CONFIG_VALGRIND does: >>> >>> The sandbox allocates a memory pool via mmap(). U-Boot's internal >>> malloc() and free() work on this memory pool. Custom allocators and >>> deallocators are by default invisible to valgrind. It is >>> CONFIG_VARLGRIND=3Dy that exposes U-Boot's malloc() and free() to val= grind. >>> >>> If I understand include/valgrind/valgrind.h correctly, it injects >>> placeholder assembler code that valgrind can replace by library calls= >>> into valgrind itself when loading the U-Boot binary. >> >> I believe this is correct. I will adapt your above description for v2.= >> >>> I miss a statement indicating that the sandbox on RISC-V has no valgr= ind >>> support, yet. >> >> I was not aware of this. The Kconfig should probably be updated. >> >>> The U-Boot code does not use VALGRIND_MEMPOOL* macros to indicate whi= ch >>> memory pools it manages. Is this the reason for the problems we are >>> facing? >=20 > Hello Sean, >=20 > thanks for revising the patch. >=20 > Will you have a look at the usefulness of VALGRIND_MEMPOOL* for U-Boot?= I don't know if this would address anything. There's still the problem th= at dlmalloc has to access the red zones. --Sean