* [PATCH] kvm: arm64: Properly align the end address of table walk
@ 2021-01-15 9:53 Keqian Zhu
2021-01-15 10:23 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Keqian Zhu @ 2021-01-15 9:53 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, kvm, kvmarm, Will Deacon,
Marc Zyngier, Catalin Marinas
Cc: Mark Rutland, James Morse, Robin Murphy, Joerg Roedel,
Daniel Lezcano, Thomas Gleixner, Suzuki K Poulose,
Julien Thierry, Andrew Morton, Alexios Zavras, wanghaibin.wang,
jiangkunkun
When align the end address, ought to use its original value.
Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker infrastructure")
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
arch/arm64/kvm/hyp/pgtable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index bdf8e55ed308..670b0ef12440 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -296,7 +296,7 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size,
struct kvm_pgtable_walk_data walk_data = {
.pgt = pgt,
.addr = ALIGN_DOWN(addr, PAGE_SIZE),
- .end = PAGE_ALIGN(walk_data.addr + size),
+ .end = PAGE_ALIGN(addr + size),
.walker = walker,
};
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: arm64: Properly align the end address of table walk
2021-01-15 9:53 [PATCH] kvm: arm64: Properly align the end address of table walk Keqian Zhu
@ 2021-01-15 10:23 ` Will Deacon
2021-01-18 1:18 ` Keqian Zhu
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2021-01-15 10:23 UTC (permalink / raw)
To: Keqian Zhu
Cc: linux-kernel, linux-arm-kernel, kvm, kvmarm, Marc Zyngier,
Catalin Marinas, Mark Rutland, James Morse, Robin Murphy,
Joerg Roedel, Daniel Lezcano, Thomas Gleixner, Suzuki K Poulose,
Julien Thierry, Andrew Morton, Alexios Zavras, wanghaibin.wang,
jiangkunkun
On Fri, Jan 15, 2021 at 05:53:07PM +0800, Keqian Zhu wrote:
> When align the end address, ought to use its original value.
>
> Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker infrastructure")
> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
> ---
> arch/arm64/kvm/hyp/pgtable.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index bdf8e55ed308..670b0ef12440 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -296,7 +296,7 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size,
> struct kvm_pgtable_walk_data walk_data = {
> .pgt = pgt,
> .addr = ALIGN_DOWN(addr, PAGE_SIZE),
> - .end = PAGE_ALIGN(walk_data.addr + size),
> + .end = PAGE_ALIGN(addr + size),
> .walker = walker,
Hmm, this is a change in behaviour, no (consider the case where both 'addr'
and 'size' are misaligned)? The current code is consistent with the
kerneldoc in asm/kvm_pgtable.h, so I don't see the motivation to change it.
Did you hit a bug somewhere?
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: arm64: Properly align the end address of table walk
2021-01-15 10:23 ` Will Deacon
@ 2021-01-18 1:18 ` Keqian Zhu
0 siblings, 0 replies; 3+ messages in thread
From: Keqian Zhu @ 2021-01-18 1:18 UTC (permalink / raw)
To: Will Deacon
Cc: linux-kernel, linux-arm-kernel, kvm, kvmarm, Marc Zyngier,
Catalin Marinas, Mark Rutland, James Morse, Robin Murphy,
Joerg Roedel, Daniel Lezcano, Thomas Gleixner, Suzuki K Poulose,
Julien Thierry, Andrew Morton, Alexios Zavras, wanghaibin.wang,
jiangkunkun
On 2021/1/15 18:23, Will Deacon wrote:
> On Fri, Jan 15, 2021 at 05:53:07PM +0800, Keqian Zhu wrote:
>> When align the end address, ought to use its original value.
>>
>> Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker infrastructure")
>> Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
>> ---
>> arch/arm64/kvm/hyp/pgtable.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
>> index bdf8e55ed308..670b0ef12440 100644
>> --- a/arch/arm64/kvm/hyp/pgtable.c
>> +++ b/arch/arm64/kvm/hyp/pgtable.c
>> @@ -296,7 +296,7 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size,
>> struct kvm_pgtable_walk_data walk_data = {
>> .pgt = pgt,
>> .addr = ALIGN_DOWN(addr, PAGE_SIZE),
>> - .end = PAGE_ALIGN(walk_data.addr + size),
>> + .end = PAGE_ALIGN(addr + size),
>> .walker = walker,
>
> Hmm, this is a change in behaviour, no (consider the case where both 'addr'
> and 'size' are misaligned)? The current code is consistent with the
> kerneldoc in asm/kvm_pgtable.h, so I don't see the motivation to change it.
>
> Did you hit a bug somewhere?
>
> Will
> .
>
Not hit a bug, I just read the code to implement a new idea of stage2 DBM
support [1]. Yes, according to doc, this is not an issue ("The offset of
@addr within a page is ignored."). Sorry to disturb ;-).
[1] https://lore.kernel.org/kvmarm/fd26654b-8258-061c-2a69-90b961c1c71b@huawei.com/
Thanks,
Keqian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-18 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 9:53 [PATCH] kvm: arm64: Properly align the end address of table walk Keqian Zhu
2021-01-15 10:23 ` Will Deacon
2021-01-18 1:18 ` Keqian Zhu
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).