From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cBlwl-0004sX-9r for mharc-grub-devel@gnu.org; Tue, 29 Nov 2016 12:11:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBlwe-0004rL-Vc for grub-devel@gnu.org; Tue, 29 Nov 2016 12:11:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBlwZ-00087h-72 for grub-devel@gnu.org; Tue, 29 Nov 2016 12:11:52 -0500 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:33648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBlwY-00087J-TN for grub-devel@gnu.org; Tue, 29 Nov 2016 12:11:47 -0500 Received: by mail-lf0-x243.google.com with SMTP id 98so13262629lfs.0 for ; Tue, 29 Nov 2016 09:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=M9nycsJkXBLvuqjDldk37IpqdgIkRUAAxUmiTHJvzEs=; b=yMlr7EIyXviejSNLJ30mbxoctd1mpZBRk9y4exeMtIi8XcRhMagtGTikOCeq0mQ7HG p3YLbb32cQ6Yijto3BGU/ZMRY2FiO8+rLe69A5cf+oAIHaiAy9SvGjjplSGoSj7bcJt/ GuZCmESf4Db2uF+imAV6NoSDSdzDiJeuqllNkXxuvJtoVmAWWauj/0WTG8PgLFvI8P4f 5eHNuGI0EFSTD5XwwJRAy+XJtpvprgMrpfPB50cu+6ZbdIirWuwsJEQaOBqvKZK79Tvn bb6R/d5meAThnyIKcdGmpOjIY0kLnf922UEnWMYqxHzplBs9bfBC4xnET9nMcYeZ0WVs DaFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=M9nycsJkXBLvuqjDldk37IpqdgIkRUAAxUmiTHJvzEs=; b=OItr0TPBKqswW0JihhKWvfEWIJFuYId7//Ju9Hd45rygo2vSpcVJjvwhkO9H7X70bB oOVXZdsxEwl5jenrzTXJtgJQ1tW+MYv4QBWUZ313QlSE2CsXX9Fv6gzx+DV+SaICgepU HBhdaHQTb30HDgylYcG32seBamD4ydtzkuN9kBvk1F0V5KbfH1k4s38NjCoDZmpSdqmO BMFtSzasAPNZTiZwUwEYl14GpN15NhbjuFt8MOVgfZRhVtFNh/+peLndSO4t9dPNlNci LuOeYkz773q80ts3fDw5DLUlH1Bye33Wz+PON/ExNB/1fShsbwzd3RPTOSYLKvhfnKCV x+UQ== X-Gm-Message-State: AKaTC02gvnWgyD93N6OJvn5gnnSOcdBudG5lMp7Suklwsr4hJIWZ2zlZXeabhgkBVpjUIg== X-Received: by 10.25.24.159 with SMTP id 31mr11194191lfy.101.1480439504665; Tue, 29 Nov 2016 09:11:44 -0800 (PST) Received: from [192.168.1.44] (ppp109-252-90-110.pppoe.spdop.ru. [109.252.90.110]) by smtp.gmail.com with ESMTPSA id m16sm13988319lfj.24.2016.11.29.09.11.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Nov 2016 09:11:43 -0800 (PST) Subject: Re: How to enable MM debugging? To: The development of GNU GRUB References: <583D880B.6070905@oracle.com> <583D9300.6010000@oracle.com> From: Andrei Borzenkov Message-ID: Date: Tue, 29 Nov 2016 20:11:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <583D9300.6010000@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::243 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 17:11:57 -0000 29.11.2016 17:38, Stanislav Kholmanskikh пишет: > > > On 11/29/2016 05:17 PM, Andrei Borzenkov wrote: >> On Tue, Nov 29, 2016 at 4:52 PM, Stanislav Kholmanskikh >> wrote: >>> Hi! >>> >>> Does anybody use MM debugging? If so, what is the recommended/working >>> way of enabling it? >>> >>> These steps do not work: >>> >>> 1. Run ./configure with '--enable-mm-debug'. It reports: >>> >>> With memory debugging: Yes >>> >>> 2. Then build and install the binaries, and install the boot loader >>> >>> 3. Then set 'grub_mm_debug=1' in the grub's prompt. >>> >> >> This environment variable is not used. >> >>> grub> set grub_mm_debug=1 >>> grub> insmod ofnet >>> grub> >>> >>> During initialization, ofnet calls grub_malloc(), so I expect some debug >>> messages to be printed on 'insmod ofnet'. >>> >>> Am I missing something, or is it a bug? >>> >> >> Either patch grub to assign grub_mm_debug=1 in grub-core/kern/mm.c or >> create simple command to do it at run-time. The latter may be >> considered for inclusion, although honestly I am not sure how >> particular useful mm debugging is. > > No, it doesn't help. Look: > > stas@skholman-m7 grub]$ git diff grub-core/hello/hello.c > diff --git a/grub-core/hello/hello.c b/grub-core/hello/hello.c > index 456b7c3..c61bab8 100644 > --- a/grub-core/hello/hello.c > +++ b/grub-core/hello/hello.c > @@ -34,6 +34,9 @@ grub_cmd_hello (grub_extcmd_context_t ctxt > __attribute__ ((unused)), > char **args __attribute__ ((unused))) > { > grub_printf ("%s\n", _("Hello World")); > + > + grub_mm_debug = 0; > + > return 0; > } > > [stas@skholman-m7 grub]$ > > fails to build with: > > hello/hello.c: In function ‘grub_cmd_hello’: > hello/hello.c:38: error: ‘grub_mm_debug’ undeclared (first use in this > function) > hello/hello.c:38: error: (Each undeclared identifier is reported only once > hello/hello.c:38: error: for each function it appears in.) > > whereas include/grub/mm.h is included. > You need to guard use of grub_mm_debug using the same #ifdef as in include/grub/mm.h or simply include your command under #ifdef MM_DEBUG in grub-core/kern/mm.c. > As for why I need this. I'm working on > > http://lists.gnu.org/archive/html/grub-devel/2016-11/msg00124.html > > in particular on that piece of code which is to free card memory on > module unload. And I'm considering enabling MM debugging as an > additional option to verify that I call grub_free() for all the required > buffers. >