All of lore.kernel.org
 help / color / mirror / Atom feed
From: nikhil.subscribed@gmail.com (Nikhil Utane)
To: kernelnewbies@lists.kernelnewbies.org
Subject: memblock_reserve or memblock_remove to reserve a page
Date: Wed, 28 Sep 2016 18:55:55 +0530	[thread overview]
Message-ID: <CAGNWmJVq=WC8DVHW_EHmks2vZYxq-_JdjBfVOdKjbunhyWAUpg@mail.gmail.com> (raw)
In-Reply-To: <CABOM9ZpbjVuHkpSbipZEBrMqvpmHF741d8bCHGjGKNgvHc+98w@mail.gmail.com>

base1 = 0xA4D000; size1=0x1000;
memblock_reserve (base1, size1);

(In a separate static driver code)
request_mem_region_exclusive (0x00A4D000, 4096, "csSIGILL")

If a driver requests for a memory region, shouldn't the kernel then not
allocate it for any other purpose?

-Regards
Nikhil

On Wed, Sep 28, 2016 at 3:12 PM, Arun Sudhilal <getarunks@gmail.com> wrote:

> Hello Nikhil,
>
> On Wed, Sep 28, 2016 at 2:41 PM, Nikhil Utane
> <nikhil.subscribed@gmail.com> wrote:
> > Arun,
> >
> > What seems to have done the trick is calling memblock_remove() followed
> by a
> > call to request_mem_region(). This creates a hole which can be confirmed
> in
> > the output of /proc/iomem.
> >
> > Do you see any issue with this approach?
>
> I really don't know how it works for you. Marking address of a page as
> iomem.  How buddy allocator ignores this page?
> request_mem_region() is a way of managing IO resource memory, to avoid
> two drivers using same IO memory. It has not relation with buddy
> allocator.
>
> Can you post code snippet?
>
> Regards,
> Arun
>
> >
> > -Thanks
> > Nikhil
> >
> > On Tue, Sep 27, 2016 at 4:14 PM, Arun Sudhilal <getarunks@gmail.com>
> wrote:
> >>
> >> Hello Nikhil,
> >>
> >> On Fri, Sep 9, 2016 at 7:01 AM, Nikhil Utane
> >> <nikhil.subscribed@gmail.com> wrote:
> >> > I want to reserve a physical memory page with a fixed PFN. I do not
> want
> >> > this page to be used by anyone else. I am calling memblock_reserve()
> to
> >> > supposedly reserve the page. I am writing some content into this page.
> >> > What
> >> > I see is that during some runs the content of this page is modified
> >> > (either
> >> > fully or sometimes partially). In few runs, I see it as intact. Is it
> >> > expected that even after calling memblock_reserve() the kernel can
> >> > allocate
> >> > this physical page for any other purpose? How is memblock_remove()
> >> > different
> >> > from memblock_reserve? I tried reading up but didn't see any useful
> >> > information. What I understood is memblock_remove will completely
> remove
> >> > from kernel's allocation mechanism. Should I then be using remove
> >> > instead of
> >> > reserve?
> >>
> >> when a DT entry is added to  #reserved-memory node, what
> >> drivers/of/fdt.c does is to call memblock_remove() and
> >> memblock_reserve().
> >> This happens after the memblock driver is initialized but before buddy
> >> allocator up. Did you try this approach? This should work for you.
> >>
> >> Only option once the kernel boot is complete is to try out the
> >> technique what mm/memory_hotplug.c does while offline memory.
> >> isolate_page_range and then migrate.
> >>
> >> Regards,
> >> Arun
> >>
> >>
> >> >
> >> > -Thanks
> >> > Nikhil
> >> >
> >> > _______________________________________________
> >> > Kernelnewbies mailing list
> >> > Kernelnewbies at kernelnewbies.org
> >> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/236b960d/attachment.html 

  reply	other threads:[~2016-09-28 13:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  1:31 memblock_reserve or memblock_remove to reserve a page Nikhil Utane
2016-09-09  9:29 ` Nikhil Utane
2016-09-11  0:38   ` Min-Hua Chen
2016-09-14  7:17     ` Nikhil Utane
2016-09-15  0:05       ` Min-Hua Chen
2016-09-15  8:23         ` Nikhil Utane
2016-09-15 23:22           ` Min-Hua Chen
2016-09-16 10:08             ` Nikhil Utane
2016-09-27 10:44 ` Arun Sudhilal
2016-09-28  9:11   ` Nikhil Utane
2016-09-28  9:42     ` Arun Sudhilal
2016-09-28 13:25       ` Nikhil Utane [this message]
2016-09-29  5:55         ` Nikhil Utane
2016-10-03 12:32         ` Arun Sudhilal
2016-10-03 12:45           ` Arun Sudhilal
2016-10-04  5:40             ` Nikhil Utane

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='CAGNWmJVq=WC8DVHW_EHmks2vZYxq-_JdjBfVOdKjbunhyWAUpg@mail.gmail.com' \
    --to=nikhil.subscribed@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 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.