Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320539 > unrolled thread

Re: [PATCH] kexec: unmap reserved pages for each error-return way

Started byMichael Holzheu <holzheu@linux.vnet.ibm.com>
First post2016-01-28 11:40 +0100
Last post2016-01-28 15:10 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] kexec: unmap reserved pages for each error-return way Michael Holzheu <holzheu@linux.vnet.ibm.com> - 2016-01-28 11:40 +0100
    Re: [PATCH] kexec: unmap reserved pages for each error-return way Xunlei Pang <xpang@redhat.com> - 2016-01-28 13:00 +0100
      Re: [PATCH] kexec: unmap reserved pages for each error-return way Michael Holzheu <holzheu@linux.vnet.ibm.com> - 2016-01-28 13:50 +0100
        Re: [PATCH] kexec: unmap reserved pages for each error-return way Xunlei Pang <xpang@redhat.com> - 2016-01-28 14:20 +0100
          Re: [PATCH] kexec: unmap reserved pages for each error-return way Michael Holzheu <holzheu@linux.vnet.ibm.com> - 2016-01-28 15:10 +0100

#1320539 — Re: [PATCH] kexec: unmap reserved pages for each error-return way

FromMichael Holzheu <holzheu@linux.vnet.ibm.com>
Date2016-01-28 11:40 +0100
SubjectRe: [PATCH] kexec: unmap reserved pages for each error-return way
Message-ID<qVS9B-24O-25@gated-at.bofh.it>
On Wed, 27 Jan 2016 11:15:46 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > For allocation of kimage failure or kexec_prepare or load segments
> > errors there is no need to keep crashkernel memory mapped.
> > It will affect only s390 as map/unmap hook defined only for it.
> > As on unmap s390 also changes os_info structure let's check return code
> > and add info only on success.
> > 
> 
> This conflicts (both mechanically and somewhat conceptually) with
> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> crashkernel reserved memory" and "kexec: provide
> arch_kexec_protect(unprotect)_crashkres()".
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> 
> and
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
the same semantics as crash_(un)map_reserved_pages().

On s390 we don't have the crashkernel memory mapped and therefore need
crash_map_reserved_pages() before loading something into crashkernel
memory.

Perhaps I missed something?
Michael

[toc] | [next] | [standalone]


#1320606

FromXunlei Pang <xpang@redhat.com>
Date2016-01-28 13:00 +0100
Message-ID<qVTp1-2RX-19@gated-at.bofh.it>
In reply to#1320539
On 2016/01/28 at 18:32, Michael Holzheu wrote:
> On Wed, 27 Jan 2016 11:15:46 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>
>>> For allocation of kimage failure or kexec_prepare or load segments
>>> errors there is no need to keep crashkernel memory mapped.
>>> It will affect only s390 as map/unmap hook defined only for it.
>>> As on unmap s390 also changes os_info structure let's check return code
>>> and add info only on success.
>>>
>> This conflicts (both mechanically and somewhat conceptually) with
>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>> crashkernel reserved memory" and "kexec: provide
>> arch_kexec_protect(unprotect)_crashkres()".
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>
>> and
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> the same semantics as crash_(un)map_reserved_pages().
>
> On s390 we don't have the crashkernel memory mapped and therefore need
> crash_map_reserved_pages() before loading something into crashkernel
> memory.

I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
with no kernel mapping already means the protection is on?

Regards,
Xunlei

>
> Perhaps I missed something?
> Michael
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

[toc] | [prev] | [next] | [standalone]


#1320635

FromMichael Holzheu <holzheu@linux.vnet.ibm.com>
Date2016-01-28 13:50 +0100
Message-ID<qVUbp-3sP-25@gated-at.bofh.it>
In reply to#1320606
On Thu, 28 Jan 2016 19:56:56 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> > On Wed, 27 Jan 2016 11:15:46 -0800
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> >> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>
> >>> For allocation of kimage failure or kexec_prepare or load segments
> >>> errors there is no need to keep crashkernel memory mapped.
> >>> It will affect only s390 as map/unmap hook defined only for it.
> >>> As on unmap s390 also changes os_info structure let's check return code
> >>> and add info only on success.
> >>>
> >> This conflicts (both mechanically and somewhat conceptually) with
> >> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >> crashkernel reserved memory" and "kexec: provide
> >> arch_kexec_protect(unprotect)_crashkres()".
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>
> >> and
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> > Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> > the same semantics as crash_(un)map_reserved_pages().
> >
> > On s390 we don't have the crashkernel memory mapped and therefore need
> > crash_map_reserved_pages() before loading something into crashkernel
> > memory.
> 
> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> with no kernel mapping already means the protection is on?

When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
we create a memory hole without page tables.

Commit (558df7209e) was necessary to load a kernel/ramdisk into
the memory hole with the kexec() system call.

We create a temporary mapping with crash_map_reserved_pages(), then
copy the kernel/ramdisk and finally remove the mapping again
via crash_unmap_reserved_pages().

We did that all in order to protect the preloaded kernel and ramdisk.

I forgot the details why commit(558df7209e) wasn't necessary before.
AFAIK it became necessary because of some kdump (mmap?) rework.

Michael

[toc] | [prev] | [next] | [standalone]


#1320664

FromXunlei Pang <xpang@redhat.com>
Date2016-01-28 14:20 +0100
Message-ID<qVUEr-3UD-45@gated-at.bofh.it>
In reply to#1320635
On 2016/01/28 at 20:44, Michael Holzheu wrote:
> On Thu, 28 Jan 2016 19:56:56 +0800
> Xunlei Pang <xpang@redhat.com> wrote:
>
>> On 2016/01/28 at 18:32, Michael Holzheu wrote:
>>> On Wed, 27 Jan 2016 11:15:46 -0800
>>> Andrew Morton <akpm@linux-foundation.org> wrote:
>>>
>>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>>>
>>>>> For allocation of kimage failure or kexec_prepare or load segments
>>>>> errors there is no need to keep crashkernel memory mapped.
>>>>> It will affect only s390 as map/unmap hook defined only for it.
>>>>> As on unmap s390 also changes os_info structure let's check return code
>>>>> and add info only on success.
>>>>>
>>>> This conflicts (both mechanically and somewhat conceptually) with
>>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>>>> crashkernel reserved memory" and "kexec: provide
>>>> arch_kexec_protect(unprotect)_crashkres()".
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>>>
>>>> and
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
>>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
>>> the same semantics as crash_(un)map_reserved_pages().
>>>
>>> On s390 we don't have the crashkernel memory mapped and therefore need
>>> crash_map_reserved_pages() before loading something into crashkernel
>>> memory.
>> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
>> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
>> with no kernel mapping already means the protection is on?
> When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> we create a memory hole without page tables.
>
> Commit (558df7209e) was necessary to load a kernel/ramdisk into
> the memory hole with the kexec() system call.
>
> We create a temporary mapping with crash_map_reserved_pages(), then
> copy the kernel/ramdisk and finally remove the mapping again
> via crash_unmap_reserved_pages().

Thanks for the explanation.
So, on s390 the physical memory address has the same value as its kernel virtual address,
and kmap() actually returns the value of the physical address of the page, right?

>
> We did that all in order to protect the preloaded kernel and ramdisk.
>
> I forgot the details why commit(558df7209e) wasn't necessary before.
> AFAIK it became necessary because of some kdump (mmap?) rework.

Uh, this is indeed strange.

Regards,
Xunlei

>
> Michael
>

[toc] | [prev] | [next] | [standalone]


#1320706

FromMichael Holzheu <holzheu@linux.vnet.ibm.com>
Date2016-01-28 15:10 +0100
Message-ID<qVVqP-4wq-9@gated-at.bofh.it>
In reply to#1320664
On Thu, 28 Jan 2016 21:12:54 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 20:44, Michael Holzheu wrote:
> > On Thu, 28 Jan 2016 19:56:56 +0800
> > Xunlei Pang <xpang@redhat.com> wrote:
> >
> >> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> >>> On Wed, 27 Jan 2016 11:15:46 -0800
> >>> Andrew Morton <akpm@linux-foundation.org> wrote:
> >>>
> >>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>>>
> >>>>> For allocation of kimage failure or kexec_prepare or load segments
> >>>>> errors there is no need to keep crashkernel memory mapped.
> >>>>> It will affect only s390 as map/unmap hook defined only for it.
> >>>>> As on unmap s390 also changes os_info structure let's check return code
> >>>>> and add info only on success.
> >>>>>
> >>>> This conflicts (both mechanically and somewhat conceptually) with
> >>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >>>> crashkernel reserved memory" and "kexec: provide
> >>>> arch_kexec_protect(unprotect)_crashkres()".
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>>>
> >>>> and
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> >>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> >>> the same semantics as crash_(un)map_reserved_pages().
> >>>
> >>> On s390 we don't have the crashkernel memory mapped and therefore need
> >>> crash_map_reserved_pages() before loading something into crashkernel
> >>> memory.
> >> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> >> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> >> with no kernel mapping already means the protection is on?
> > When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> > we create a memory hole without page tables.
> >
> > Commit (558df7209e) was necessary to load a kernel/ramdisk into
> > the memory hole with the kexec() system call.
> >
> > We create a temporary mapping with crash_map_reserved_pages(), then
> > copy the kernel/ramdisk and finally remove the mapping again
> > via crash_unmap_reserved_pages().
> 
> Thanks for the explanation.
> So, on s390 the physical memory address has the same value as its kernel virtual address,
> and kmap() actually returns the value of the physical address of the page, right?

Correct. On s390 kmap() always return the physical address of the page.

We have an 1:1 mapping for all the physical memory. For this area
virtual=real. In addition to that we have the vmalloc area above
the 1:1 mapping where some of the memory is mapped a second time.

Michael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web