Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Georgi Djakov <georgi.djakov@oss.qualcomm.com>,
	akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org, osalvador@suse.de,
	gregkh@linuxfoundation.org, rafael@kernel.org, djakov@kernel.org
Subject: Re: [PATCH] drivers/base/memory: set mem->altmap after successful device registration
Date: Wed, 13 May 2026 15:14:37 +0200	[thread overview]
Message-ID: <f25f1ef0-5359-4c00-920d-cdfc37cda968@kernel.org> (raw)
In-Reply-To: <20260513130900.2204499-1-georgi.djakov@oss.qualcomm.com>

On 5/13/26 15:09, Georgi Djakov wrote:
> If __add_memory_block() fails at xa_store() (under memory pressure
> for example), device_unregister() is called, which eventually
> triggers memory_block_release() with mem->altmap still set, causing
> a WARN_ON(mem->altmap).
> 
> WARNING: CPU: 1 PID: 76 at drivers/base/memory.c:96 memory_block_release+0x28/0x30
> Call trace:
>  memory_block_release+0x28/0x30 (P)
>  kobject_put+0xc8/0x1bc
>  device_unregister+0x2c/0x68
>  add_memory_block+0x1b4/0x214
>  create_memory_block_devices+0x9c/0xfc
>  create_altmaps_and_memory_blocks+0x130/0x1cc
>  add_memory_resource+0x10c/0x21c
>  add_memory_driver_managed+0xb8/0xe8
>  virtio_mem_add_memory+0xa4/0x194 [virtio_mem]
>  virtio_mem_sbm_plug_and_add_mb+0xc8/0x16c [virtio_mem]
>  virtio_mem_run_wq+0xea8/0x1088 [virtio_mem]
>  process_scheduled_works+0x18c/0x300
>  worker_thread+0x1dc/0x2b8
>  kthread+0x1ac/0x1f4
>  ret_from_fork+0x10/0x20
> 
> Fix this by delaying the assignment of mem->altmap until after
> __add_memory_block() has succeeded.

Something does not add up here. How do you get an altmap with virtio-mem?


-- 
Cheers,

David


  reply	other threads:[~2026-05-13 13:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 13:09 [PATCH] drivers/base/memory: set mem->altmap after successful device registration Georgi Djakov
2026-05-13 13:14 ` David Hildenbrand (Arm) [this message]
2026-05-13 13:20   ` David Hildenbrand (Arm)
2026-05-13 16:01     ` Georgi Djakov
2026-05-13 16:07       ` David Hildenbrand (Arm)

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=f25f1ef0-5359-4c00-920d-cdfc37cda968@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=djakov@kernel.org \
    --cc=georgi.djakov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=rafael@kernel.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