x86/mm: use existing 'pfn' in p2m_get_mem_access
PATCH 1/1 x86/mm: use existing 'pfn' in p2m_get_mem_access
'gfn' is not defined in p2m_get_mem_access() and this code compiles only because of a coincidence: gfn_lock/gfn_unlock are currently macros which don't use their second argument.
--- xen/arch/x86/mm/p2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm/p2m.c +2 -2
@@ -1696,9 +1696,9 @@ int p2m_get_mem_access(struct domain *d, unsigned long pfn,return 0 ; } -gfn_lock (p2m, gfn,0 ); +gfn_lock (p2m, pfn,0 ); mfn = p2m->get_entry (p2m, pfn, &t, &a,0 ,NULL ); -gfn_unlock (p2m, gfn,0 ); +gfn_unlock (p2m, pfn,0 );if (mfn_x (mfn) ==INVALID_MFN )return -ESRCH ;
Signature · 1 line
1.9.3
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 26.05.15 at 09:34, <[email protected]> wrote:
'gfn' is not defined in
p2m_get_mem_access()and this code compiles only because of a coincidence: gfn_lock/gfn_unlock are currently macros which don't use their second argument.Signed-off-by Vitaly Kuznetsov <[email protected]>--- xen/arch/x86/mm/p2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/mm/p2m.c +0
-0
xen/arch/x86/mm/p2m.c int p2m_get_mem_access(struct domain *d, unsigned long pfn, · line 1701
Quoted 8 lines
xen/arch/x86/mm/p2m.c +2
-2@@ -1696,9 +1696,9 @@ int p2m_get_mem_access(struct domain *d, unsigned long pfn,return 0 ; } -gfn_lock (p2m, gfn,0 ); +gfn_lock (p2m, pfn,0 ); mfn = p2m->get_entry (p2m, pfn, &t, &a,0 ,NULL ); -gfn_unlock (p2m, gfn,0 ); +gfn_unlock (p2m, pfn,0 );
Looks okay from the perspective of fixing the immediate issue, but gets things into kind of an inconsistent state: What is named "pfn" here should really be named "gfn" imo, i.e. the renaming should be done the other way around.
Jan
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 26.05.15 at 09:34, <[email protected]> wrote:
'gfn' is not defined in
p2m_get_mem_access()and this code compiles only because of a coincidence: gfn_lock/gfn_unlock are currently macros which don't use their second argument.Signed-off-by Vitaly Kuznetsov <[email protected]>--- xen/arch/x86/mm/p2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)xen/arch/x86/mm/p2m.c +0
-0@@ -1696,9 +1696,9 @@ int p2m_get_mem_access(struct domain *d, unsigned long pfn,return 0 ; }
Quoted 9 lines
xen/arch/x86/mm/p2m.c int p2m_get_mem_access(struct domain *d, unsigned long pfn, · line 1701
Quoted 5 lines
xen/arch/x86/mm/p2m.c +2
-2-gfn_lock (p2m, gfn,0 ); +gfn_lock (p2m, pfn,0 ); mfn = p2m->get_entry (p2m, pfn, &t, &a,0 ,NULL ); -gfn_unlock (p2m, gfn,0 ); +gfn_unlock (p2m, pfn,0 );Looks okay from the perspective of fixing the immediate issue, but gets things into kind of an inconsistent state: What is named "pfn" here should really be named "gfn" imo, i.e. the renaming should be done the other way around.
Correct; gfn is the appropriate term. This entire function needs s/pfn/gfn/
As part of some other work, I am currently drafting a docs improvement which will properly define and explain each of these terms.
~Andrew