linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Eric Ren <renzhengeek@gmail.com>
To: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>
Subject: [Question] mm/resource: a mistake to use IORESOURCE_SYSRAM instead of IORESOURCE_SYSTEM_RAM?
Date: Tue, 21 Dec 2021 18:14:28 +0800	[thread overview]
Message-ID: <a17e584b-9ef2-9b56-dd9d-b4b89ec1755d@gmail.com> (raw)

Hi David,

I feel confused on this piece of code:

```
void release_mem_region_adjustable(resource_size_t start, 
resource_size_t size)
{
... snip
/*
          * All memory regions added from memory-hotplug path have the
          * flag IORESOURCE_SYSTEM_RAM. If the resource does not have
          * this flag, we know that we are dealing with a resource coming
          * from HMM/devm. HMM/devm use another mechanism to add/release
          * a resource. This goes via devm_request_mem_region and
          * devm_release_mem_region.
          * HMM/devm take care to release their resources when they want,
          * so if we are dealing with them, let us just back off here.
          */
         if (!(res->flags & IORESOURCE_SYSRAM)) {
             break;
         }
```

The comment says IORESOURCE_SYSTEM_RAM while IORESOURCE_SYSRAM is 
actually used.
Is this a mistake?

The reason why I come to read about this is that, I got -EEXIST error from
add_memory_driver_managed() when I want to virtio_mem regions sitting on 
Reserved
memory region like this in /proc/iomem:
```
fffc0000-183fffffff : Reserved
   100000000-183fffffff : System RAM (virtio_mem)
     1820000000-183fffffff : System RAM (virtio_mem) // --> plugged MB
```

EEXIST error happens after plug -> unplug -> plug testing, because the
hot-added region remains after unplug. The hot-added region is under
Reserved region. The IORESOURCE_SYSRAM flag check will skips to handle
children of the Reserved region.
Thanks in advance!
Eric



             reply	other threads:[~2021-12-21 10:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 10:14 Eric Ren [this message]
     [not found] ` <92d3d4c3-5756-5df5-36e1-ad2e99aef21f@redhat.com>
2021-12-21 14:14   ` Eric Ren

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=a17e584b-9ef2-9b56-dd9d-b4b89ec1755d@gmail.com \
    --to=renzhengeek@gmail.com \
    --cc=david@redhat.com \
    --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