[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RESEND][PATCH v2 5/7] xen: include xen/guest_access.h rather than asm/guest_access.h


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 18 Aug 2020 09:05:49 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GknflXBGmfKn5n96GphkJm8FITAdcXzQjBtLA0rUEjM=; b=RzcX4YSJGi4S54JDi/DxB837gK5ye+x6eHE2Fjw2XhAPds+3ZV4q+wAKBbbps8ByGh3otCp+3dGXR0Ti58WK9XS4CwhkjJjqDOkxJzwoAWLMCdah6NxmAapsw7Lry0cB9QJJyHvm79kJZ6YjOzScyD/XeRViGyZHeU+OkvZARzeMFGp2iLDuPZs47+mrRKPMmLGVlmJIrv58k6jTutH455FSKqOB6qGXtvWZH53OO+CQXcEAM9tVyPxo6U53u4s9fghzDWYw4ykRFLs7iHbuQlQXECF98Q4FjjIKQi2lq0sK/ANgrk5SGehAB4rvmyZOVrPoSz57PpyJbFurzlKFWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HhebYa4Mw5TuAyNIGLnNYx3JgP4F2a5ZPk/IRhVHi+Mwd92zO7epMDj1d69/Lrk8fpuoiiQIB9ZqEfdg9JmMuQdkfapMwInTf930VYxGOz1tpuNUQJs2TXyiLy9BEdDWJ2e671jtYRBYj9ULk3f01p0uzXdfdHkW3AKhckisj9L7tI+HG2/z+6JYbHmqLivi4bcmhV5lvSL0oe5u9I4wmRfy4BiMMtB5YmQlqKH9cPAujZQTKNXS0LBGpbkTeKvbDCpmKEMPCNMebIwyq8wn8Q9yGpEvkTAmbxPU9onMjY5hjY/HIzFw6+m1poqJjyZXLaVaqlGI8OqZGjUCCnTOzA==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, nd <nd@xxxxxxx>
  • Delivery-date: Tue, 18 Aug 2020 09:06:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWZp4X4KUogf6E0E+1j1OVzKuR+6khkG4AgBZ+qACABZ0DAIAAAkgAgAAB6QA=
  • Thread-topic: [RESEND][PATCH v2 5/7] xen: include xen/guest_access.h rather than asm/guest_access.h


> On 18 Aug 2020, at 09:58, Julien Grall <julien@xxxxxxx> wrote:
> 
> 
> 
> On 18/08/2020 09:50, Jan Beulich wrote:
>> On 14.08.2020 21:07, Julien Grall wrote:
>>> Hi Jan,
>>> 
>>> On 31/07/2020 12:36, Jan Beulich wrote:
>>>> On 30.07.2020 20:18, Julien Grall wrote:
>>>>> From: Julien Grall <jgrall@xxxxxxxxxx>
>>>>> 
>>>>> Only a few places are actually including asm/guest_access.h. While this
>>>>> is fine today, a follow-up patch will want to move most of the helpers
>>>>> from asm/guest_access.h to xen/guest_access.h.
>>>>> 
>>>>> To prepare the move, everyone should include xen/guest_access.h rather
>>>>> than asm/guest_access.h.
>>>>> 
>>>>> Interestingly, asm-arm/guest_access.h includes xen/guest_access.h. The
>>>>> inclusion is now removed as no-one but the latter should include the
>>>>> former.
>>>>> 
>>>>> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
>>>> 
>>>> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>> 
>>>> Is there any chance you could take measures to avoid new inclusions
>>>> of asm/guest_access.h to appear?
>>> 
>>> It should be possible.
>>> 
>>> How about this:
>>> 
>>> diff --git a/xen/include/asm-arm/guest_access.h 
>>> b/xen/include/asm-arm/guest_access.h
>>> index b9a89c495527..d8dbc7c973b4 100644
>>> --- a/xen/include/asm-arm/guest_access.h
>>> +++ b/xen/include/asm-arm/guest_access.h
>>> @@ -1,3 +1,7 @@
>>> +#ifndef ALLOW_INCLUDE_ASM_GUEST_ACCESS_H
>>> +#error "asm/guest_access.h should not be included directly"
>>> +#endif
>>> +
>>>  #ifndef __ASM_ARM_GUEST_ACCESS_H__
>>>  #define __ASM_ARM_GUEST_ACCESS_H__
>>> 
>>> diff --git a/xen/include/asm-x86/guest_access.h 
>>> b/xen/include/asm-x86/guest_access.h
>>> index 369676f31ac3..e665ca3a27af 100644
>>> --- a/xen/include/asm-x86/guest_access.h
>>> +++ b/xen/include/asm-x86/guest_access.h
>>> @@ -4,6 +4,10 @@
>>>   * Copyright (c) 2006, K A Fraser
>>>   */
>>> 
>>> +#ifndef ALLOW_INCLUDE_ASM_GUEST_ACCESS_H
>>> +#error "asm/guest_access.h should not be included directly"
>>> +#endif
>>> +
>>>  #ifndef __ASM_X86_GUEST_ACCESS_H__
>>>  #define __ASM_X86_GUEST_ACCESS_H__
>>> 
>>> diff --git a/xen/include/xen/guest_access.h b/xen/include/xen/guest_access.h
>>> index 75103d30c8be..814e31329de9 100644
>>> --- a/xen/include/xen/guest_access.h
>>> +++ b/xen/include/xen/guest_access.h
>>> @@ -7,7 +7,9 @@
>>>  #ifndef __XEN_GUEST_ACCESS_H__
>>>  #define __XEN_GUEST_ACCESS_H__
>>> 
>>> +#define ALLOW_INCLUDE_ASM_GUEST_ACCESS_H
>>>  #include <asm/guest_access.h>
>>> +#undef ALLOW_INCLUDE_ASM_GUEST_ACCESS_H
>>>  #include <xen/types.h>
>>>  #include <public/xen.h>
>> One option. Personally I'd prefer to avoid introduction of yet another
>> constant, by leveraging __XEN_GUEST_ACCESS_H__ instead.
> 
> I thought about it but it doesn't prevent new inclusions of 
> asm/guest_access.h. For instance, the following would still compile:
> 
> #include <xen/guest_access.h>
> 
> [...]
> 
> #include <asm/guest_access.h>
> 
> If we want to completely prevent new inclusion, then we need a new temporary 
> constant.

I would think that this would not handle all cases but would at least prevent 
someone from including directly the asm header.

The solution with the define and undef does not look really nice and headers 
could become really ugly if we start doing that for
all asm headers that should not be included directly.

Cheers
Bertrand




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.