linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
To: Hillf Danton <hdanton@sina.com>
Cc: Dave Airlie <airlied@gmail.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	 "Koenig, Christian" <Christian.Koenig@amd.com>,
	Harry Wentland <harry.wentland@amd.com>,
	 amd-gfx list <amd-gfx@lists.freedesktop.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	 Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: The issue with page allocation 5.3 rc1-rc2 (seems drm culprit here)
Date: Mon, 5 Aug 2019 22:14:47 +0500	[thread overview]
Message-ID: <CABXGCsM3-Ax0jsLS=QCM6m331onGXLEcfmmc_kLdqgOLzMSj9Q@mail.gmail.com> (raw)
In-Reply-To: <20190805032114.8740-1-hdanton@sina.com>

On Mon, 5 Aug 2019 at 08:21, Hillf Danton <hdanton@sina.com> wrote:
>
>
>
> Try to fix the failure above using vmalloc + kmalloc.
>
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -1174,8 +1174,12 @@ struct dc_state *dc_create_state(struct
>         struct dc_state *context = kzalloc(sizeof(struct dc_state),
>                                            GFP_KERNEL);
>
> -       if (!context)
> -               return NULL;
> +       if (!context) {
> +               context = kvzalloc(sizeof(struct dc_state),
> +                                          GFP_KERNEL);
> +               if (!context)
> +                       return NULL;
> +       }
>         /* Each context must have their own instance of VBA and in order to
>          * initialize and obtain IP and SOC the base DML instance from DC is
>          * initially copied into every context
> @@ -1195,8 +1199,13 @@ struct dc_state *dc_copy_state(struct dc
>         struct dc_state *new_ctx = kmemdup(src_ctx,
>                         sizeof(struct dc_state), GFP_KERNEL);
>
> -       if (!new_ctx)
> -               return NULL;
> +       if (!new_ctx) {
> +               new_ctx = kvmalloc(sizeof(*new_ctx), GFP_KERNEL);
> +               if (new_ctx)
> +                       *new_ctx = *src_ctx;
> +               else
> +                       return NULL;
> +       }
>
>         for (i = 0; i < MAX_PIPES; i++) {
>                         struct pipe_ctx *cur_pipe = &new_ctx->res_ctx.pipe_ctx[i];
> @@ -1230,7 +1239,7 @@ static void dc_state_free(struct kref *k
>  {
>         struct dc_state *context = container_of(kref, struct dc_state, refcount);
>         dc_resource_state_destruct(context);
> -       kfree(context);
> +       kvfree(context);
>  }
>
>  void dc_release_state(struct dc_state *context)
> --

Unfortunately couldn't check this patch because, with the patch, the
kernel did not compile.
Here is compile error messages:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c: In function
'dc_create_state':
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1178:13: error:
implicit declaration of function 'kvzalloc'; did you mean 'kzalloc'?
[-Werror=implicit-function-declaration]
 1178 |   context = kvzalloc(sizeof(struct dc_state),
      |             ^~~~~~~~
      |             kzalloc
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1178:11: warning:
assignment to 'struct dc_state *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
 1178 |   context = kvzalloc(sizeof(struct dc_state),
      |           ^
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c: In function 'dc_copy_state':
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1203:13: error:
implicit declaration of function 'kvmalloc'; did you mean 'kmalloc'?
[-Werror=implicit-function-declaration]
 1203 |   new_ctx = kvmalloc(sizeof(*new_ctx), GFP_KERNEL);
      |             ^~~~~~~~
      |             kmalloc
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1203:11: warning:
assignment to 'struct dc_state *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
 1203 |   new_ctx = kvmalloc(sizeof(*new_ctx), GFP_KERNEL);
      |           ^
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c: In function 'dc_state_free':
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:1242:2: error:
implicit declaration of function 'kvfree'; did you mean 'kzfree'?
[-Werror=implicit-function-declaration]
 1242 |  kvfree(context);
      |  ^~~~~~
      |  kzfree
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:274:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:490: drivers/gpu/drm/amd/amdgpu] Error 2
make[3]: *** Waiting for unfinished jobs....
make: *** [Makefile:1084: drivers] Error 2


--
Best Regards,
Mike Gavrilov.


  reply	other threads:[~2019-08-05 17:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05  3:21 The issue with page allocation 5.3 rc1-rc2 (seems drm culprit here) Hillf Danton
2019-08-05 17:14 ` Mikhail Gavrilov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  7:42 Hillf Danton
2019-08-06  1:48 Hillf Danton
2019-08-08  3:48 ` Mikhail Gavrilov
2019-08-08  5:31   ` Alex Deucher
2019-08-08  8:12     ` Michel Dänzer
2019-08-08 14:26       ` Alex Deucher
2019-08-09 18:55         ` Mikhail Gavrilov
2019-08-10 16:08           ` Mikhail Gavrilov
2019-08-04 22:23 Mikhail Gavrilov
2019-08-05  1:03 ` Dave Airlie

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='CABXGCsM3-Ax0jsLS=QCM6m331onGXLEcfmmc_kLdqgOLzMSj9Q@mail.gmail.com' \
    --to=mikhail.v.gavrilov@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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;
as well as URLs for NNTP newsgroup(s).