All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: "Jin, Yanjiang" <yanjiang.jin@hxt-semitech.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Bhupesh Sharma <bhsharma@redhat.com>,
	Kexec Mailing List <kexec@lists.infradead.org>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	James Morse <james.morse@arm.com>,
	Bhupesh SHARMA <bhupesh.linux@gmail.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64/mm: Introduce a variable to hold base address of linear region
Date: Tue, 19 Jun 2018 10:40:45 +0100	[thread overview]
Message-ID: <20180619094045.GD13984@arm.com> (raw)
In-Reply-To: <6860c284f1c74faa95edd6cf866ec80d@HXTBJIDCEMVIW02.hxtcorp.net>

On Tue, Jun 19, 2018 at 09:34:56AM +0000, Jin, Yanjiang wrote:
> > On Tue, Jun 19, 2018 at 03:02:15AM +0000, Jin, Yanjiang wrote:
> > > > You seem to be using this for user-space phys_to_virt() based on
> > > > values found in /proc/iomem. This should give you what you want, and
> > > > isolate your user-space from the kernel's unexpected naming of variables.
> > >
> > > I don't know could I simplify this problem?
> > > Let's ignore what memstart_addr represents here, we just want to
> > > implement
> > > phys_to_virt() in an userspace applications(kexec-tools or others).
> > >
> > > ARM64 Kernel has a below definition:
> > >
> > > #define __phys_to_virt(x)       ((unsigned long)((x) - PHYS_OFFSET) |
> > PAGE_OFFSET)
> > >
> > > So userspace app must know PHYS_OFFSET(equal to memstart_addr now).
> > > Seems this is very simple, but memstart_addr has gone through several
> > > operations in arm64_memblock_init() depends on different Kernel
> > > configurations, so userspace app needs to know many additional definitions as
> > following:
> > >
> > > memblock_start_of_DRAM(),  (ifdef CONFIG_SPARSEMEM_VMEMMAP),
> > > ARM64_MEMSTART_SHIFT,  SECTION_SIZE_BITS,  PAGE_OFFSET,
> > > memblock_end_of_DRAM(), IS_ENABLED(CONFIG_RANDOMIZE_BASE),
> > > memstart_offset_seed.
> > >
> > > It is hard to know all above in kexec-tools now. Originally I planned
> > > to read memstart_addr's value from "/dev/mem", but someone thought not
> > > all Kernels enable "/dev/mem", we'd better find a more generic
> > > approach. So we want to get some suggestions from ARM kernel community.
> > > Can we export this variable in Kernel side through sysconf() or other
> > > similar methods? Or someone can provide an effect way to get
> > > memstart_addr's value?
> >
> > I thought the suggestion from James was to expose this via an ELF NOTE in kcore
> > and vmcore (or in the header directly if that's possible, but I'm not sure about it)?
> 
> Thanks for your reply firstly. But same as DEVMEM, kcore is not a
> must-have, so we can't depend on it.

Neither is KEXEC. We can select PROC_KCORE from KEXEC if it helps.

> On the other hand, phys_to_virt() is called during generating vmcore in
> Kexec-tools, vmcore also can't help this issue.

I don't understand this part. If you have the vmcore in your hand, why can't
you grok the pv offset from the note and use that in phys_to_virt()?

> Unfortunately, not all platforms support analyzing Kernel config in
> userspace application, so Kexec-tools can't know some key kernel options.
> If not so, we can simulate the whole arm64_memblock_init()  progress in
> kexec-tools.

I don't understand what the kernel config has to do with kexec tools.

Will

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64/mm: Introduce a variable to hold base address of linear region
Date: Tue, 19 Jun 2018 10:40:45 +0100	[thread overview]
Message-ID: <20180619094045.GD13984@arm.com> (raw)
In-Reply-To: <6860c284f1c74faa95edd6cf866ec80d@HXTBJIDCEMVIW02.hxtcorp.net>

On Tue, Jun 19, 2018 at 09:34:56AM +0000, Jin, Yanjiang wrote:
> > On Tue, Jun 19, 2018 at 03:02:15AM +0000, Jin, Yanjiang wrote:
> > > > You seem to be using this for user-space phys_to_virt() based on
> > > > values found in /proc/iomem. This should give you what you want, and
> > > > isolate your user-space from the kernel's unexpected naming of variables.
> > >
> > > I don't know could I simplify this problem?
> > > Let's ignore what memstart_addr represents here, we just want to
> > > implement
> > > phys_to_virt() in an userspace applications(kexec-tools or others).
> > >
> > > ARM64 Kernel has a below definition:
> > >
> > > #define __phys_to_virt(x)       ((unsigned long)((x) - PHYS_OFFSET) |
> > PAGE_OFFSET)
> > >
> > > So userspace app must know PHYS_OFFSET(equal to memstart_addr now).
> > > Seems this is very simple, but memstart_addr has gone through several
> > > operations in arm64_memblock_init() depends on different Kernel
> > > configurations, so userspace app needs to know many additional definitions as
> > following:
> > >
> > > memblock_start_of_DRAM(),  (ifdef CONFIG_SPARSEMEM_VMEMMAP),
> > > ARM64_MEMSTART_SHIFT,  SECTION_SIZE_BITS,  PAGE_OFFSET,
> > > memblock_end_of_DRAM(), IS_ENABLED(CONFIG_RANDOMIZE_BASE),
> > > memstart_offset_seed.
> > >
> > > It is hard to know all above in kexec-tools now. Originally I planned
> > > to read memstart_addr's value from "/dev/mem", but someone thought not
> > > all Kernels enable "/dev/mem", we'd better find a more generic
> > > approach. So we want to get some suggestions from ARM kernel community.
> > > Can we export this variable in Kernel side through sysconf() or other
> > > similar methods? Or someone can provide an effect way to get
> > > memstart_addr's value?
> >
> > I thought the suggestion from James was to expose this via an ELF NOTE in kcore
> > and vmcore (or in the header directly if that's possible, but I'm not sure about it)?
> 
> Thanks for your reply firstly. But same as DEVMEM, kcore is not a
> must-have, so we can't depend on it.

Neither is KEXEC. We can select PROC_KCORE from KEXEC if it helps.

> On the other hand, phys_to_virt() is called during generating vmcore in
> Kexec-tools, vmcore also can't help this issue.

I don't understand this part. If you have the vmcore in your hand, why can't
you grok the pv offset from the note and use that in phys_to_virt()?

> Unfortunately, not all platforms support analyzing Kernel config in
> userspace application, so Kexec-tools can't know some key kernel options.
> If not so, we can simulate the whole arm64_memblock_init()  progress in
> kexec-tools.

I don't understand what the kernel config has to do with kexec tools.

Will

  reply	other threads:[~2018-06-19  9:40 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12  6:36 [PATCH] arm64/mm: Introduce a variable to hold base address of linear region Bhupesh Sharma
2018-06-12  6:36 ` Bhupesh Sharma
2018-06-12  6:53 ` Ard Biesheuvel
2018-06-12  6:53   ` Ard Biesheuvel
2018-06-12  8:25   ` Bhupesh Sharma
2018-06-12  8:25     ` Bhupesh Sharma
2018-06-12 10:12     ` James Morse
2018-06-12 10:12       ` James Morse
2018-06-13  5:16       ` Bhupesh Sharma
2018-06-13  5:16         ` Bhupesh Sharma
2018-06-13 10:11         ` Will Deacon
2018-06-13 10:11           ` Will Deacon
2018-06-14  6:23           ` Bhupesh Sharma
2018-06-14  6:23             ` Bhupesh Sharma
2018-06-15 16:52             ` Will Deacon
2018-06-15 16:52               ` Will Deacon
2018-06-15 20:02               ` Bhupesh Sharma
2018-06-15 20:02                 ` Bhupesh Sharma
2018-06-13 10:29         ` James Morse
2018-06-13 10:29           ` James Morse
2018-06-14  7:53           ` Bhupesh Sharma
2018-06-14  7:53             ` Bhupesh Sharma
2018-06-14 16:17             ` James Morse
2018-06-14 16:17               ` James Morse
2018-06-19  3:02               ` Jin, Yanjiang
2018-06-19  3:02                 ` Jin, Yanjiang
2018-06-19  8:55                 ` Will Deacon
2018-06-19  8:55                   ` Will Deacon
2018-06-19  9:34                   ` Jin, Yanjiang
2018-06-19  9:34                     ` Jin, Yanjiang
2018-06-19  9:40                     ` Will Deacon [this message]
2018-06-19  9:40                       ` Will Deacon
2018-06-19  9:57                       ` Jin, Yanjiang
2018-06-19  9:57                         ` Jin, Yanjiang
2018-06-19 10:16                         ` James Morse
2018-06-19 10:16                           ` James Morse
2018-06-19 10:37                           ` Bhupesh Sharma
2018-06-19 10:37                             ` Bhupesh Sharma
2018-06-19 11:26                             ` James Morse
2018-06-19 11:26                               ` James Morse
2018-06-19 11:58                               ` Bhupesh Sharma
2018-06-19 11:58                                 ` Bhupesh Sharma
2018-06-20  2:16                                 ` Jin, Yanjiang
2018-06-20  2:16                                   ` Jin, Yanjiang
2018-06-20  7:26                                   ` Bhupesh Sharma
2018-06-20  7:26                                     ` Bhupesh Sharma
2018-06-20 10:06                                     ` James Morse
2018-06-20 10:06                                       ` James Morse
2018-07-11 13:24                                     ` James Morse
2018-07-11 13:24                                       ` James Morse
2018-07-11 15:36                                       ` Bhupesh Sharma
2018-07-11 15:36                                         ` Bhupesh Sharma
2018-07-11 16:24                                         ` Omar Sandoval
2018-07-11 16:24                                           ` Omar Sandoval

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=20180619094045.GD13984@arm.com \
    --to=will.deacon@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhsharma@redhat.com \
    --cc=bhupesh.linux@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=yanjiang.jin@hxt-semitech.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.