On 2023/09/28 17:00, Guanyou Chen wrote:
Thank you for review, Lianbo.
Kazu, Can you help improve the patch log.
Thanks
Guanyou
lijiang <lijiang(a)redhat.com> 于2023年9月27日周三 19:35写道:
> Thank you for the update, Chen.
> On Tue, Sep 26, 2023 at 8:44 PM Guanyou Chen <chenguanyou9338(a)gmail.com>
> wrote:
>
>> arm64/pgtable: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE
>>
>>
> We can add the kernel commit to patch log as I mentioned here:
>
>
https://listman.redhat.com/archives/crash-utility/2023-September/011010.html
>
> 570ef363509b ("arm64/pgtable: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE")
>
> Otherwise, for the patch: Ack.
>
> BTW: maybe Kazu can help improve the patch log when merging(if the patch
> is also fine to him).
yup, improved a bit and applied.
https://github.com/crash-utility/crash/commit/c9a732d0f6abe8c63f19fee5233...
Thanks,
Kazu
>>
>> Thanks
>> Lianbo
>>
>> Let's use one of the type bits: core-mm only supports 5, so there is no
>>> need to consume 6.
>>>
>>> Note that we might be able to reuse bit 1, but reusing bit 1 turned out
>>> problematic in the past for PROT_NONE handling; so let's play safe and
use
>>> another bit.
>>>
>>> Link:
https://lkml.kernel.org/r/20220329164329.208407-5-david@redhat.com
>>>
>>> Before:
>>> crash> vtop 70504000
>>> VIRTUAL PHYSICAL
>>> 70504000 (not mapped)
>>>
>>> PAGE DIRECTORY: ffffff80f265c000
>>> PGD: ffffff80f265c008 => 800000141537003
>>> PMD: ffffff8101537c10 => 800000141538003
>>> PTE: ffffff8101538820 => 12bc3e04
>>>
>>> PTE vtop: cannot determine swap location
>>>
>>> After:
>>> crash> vtop 70504000
>>> VIRTUAL PHYSICAL
>>> 70504000 (not mapped)
>>>
>>> PAGE DIRECTORY: ffffff80f265c000
>>> PGD: ffffff80f265c008 => 800000141537003
>>> PMD: ffffff8101537c10 => 800000141538003
>>> PTE: ffffff8101538820 => 12bc3e04
>>>
>>> PTE SWAP OFFSET
>>> 12bc3e04 /first_stage_ramdisk/dev/block/zram0 1227838
>>>
>>> VMA START END FLAGS FILE
>>> ffffff80dfe7b578 70504000 707bd000 100073
>>>
>>> SWAP: /first_stage_ramdisk/dev/block/zram0 OFFSET: 1227838
>>>
>>> Signed-off-by: chenguanyou <chenguanyou(a)xiaomi.com>
>>> ---
>>> arm64.c | 12 ++++++++++--
>>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arm64.c b/arm64.c
>>> index 39d5f04..ea1b51b 100644
>>> --- a/arm64.c
>>> +++ b/arm64.c
>>> @@ -468,8 +468,16 @@ arm64_init(int when)
>>> }
>>> }
>>>
>>> -
>>> - if (THIS_KERNEL_VERSION >= LINUX(4,0,0)) {
>>> + if (THIS_KERNEL_VERSION >= LINUX(5,19,0)) {
>>> + ms->__SWP_TYPE_BITS = 5;
>>> + ms->__SWP_TYPE_SHIFT = 3;
>>> + ms->__SWP_TYPE_MASK = ((1UL << ms->__SWP_TYPE_BITS) -
1);
>>> + ms->__SWP_OFFSET_SHIFT = (ms->__SWP_TYPE_BITS +
>>> ms->__SWP_TYPE_SHIFT);
>>> + ms->__SWP_OFFSET_BITS = 50;
>>> + ms->__SWP_OFFSET_MASK = ((1UL <<
ms->__SWP_OFFSET_BITS) - 1);
>>> + ms->PTE_PROT_NONE = (1UL << 58);
>>> + ms->PTE_FILE = 0; /* unused */
>>> + } else if (THIS_KERNEL_VERSION >= LINUX(4,0,0)) {
>>> ms->__SWP_TYPE_BITS = 6;
>>> ms->__SWP_TYPE_SHIFT = 2;
>>> ms->__SWP_TYPE_MASK = ((1UL << ms->__SWP_TYPE_BITS)
- 1);
>>> --
>>> 2.39.0
>>>