public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: kexec@lists.infradead.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Jan Willeke <willeke@de.ibm.com>,
	linux-kernel@vger.kernel.org,
	HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Zhang Yanfei <zhangyanfei.yes@gmail.com>
Subject: Re: [PATCH 0/2] kdump/mmap: Fix mmap of /proc/vmcore for s390
Date: Mon, 3 Jun 2013 15:27:18 +0200	[thread overview]
Message-ID: <20130603152718.5ba4d05f@holzheu> (raw)
In-Reply-To: <20130531160158.GC13057@redhat.com>

On Fri, 31 May 2013 12:01:58 -0400
Vivek Goyal <vgoyal@redhat.com> wrote:

> On Fri, May 31, 2013 at 04:21:27PM +0200, Michael Holzheu wrote:
> > On Thu, 30 May 2013 16:38:47 -0400
> > Vivek Goyal <vgoyal@redhat.com> wrote:
> > 
> > > On Wed, May 29, 2013 at 01:51:44PM +0200, Michael Holzheu wrote:
> > > 

[...]

> > For zfcpdump currently we add a load from [0, HSA_SIZE] where
> > p_offset equals p_paddr. Therefore we can't distinguish in
> > copy_oldmem_page() if we read from oldmem (HSA) or newmem. The
> > range [0, HSA_SIZE] is used twice. As a workaroun we could use an
> > artificial p_offset for the HSA memory chunk that is not used by
> > the 1st kernel physical memory. This is not really beautiful, but
> > probably doable.
> 
> Ok, zfcpdump is a problem because HSA memory region is in addition to
> regular memory address space. 

Right and the HSA memory is accessed with a read() interface and can't
be directly mapped.

[...]

> If you decide not to do that, agreed that copy_oldmem_page() need to
> differentiate between reference to HSA memory and reference to new
> memory. I guess in that case we will have to go with original proposal
> of using arch functions to access and read headers.

Let me think about that a bit more ...

[...]

> > If copy_oldmem_page() now also must be able to copy to vmalloc
> > memory, we would have to add new code for that:
> > 
> > * oldmem -> newmem (real): Use direct memcpy_real()
> > * oldmem -> newmem (vmalloc): Use intermediate buffer with
> > memcpy_real()
> > * newmem -> newmem: Use memcpy()
> > 
> > What do you think?
> 
> Yep, looks like you will have to do something like that.
> 
> Can't we map HSA frames temporarily, copy data and tear down the
> mapping?

Yes, we would have to create a *temporarily* mapping (see suggestion
below). We do not have enough memory to copy the complete HSA.
 
> If not, how would remap_pfn_range() work with HSA region when
> /proc/vmcore is mmaped()?

I am no memory management expert, so I discussed that with Martin
Schwidefsky (s390 architecture maintainer). Perhaps something like
the following could work:

After vmcore_mmap() is called the HSA pages are not initially mapped in
the page tables. So when user space accesses those parts
of /proc/vmcore, a fault will be generated. We implement a mechanism
that in this case the HSA is copied to a new page in the page cache and
a mapping is created for it. Since the page is allocated in the page
cache, it can be released afterwards by the kernel when we get memory
pressure.

Our current idea for such an implementation:

* Create new address space (struct address_space) for /proc/vmcore.
* Implement new vm_operations_struct "vmcore_mmap_ops" with
  new vmcore_fault() ".fault" callback for /proc/vmcore.
* Set vma->vm_ops to vmcore_mmap_ops in mmap_vmcore().
* The vmcore_fault() function will get a new page cache page,
  copy HSA page to page cache page add it to vmcore address space.
  To see how this could work, we looked into the functions
  filemap_fault() in "mm/filemap.c" and relay_buf_fault() in
  "kernel/relay.c".

What do you think?

Michael


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

  reply	other threads:[~2013-06-03 13:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 13:08 [PATCH 0/2] kdump/mmap: Fix mmap of /proc/vmcore for s390 Michael Holzheu
2013-05-24 13:08 ` [PATCH 1/2] kdump/mmap: Introduce arch_oldmem_remap_pfn_range() Michael Holzheu
2013-05-24 13:08 ` [PATCH 2/2] s390/kdump/mmap: Implement arch_oldmem_remap_pfn_range() for s390 Michael Holzheu
2013-05-24 14:36 ` [PATCH 0/2] kdump/mmap: Fix mmap of /proc/vmcore " Vivek Goyal
2013-05-24 15:06   ` Michael Holzheu
2013-05-24 15:28     ` Vivek Goyal
2013-05-24 16:46       ` Michael Holzheu
2013-05-24 17:05         ` Vivek Goyal
2013-05-25 13:13           ` Michael Holzheu
2013-05-24 22:44       ` Eric W. Biederman
2013-05-25  0:33         ` Zhang Yanfei
2013-05-25  3:01           ` Eric W. Biederman
2013-05-25  8:31             ` Zhang Yanfei
2013-05-25 12:52               ` Michael Holzheu
2013-05-28 13:55                 ` Vivek Goyal
2013-05-29 11:51                   ` Michael Holzheu
2013-05-29 16:23                     ` Vivek Goyal
2013-05-29 17:12                       ` Michael Holzheu
2013-05-30 15:00                         ` Vivek Goyal
2013-05-30 20:38                     ` Vivek Goyal
2013-05-31 14:21                       ` Michael Holzheu
2013-05-31 16:01                         ` Vivek Goyal
2013-06-03 13:27                           ` Michael Holzheu [this message]
2013-06-03 15:59                             ` Vivek Goyal
2013-06-03 16:48                               ` Michael Holzheu
2013-05-28 14:44                 ` Vivek Goyal
2013-05-25 20:36               ` Eric W. Biederman

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=20130603152718.5ba4d05f@holzheu \
    --to=holzheu@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=ebiederm@xmission.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=vgoyal@redhat.com \
    --cc=willeke@de.ibm.com \
    --cc=zhangyanfei.yes@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox