public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Andrew Fish <afish@apple.com>, edk2-devel <edk2-devel@lists.01.org>
Subject: Re: Does a double Page free report "ConvertPages: Incompatible memory types", maybe we could do better.
Date: Thu, 10 Aug 2017 12:19:33 +0200	[thread overview]
Message-ID: <57fe7358-6acd-0b47-ee00-0dd333d4ddeb@redhat.com> (raw)
In-Reply-To: <41A7B048-4140-4889-AE7C-36A0ED3B8C1C@apple.com>

On 08/10/17 03:03, Andrew Fish wrote:
> It looks to me like if you Free pages, after you free pages you hit this DEBUG message. 
> 
> 
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Mem/Page.c#L790
> 
>       if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) {
>         DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types\n"));
>         return EFI_NOT_FOUND;
>       }
> 
> I'm not sure I've thought out all the paths, but would it make more sense if you are trying to convert EfiConventionalMemory to EfiConventionalMemory that you are trying to free pages that are already freed. That is not very obvious from the above DEBUG print.  Could there be an if in the error path to print a better DEBUG message for a free pages bug? 
> 
> Also to be pedantic the function change names to: CoreConvertPagesEx(). 

(Reacting only to this side question:)

I generally prefer:

  DEBUG ((
    DebugMask,
    "%a: ...",
    __FUNCTION__,
    ...
    ));

This way when the function is renamed, or the DEBUG is moved to another
function, the log will update itself.

Taking it one step further: if the DEBUG is in a widely used library
instance, then I like

  DEBUG ((
    DebugMask,
    "%a:%a: ...",
    gEfiCallerBaseName,
    __FUNCTION__,
    ...
    ));

Because this identifies the calling driver module as well (using the
BASE_NAME from the module's INF file).

("%g" with &gEfiCallerIdGuid would be more robust than "%a" with
gEfiCallerBaseName, but the log should also be readable...)

Thanks
Laszlo


      parent reply	other threads:[~2017-08-10 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10  1:03 Does a double Page free report "ConvertPages: Incompatible memory types", maybe we could do better Andrew Fish
2017-08-10  1:33 ` Zeng, Star
2017-08-10 20:53   ` Andrew Fish
2017-08-10 10:19 ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57fe7358-6acd-0b47-ee00-0dd333d4ddeb@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox