All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: use existing 'pfn' in p2m_get_mem_access
@ 2015-05-26  7:34 Vitaly Kuznetsov
  2015-05-26  9:58 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2015-05-26  7:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Tim Deegan, Jan Beulich, Andrew Cooper

'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 <vkuznets@redhat.com>
---
 xen/arch/x86/mm/p2m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1fd1194..18db9bd 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -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;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mm: use existing 'pfn' in p2m_get_mem_access
  2015-05-26  7:34 [PATCH] x86/mm: use existing 'pfn' in p2m_get_mem_access Vitaly Kuznetsov
@ 2015-05-26  9:58 ` Jan Beulich
  2015-05-26 10:17   ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2015-05-26  9:58 UTC (permalink / raw)
  To: Vitaly Kuznetsov; +Cc: Andrew Cooper, Tim Deegan, Keir Fraser, xen-devel

>>> On 26.05.15 at 09:34, <vkuznets@redhat.com> 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 <vkuznets@redhat.com>
> ---
>  xen/arch/x86/mm/p2m.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index 1fd1194..18db9bd 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mm: use existing 'pfn' in p2m_get_mem_access
  2015-05-26  9:58 ` Jan Beulich
@ 2015-05-26 10:17   ` Andrew Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-05-26 10:17 UTC (permalink / raw)
  To: Jan Beulich, Vitaly Kuznetsov; +Cc: Tim Deegan, Keir Fraser, xen-devel

On 26/05/15 10:58, Jan Beulich wrote:
>>>> On 26.05.15 at 09:34, <vkuznets@redhat.com> 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 <vkuznets@redhat.com>
>> ---
>>  xen/arch/x86/mm/p2m.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
>> index 1fd1194..18db9bd 100644
>> --- a/xen/arch/x86/mm/p2m.c
>> +++ b/xen/arch/x86/mm/p2m.c
>> @@ -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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-26 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26  7:34 [PATCH] x86/mm: use existing 'pfn' in p2m_get_mem_access Vitaly Kuznetsov
2015-05-26  9:58 ` Jan Beulich
2015-05-26 10:17   ` Andrew Cooper

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.