All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Smarduch <m.smarduch@samsung.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Christopher Covington <cov@codeaurora.org>
Cc: Christoffer Dall <christoffer.dall@linaro.org>,
	Rob Herring <robherring2@gmail.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Catalin Marinas <catalin.marinas@arm.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] KVM/arm: kernel low level debug support for ARM32 virtual platforms
Date: Wed, 04 Nov 2015 15:28:34 -0800	[thread overview]
Message-ID: <563A94A2.3010307@samsung.com> (raw)
In-Reply-To: <CAKv+Gu8GJgzv82fVfCU7VQB2_ckRkzUYcQOx51rT2WgnmO_fsw@mail.gmail.com>



On 11/4/2015 10:51 AM, Ard Biesheuvel wrote:
> On 4 November 2015 at 19:49, Christopher Covington <cov@codeaurora.org> wrote:
>> On 11/04/2015 08:31 AM, Christoffer Dall wrote:
>>> On Tue, Nov 03, 2015 at 01:39:44PM -0600, Rob Herring wrote:
>>>> On Tue, Nov 3, 2015 at 1:17 PM, Mario Smarduch <m.smarduch@samsung.com> wrote:
>>>>> On 11/3/2015 9:55 AM, Will Deacon wrote:
>>>>>> On Tue, Nov 03, 2015 at 09:44:52AM -0800, Mario Smarduch wrote:
>>>>>>> On 11/3/2015 8:33 AM, Christopher Covington wrote:
>>>>>>>> On 11/02/2015 06:51 PM, Mario Smarduch wrote:
>>>>>>>>>    this is a re-post from couple weeks ago, please take time to review this
>>>>>>>>> simple patch which simplifies DEBUG_LL and prevents kernel crash on virtual
>>>>>>>>> platforms.
>>>>>>>>>
>>>>>>>>> Before this patch DEBUG_LL for 'dummy virtual machine':
>>>>>>>>>
>>>>>>>>> ( ) Kernel low-level debugging via EmbeddedICE DCC channel
>>>>>>>>> ( ) Kernel low-level debug output via semihosting I/O
>>>>>>>>> ( ) Kernel low-level debugging via 8250 UART
>>>>>>>>> ( ) Kernel low-level debugging via ARM Ltd PL01x Primecell
>>>>>>>>>
>>>>>>>>> In summary if debug uart is not emulated kernel crashes.
>>>>>>>>> And once you pass that hurdle, uart physical/virtual addresses are unknown.
>>>>>>>>> DEBUG_LL comes in handy on many occasions and should be somewhat
>>>>>>>>> intuitive to use like it is for physical platforms. For virtual platforms
>>>>>>>>> user may start daubting the host and get into a bigger mess.
>>>>>>>>>
>>>>>>>>> After this patch is applied user gets:
>>>>>>>>>
>>>>>>>>> (X) Kernel low-level debugging on QEMU Virtual Platform
>>>>>>>>> ( ) Kernel low-level debugging on Kvmtool Virtual Platform
>>>>>>>>>    ..... above repeated ....
>>>>>>>>>
>>>>>>>>> The virtual addresses selected follow arm reference models, high in vmalloc
>>>>>>>>> section with high mem enabled and guest running with >= 1GB of memory. The
>>>>>>>>> offset is leftover from arm reference models.
>>>>>>>>
>>>>>>>> Which model? It doesn't appear to match the vexpress AEM/RTSM/FVP/whatever
>>>>>>>> which used 0x1c090000 for UART0.
>>>>>>>
>>>>>>> I recall QEMU virt model had it's own physical address map, for sure I saw the
>>>>>>> virtio-mmio regions assigned in some ARM document. Peter would you know?
>>>>>>>
>>>>>>> As far as kvmtool I'm not sure, currently PC1 COM1 port is used? Andre will that
>>>>>>> stay fixed?
>>>>>>
>>>>>> We make absolutely no guarantees about the memory map provided by kvmtool.
>>>>>
>>>>> If that's also the case for qemu, then I guess the best you can do is find a way
>>>>> to dump the device tree. Find the uart, physical address and try figure out the
>>>>> virtual address.
>>>>>
>>>>> Pretty involved, hoped for something more automated since that's a handy feature.
>>>>
>>>> You really only need LL_DEBUG now if you are debugging very early code
>>>> before memory is setup and/or bad memory. Use earlycon instead which
>>>> should already be supported both via the pl011 or semihosting. I used
>>>> it with QEMU semihosting support.
>>>>
>>> Then we should really document how to use that with qemu's virt platform
>>> and kvmtool's platform on both 32-bit and 64-bit so that users can
>>> easily figure out what they're doing wrong when they get no output.
>>>
>>> In practice, the address for the pl011 is quite unlikely to change, I
>>> dare speculate, so that documentation shouldn't need frequent updating.
>>
>> Is it not on by default since the following change?
>>
>> http://git.qemu.org/?p=qemu.git;a=commitdiff;h=f022b8e95379b0433d13509706b66f38fc15dde8
>>
> 
> Yes, but it still requires the plain 'earlycon' argument (i.e, without
> '=pl011,...') to be passed on the kernel command line if you want
> early output.
> 

I spent time debugging 'earlycon' for pl011, ironically using DEBUG_LL, from the
looks of it no mmio uart should work for armv7. It appears earlycon_map()
requires a fixed mapping similar to arm64.

Comparing both options, DEBUG_LL takes you from kernel decompress code to early
FDT parsing. A lot of early_print() calls won't work if DEBUG_LL is not enabled
including dump_machine_table which ends in a endless loop. IMO it's worth
turning this option on for that and other reasons.

'earlycon' is enabled some ways up in setup_arch().

As far as the patch, providing a hint to the user with probable uart addresses
would help and in the worst case "see the latest device tree for the virtual
platform".

- Mario





WARNING: multiple messages have this Message-ID (diff)
From: m.smarduch@samsung.com (Mario Smarduch)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] KVM/arm: kernel low level debug support for ARM32 virtual platforms
Date: Wed, 04 Nov 2015 15:28:34 -0800	[thread overview]
Message-ID: <563A94A2.3010307@samsung.com> (raw)
In-Reply-To: <CAKv+Gu8GJgzv82fVfCU7VQB2_ckRkzUYcQOx51rT2WgnmO_fsw@mail.gmail.com>



On 11/4/2015 10:51 AM, Ard Biesheuvel wrote:
> On 4 November 2015 at 19:49, Christopher Covington <cov@codeaurora.org> wrote:
>> On 11/04/2015 08:31 AM, Christoffer Dall wrote:
>>> On Tue, Nov 03, 2015 at 01:39:44PM -0600, Rob Herring wrote:
>>>> On Tue, Nov 3, 2015 at 1:17 PM, Mario Smarduch <m.smarduch@samsung.com> wrote:
>>>>> On 11/3/2015 9:55 AM, Will Deacon wrote:
>>>>>> On Tue, Nov 03, 2015 at 09:44:52AM -0800, Mario Smarduch wrote:
>>>>>>> On 11/3/2015 8:33 AM, Christopher Covington wrote:
>>>>>>>> On 11/02/2015 06:51 PM, Mario Smarduch wrote:
>>>>>>>>>    this is a re-post from couple weeks ago, please take time to review this
>>>>>>>>> simple patch which simplifies DEBUG_LL and prevents kernel crash on virtual
>>>>>>>>> platforms.
>>>>>>>>>
>>>>>>>>> Before this patch DEBUG_LL for 'dummy virtual machine':
>>>>>>>>>
>>>>>>>>> ( ) Kernel low-level debugging via EmbeddedICE DCC channel
>>>>>>>>> ( ) Kernel low-level debug output via semihosting I/O
>>>>>>>>> ( ) Kernel low-level debugging via 8250 UART
>>>>>>>>> ( ) Kernel low-level debugging via ARM Ltd PL01x Primecell
>>>>>>>>>
>>>>>>>>> In summary if debug uart is not emulated kernel crashes.
>>>>>>>>> And once you pass that hurdle, uart physical/virtual addresses are unknown.
>>>>>>>>> DEBUG_LL comes in handy on many occasions and should be somewhat
>>>>>>>>> intuitive to use like it is for physical platforms. For virtual platforms
>>>>>>>>> user may start daubting the host and get into a bigger mess.
>>>>>>>>>
>>>>>>>>> After this patch is applied user gets:
>>>>>>>>>
>>>>>>>>> (X) Kernel low-level debugging on QEMU Virtual Platform
>>>>>>>>> ( ) Kernel low-level debugging on Kvmtool Virtual Platform
>>>>>>>>>    ..... above repeated ....
>>>>>>>>>
>>>>>>>>> The virtual addresses selected follow arm reference models, high in vmalloc
>>>>>>>>> section with high mem enabled and guest running with >= 1GB of memory. The
>>>>>>>>> offset is leftover from arm reference models.
>>>>>>>>
>>>>>>>> Which model? It doesn't appear to match the vexpress AEM/RTSM/FVP/whatever
>>>>>>>> which used 0x1c090000 for UART0.
>>>>>>>
>>>>>>> I recall QEMU virt model had it's own physical address map, for sure I saw the
>>>>>>> virtio-mmio regions assigned in some ARM document. Peter would you know?
>>>>>>>
>>>>>>> As far as kvmtool I'm not sure, currently PC1 COM1 port is used? Andre will that
>>>>>>> stay fixed?
>>>>>>
>>>>>> We make absolutely no guarantees about the memory map provided by kvmtool.
>>>>>
>>>>> If that's also the case for qemu, then I guess the best you can do is find a way
>>>>> to dump the device tree. Find the uart, physical address and try figure out the
>>>>> virtual address.
>>>>>
>>>>> Pretty involved, hoped for something more automated since that's a handy feature.
>>>>
>>>> You really only need LL_DEBUG now if you are debugging very early code
>>>> before memory is setup and/or bad memory. Use earlycon instead which
>>>> should already be supported both via the pl011 or semihosting. I used
>>>> it with QEMU semihosting support.
>>>>
>>> Then we should really document how to use that with qemu's virt platform
>>> and kvmtool's platform on both 32-bit and 64-bit so that users can
>>> easily figure out what they're doing wrong when they get no output.
>>>
>>> In practice, the address for the pl011 is quite unlikely to change, I
>>> dare speculate, so that documentation shouldn't need frequent updating.
>>
>> Is it not on by default since the following change?
>>
>> http://git.qemu.org/?p=qemu.git;a=commitdiff;h=f022b8e95379b0433d13509706b66f38fc15dde8
>>
> 
> Yes, but it still requires the plain 'earlycon' argument (i.e, without
> '=pl011,...') to be passed on the kernel command line if you want
> early output.
> 

I spent time debugging 'earlycon' for pl011, ironically using DEBUG_LL, from the
looks of it no mmio uart should work for armv7. It appears earlycon_map()
requires a fixed mapping similar to arm64.

Comparing both options, DEBUG_LL takes you from kernel decompress code to early
FDT parsing. A lot of early_print() calls won't work if DEBUG_LL is not enabled
including dump_machine_table which ends in a endless loop. IMO it's worth
turning this option on for that and other reasons.

'earlycon' is enabled some ways up in setup_arch().

As far as the patch, providing a hint to the user with probable uart addresses
would help and in the worst case "see the latest device tree for the virtual
platform".

- Mario

  reply	other threads:[~2015-11-04 23:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 23:51 [PATCH] KVM/arm: kernel low level debug support for ARM32 virtual platforms Mario Smarduch
2015-11-02 23:51 ` Mario Smarduch
2015-11-03 16:33 ` Christopher Covington
2015-11-03 16:33   ` Christopher Covington
2015-11-03 17:33   ` Russell King - ARM Linux
2015-11-03 17:33     ` Russell King - ARM Linux
2015-11-03 17:44   ` Mario Smarduch
2015-11-03 17:44     ` Mario Smarduch
2015-11-03 17:55     ` Will Deacon
2015-11-03 17:55       ` Will Deacon
2015-11-03 19:17       ` Mario Smarduch
2015-11-03 19:17         ` Mario Smarduch
2015-11-03 19:39         ` Rob Herring
2015-11-03 19:39           ` Rob Herring
2015-11-04 13:31           ` Christoffer Dall
2015-11-04 13:31             ` Christoffer Dall
2015-11-04 18:49             ` Christopher Covington
2015-11-04 18:49               ` Christopher Covington
2015-11-04 18:51               ` Ard Biesheuvel
2015-11-04 18:51                 ` Ard Biesheuvel
2015-11-04 23:28                 ` Mario Smarduch [this message]
2015-11-04 23:28                   ` Mario Smarduch
2015-11-05  1:13                   ` Peter Hurley
2015-11-05  1:13                     ` Peter Hurley
2015-11-05 15:04                 ` Christoffer Dall
2015-11-05 15:04                   ` Christoffer Dall

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=563A94A2.3010307@samsung.com \
    --to=m.smarduch@samsung.com \
    --cc=andre.przywara@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=cov@codeaurora.org \
    --cc=grant.likely@secretlab.ca \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=robherring2@gmail.com \
    --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 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.