From: Will Deacon <will@kernel.org>
To: Prabhakar Kushwaha <prabhakar.pkin@gmail.com>
Cc: Ganapatrao Prabhakerrao Kulkarni <gkulkarni@marvell.com>,
Marc Zyngier <maz@kernel.org>,
Bhupesh Sharma <bhsharma@redhat.com>,
kexec mailing list <kexec@lists.infradead.org>,
Bjorn Helgaas <helgaas@kernel.org>,
Prabhakar Kushwaha <pkushwaha@marvell.com>,
Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH][v2] iommu: arm-smmu-v3: Copy SMMU table for kdump kernel
Date: Mon, 8 Jun 2020 12:41:23 +0100 [thread overview]
Message-ID: <20200608114122.GB3108@willie-the-truck> (raw)
In-Reply-To: <CAJ2QiJ+-VV9bXbdfqHxeZgUiGBg_iMqBQcSH5cD_sfb-UQpQ6w@mail.gmail.com>
On Tue, Jun 02, 2020 at 07:34:47PM +0530, Prabhakar Kushwaha wrote:
> On Mon, Jun 1, 2020 at 1:10 PM Will Deacon <will@kernel.org> wrote:
> > On Thu, May 21, 2020 at 04:52:02PM +0530, Prabhakar Kushwaha wrote:
> > > On Thu, May 21, 2020 at 2:53 PM Will Deacon <will@kernel.org> wrote:
> > > > On Tue, May 19, 2020 at 08:24:21AM +0530, Prabhakar Kushwaha wrote:
> > > > > What kind of issue you are foreseeing in using memcpy(). May be we can
> > > > > try to find a solution.
> > > >
> > > > Well the thing might not be cache-coherent to start with...
> > > >
> > >
> > > Thanks for telling possible issue area. Let me try to explain why
> > > this should not be an issue.
> > >
> > > kdump kernel runs from reserved memory space defined during the boot
> > > of first kernel. kdump does not touch memory of the previous kernel.
> > > So no page has been created in kdump kernel and there should not be
> > > any data/attribute/coherency issue from MMU point of view .
> >
> > Then how does this work?:
> >
> > rdcfg.strtab = memremap(rdcfg.strtab_dma, size, MEMREMAP_WB);
> >
> > You're explicitly asking for a write-back mapping.
> >
>
> As i mentioned earlier, I will replace it with MEMREMAP_WT to make
> sure data is written into the memory.
>
> Please note, this memmap is temporary for copying older SMMU table to
> cfg->strtab.
> Here, cfg->strtab & cfg->strtab_dma allocated via dmam_alloc_coherent
> during SMMU probe.
>
>
> > > During SMMU probe functions, dmem_alloc_coherent() will be used
> > > allocate new memory (part of existing flow).
> > > This patch copy STE or first level descriptor to *this* memory, after
> > > mapping physical address using memremap().
> > > It just copy everything so there should not be any issue related to
> > > attribute/content.
> > >
> > > Yes, copying done after mapping it as MEMREMAP_WB. if you want I can
> > > use it as MEMREMAP_WT
> >
> > You need to take into account whether or not the device is coherent, and the
> > DMA API is designed to handle that for you. But even then, this is fragile
> > as hell because you end up having to infer the hardware configuration
> > from the device to understand the size and format of the data structures.
> > If the crashkernel isn't identical to the host kernel (in terms of kconfig,
> > driver version, firmware tables, cmdline etc) then this is very likely to
> > go wrong.
>
> There are two possible scenarios for mismatched kdump kernel
> 1. kdump kernel does not have the devices' driver
> 2. kdump kernel have the different variation/configuration of driver
>
> This patch create temporary SMMU table entries which are overwritten
> by driver-probe.
What exactly does this achieve, given that you don't copy the context
descriptors or the page tables?
> Driver's probe will overwrite SMMU entries based on its new
> requirement (size, format, data structures etc).
>
> for "1", As no device driver, SMMU entry will remain there.
> Means no-one looking for the copied content (even if device continued
> to perform DMA).
>
> About coherency between Cores and Memory(DMA).
> At the time of crash: Only one CPU is allowed to remain continue,
> rest are stopped.
> __crash_kexec --> machine_crash_shutdown --> crash_smp_send_stop()
>
> The active CPU is used to boot kdump kernel. hence none of the CPUs is
> looking for data copied by DMA.
> Coherency issue should not be there.
I'm talking about coherency between the SMMU and the CPU, so I don't think
the number of CPUs is relevant.
> please let me know your view.
It still seems extremely fragile to me, so I continue to think that this
is the wrong approach.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-06-08 11:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 2:46 [PATCH][v2] iommu: arm-smmu-v3: Copy SMMU table for kdump kernel Prabhakar Kushwaha
2020-05-12 22:03 ` Bjorn Helgaas
2020-05-14 7:17 ` Prabhakar Kushwaha
2020-05-19 23:22 ` Bjorn Helgaas
2020-05-21 3:58 ` Prabhakar Kushwaha
2020-05-21 22:49 ` Bjorn Helgaas
2020-05-27 11:44 ` Prabhakar Kushwaha
2020-05-27 20:18 ` Bjorn Helgaas
2020-05-29 14:18 ` Prabhakar Kushwaha
2020-05-29 19:33 ` Bjorn Helgaas
2020-06-03 17:42 ` Prabhakar Kushwaha
2020-06-04 0:02 ` Bjorn Helgaas
2020-06-07 8:30 ` Prabhakar Kushwaha
2020-06-11 23:03 ` Bjorn Helgaas
2020-05-18 15:55 ` Will Deacon
2020-05-19 2:54 ` Prabhakar Kushwaha
2020-05-21 9:23 ` Will Deacon
2020-05-21 11:22 ` Prabhakar Kushwaha
2020-06-01 7:39 ` Will Deacon
2020-06-02 14:04 ` Prabhakar Kushwaha
2020-06-08 11:41 ` Will Deacon [this message]
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=20200608114122.GB3108@willie-the-truck \
--to=will@kernel.org \
--cc=bhsharma@redhat.com \
--cc=gkulkarni@marvell.com \
--cc=helgaas@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=pkushwaha@marvell.com \
--cc=prabhakar.pkin@gmail.com \
--cc=robin.murphy@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