linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Bhupesh Sharma <bhsharma@redhat.com>
To: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	"lijiang@redhat.com" <lijiang@redhat.com>,
	"bhe@redhat.com" <bhe@redhat.com>,
	"ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	Steve Capper <Steve.Capper@arm.com>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	Will Deacon <will.deacon@arm.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	James Morse <james.morse@arm.com>,
	Kristina Martsenko <kristina.martsenko@arm.com>,
	Borislav Petkov <bp@alien8.de>,
	"anderson@redhat.com" <anderson@redhat.com>,
	Dave Young <dyoung@redhat.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64, vmcoreinfo : Append 'MAX_USER_VA_BITS' and 'MAX_PHYSMEM_BITS' to vmcoreinfo
Date: Thu, 21 Feb 2019 21:50:30 +0530	[thread overview]
Message-ID: <891eaf5a-aede-364d-6465-832e377c3e29@redhat.com> (raw)
In-Reply-To: <4AE2DC15AC0B8543882A74EA0D43DBEC03568A9F@BPXM09GP.gisp.nec.co.jp>

Hi Kazu,

On 02/20/2019 02:17 AM, Kazuhito Hagio wrote:
> Hi Bhupesh,
> 
> -----Original Message-----
>> I am not sure you got a chance to look at the two regression cases I
>> reported here:
>> <http://lists.infradead.org/pipermail/kexec/2019-February/022449.html>
>>
>> Unfortunately the above suggestion doesn't provide any fix for
>> ARMv8.2-LPA regression (see text under heading '
>> (1). Regression Case 1 (ARMv8.2-LPA enabled kernel)')
> 
> As for MAX_PHYSMEM_BITS, I realized that ppc64 makedumpfile can detect
> it because there is only one SECTION_SIZE_BITS for ppc64. I think we
> can use the same way as set_ppc64_max_physmem_bits() does also for
> arm64 for now. I'm going to write it for kernels not having
> NUMBER(MAX_PHYSMEM_BITS) in vmcoreinfo.

I see two drawbacks with the above approach:

a). This means that other user-space tools like crash-utility would 
still be broken and would probably need to find MAX_PHYSMEM_BITS for 
arm64 via a similar (hack'ish ?) approach.

b). I am looking at the makedumpfile code for 'MAX_PHYSMEM_BITS' 
determination for two archs as an example:

ppc
---

int
set_ppc64_max_physmem_bits(void)
{
         long array_len = ARRAY_LENGTH(mem_section);
         /*
          * The older ppc64 kernels uses _MAX_PHYSMEM_BITS as 42 and the
          * newer kernels 3.7 onwards uses 46 bits.
          */

         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_ORIG ;
         if ((array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT_EXTREME()))
                 || (array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT())))
                 return TRUE;

         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_3_7;
         if ((array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT_EXTREME()))
                 || (array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT())))
                 return TRUE;

         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_4_19;
         if ((array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT_EXTREME()))
                 || (array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT())))
                 return TRUE;

         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_4_20;
         if ((array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT_EXTREME()))
                 || (array_len == (NR_MEM_SECTIONS() / 
_SECTIONS_PER_ROOT())))
                 return TRUE;

         return FALSE;
}

x86_64:
------

int
get_versiondep_info_x86_64(void)
{
     /*
      * On linux-2.6.26, MAX_PHYSMEM_BITS is changed to 44 from 40.
      */
     if (info->kernel_version < KERNEL_VERSION(2, 6, 26))
         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_ORIG;
     else if (info->kernel_version < KERNEL_VERSION(2, 6, 31))
         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_2_6_26;
     else if(check_5level_paging())
         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_5LEVEL;
     else
         info->max_physmem_bits  = _MAX_PHYSMEM_BITS_2_6_31;

     ...
}

Looking at the above, two questions come to my mind:

- Do we really need all the above complexity in user-space code, to hoop 
across various kernel versions and perform allocations for something 
that can be so easily exported via vmcoreinfo? Also we need to see how 
portable is the above code for a new kernel version - IMO, it will need 
another fix patch when we update to a new kernel version in near future.

- Also do we need to replicate the above implementations across 
user-space tools when they can also utilize the vmcoreinfo information 
to determine the PA_BITS range without any additional arch/kernel 
version specific details as the single point of obtaining this 
information from the kernel?

So, in view of the above, I would still advocate that we use a 
vmcoreinfo export for 'MAX_PHYSMEM_BITS' as well to have a uniform 
interface for the same across all user-land applications.

Thanks,
Bhupesh


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-21 16:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 12:23 [PATCH] arm64, vmcoreinfo : Append 'MAX_USER_VA_BITS' and 'MAX_PHYSMEM_BITS' to vmcoreinfo Bhupesh Sharma
2019-01-30 15:21 ` James Morse
2019-01-30 21:39   ` Bhupesh Sharma
2019-02-04 14:35     ` Bhupesh Sharma
2019-02-04 15:31       ` Robin Murphy
2019-02-12  4:55         ` Bhupesh Sharma
2019-02-12 10:49           ` Robin Murphy
2019-02-04 16:56       ` James Morse
2019-01-31  1:48 ` Dave Young
2019-01-31 10:00   ` Bhupesh Sharma
2019-01-31 14:03   ` Dave Anderson
2019-02-04 16:04   ` Kazuhito Hagio
2019-02-12  5:07     ` Bhupesh Sharma
2019-02-12 10:44       ` Dave Young
2019-02-12 19:59         ` Bhupesh Sharma
2019-02-12 23:03           ` Kazuhito Hagio
2019-02-13 11:15             ` Dave Young
2019-02-13 18:22               ` James Morse
2019-02-13 19:52                 ` Kazuhito Hagio
2019-02-15 17:34                   ` James Morse
2019-02-15 18:01                     ` Bhupesh Sharma
2019-02-18 15:27                       ` Steve Capper
2019-02-21 16:08                         ` Bhupesh Sharma
2019-02-19 20:47                       ` Kazuhito Hagio
2019-02-21 16:20                         ` Bhupesh Sharma [this message]
2019-02-21 16:42                           ` Dave Anderson
2019-02-21 19:02                             ` Kazuhito Hagio
2019-03-01  4:01                               ` Bhupesh Sharma
2019-02-14 19:30                 ` Bhupesh Sharma

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=891eaf5a-aede-364d-6465-832e377c3e29@redhat.com \
    --to=bhsharma@redhat.com \
    --cc=Steve.Capper@arm.com \
    --cc=anderson@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dyoung@redhat.com \
    --cc=james.morse@arm.com \
    --cc=k-hagio@ab.jp.nec.com \
    --cc=kexec@lists.infradead.org \
    --cc=kristina.martsenko@arm.com \
    --cc=lijiang@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).