All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Rosenzweig <alyssa@collabora.com>
To: Adri??n Larumbe <adrian.larumbe@collabora.com>
Cc: dri-devel@lists.freedesktop.org, alyssa.rosenzweig@collabora.com,
	tomeu.vizoso@collabora.com, steven.price@arm.com
Subject: Re: [PATCH v2 1/1] drm/panfrost: Add support for devcoredump
Date: Wed, 22 Jun 2022 08:08:24 -0400	[thread overview]
Message-ID: <YrMGOOqJZmJD+Z5X@maud> (raw)
In-Reply-To: <20220622015455.pqiiqevouh7udj7y@sobremesa>

> > > +	iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN |
> > > +			__GFP_NORETRY);
> > > +	if (!iter.start) {
> > > +		dev_warn(pfdev->dev, "failed to allocate devcoredump file\n");
> > > +		return;
> > > +	}
> > > ...
> > > +	memset(iter.hdr, 0, iter.data - iter.start);
> > 
> > Why are we using __GFP_NOWARN and __GFP_NORETRY? Why not plain vmalloc?
> > 
> > Also, why vmalloc instead of vzalloc? (Or adding __GFP_ZERO to the list
> > of __vmalloc flags if __GFP_NOWARN/__GFP_NORETRY are really needed?) Are
> > there relevant performance or security considerations?
> 
> I borrowed this code from Etnaviv a while ago and the same doubt struck me
> then. My understanding of its intended behaviour is that because the dump file
> might be huge, we don't want the memory manager to trigger the OOM killer and
> annoy quite a few running processes because of a debug feature. Also since the
> code already handles the situation when an allocation fails by refusing to
> generate a dump, there's no need for the allocator to generate specific error
> messages.
> 
> So I guess it boils down to 'if there's quite enough memory to allocate a huge
> dump file, go ahead, otherwise don't reclaim any processes' pages for something
> that isn't essential'.
> 
> I don't see much use for __GFP_ZERO in this case, because the dump file gets
> memcpy'd with the contents of every single bo so whatever the original
> contents of the memory were at the time of the allocation, they're overwritten
> immediately.

I think that's a reasonable explanation, bearing in mind I'm firmly a
userspace person ;-)

Please add a comment explaining the assumptions here, though, because
the code will live longer than this ML thread.

> I've also rebased v3 on top of drm-misc-next and the compiler error because of
> the removed panfrost_job structure member is gone.

Excellent

  reply	other threads:[~2022-06-22 12:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21  2:32 [PATCH v2 0/1] devcoredump support for Panfrost GPU driver Adrián Larumbe
2022-06-21  2:32 ` [PATCH v2 1/1] drm/panfrost: Add support for devcoredump Adrián Larumbe
2022-06-21  4:37   ` kernel test robot
2022-06-21 14:32     ` Alyssa Rosenzweig
2022-06-21 14:32       ` Alyssa Rosenzweig
2022-06-22  2:30       ` [kbuild-all] " Chen, Rong A
2022-06-22 12:06         ` Alyssa Rosenzweig
2022-06-22 12:06           ` Alyssa Rosenzweig
2022-06-21  5:46   ` kernel test robot
2022-06-21  7:37   ` kernel test robot
2022-06-21  7:37     ` kernel test robot
2022-06-21 13:03   ` Alyssa Rosenzweig
2022-06-22  1:54     ` Adri??n Larumbe
2022-06-22 12:08       ` Alyssa Rosenzweig [this message]
2022-06-22 13:22       ` Lucas Stach

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-all 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=YrMGOOqJZmJD+Z5X@maud \
    --to=alyssa@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=steven.price@arm.com \
    --cc=tomeu.vizoso@collabora.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.