xen/arm: Map mmio-sram nodes as cached memory
cover xen/arm: Map mmio-sram nodes as cached memory
From: "Edgar E. Iglesias" <[email protected]>
This patch changes the mapping from non-cached to cached for mmio-sram nodes that do not have the no-memory-wc property. This is a hang-over from 4.8 since the mmio-sram patches went in late in the cycle.
I've explained the rationale in the commit message:
Rationale:
Allthough on chip memories are relatively fast compared to off-chip memories, large OCMs are still significantly slower than L1 caches. Depending on the memory, either cached or uncached may make most sense.
Also, dom0 may like to use the memory in a cache-coherent way to avoid SW managed coherency.
By mapping it cached at S2, we let dom0 select cacheability via S1 mappings.
This was also discussed here:
https://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02412.html
Cheers,
Edgar
Edgar E. Iglesias (1):
xen/arm: Map mmio-sram nodes as cached memory
xen/arch/arm/domain_build.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/1 xen/arm: Map mmio-sram nodes as cached memory
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared to off-chip memories, large OCMs are still significantly slower than L1 caches. Depending on the memory, either cached or uncached may make most sense.
Also, dom0 may like to use the memory in a cache-coherent way to avoid SW managed coherency.
By mapping it cached at S2, we let dom0 select cacheability via S1 mappings.
--- xen/arch/arm/domain_build.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +13 -1
@@ -56,8 +56,20 @@ static const struct dt_device_match dev_map_attrs[] __initconst = .data = (void *) (uintptr_t) p2m_mmio_direct_dev, }, { +/* +* Allthough on chip memories are relatively fast compared to +* off-chip memories, large OCMs are still significantly slower +* than L1 caches. Depending on the memory, either cached or +* uncached may make most sense. +* +* Also, dom0 may like to use the memory in a cache-coherent +* way to avoid SW managed coherency. +* +* By mapping it cached at S2, we let dom0 select cacheability +* via S1 mappings. +*/ __DT_MATCH_COMPATIBLE("mmio-sram"), - .data = (void *) (uintptr_t) p2m_mmio_direct_nc, + .data = (void *) (uintptr_t) p2m_mmio_direct_c, }, { /* sentinel */ }, };
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Edgar,
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared to
s/Allthough/Although/
Quoted 1 line
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
Quoted 19 lines
than L1 caches. Depending on the memory, either cached or uncached may make most sense.
Also, dom0 may like to use the memory in a cache-coherent way to avoid SW managed coherency.
By mapping it cached at S2, we let dom0 select cacheability via S1 mappings.
Signed-off-by Edgar E. Iglesias <[email protected]>--- xen/arch/arm/domain_build.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +0
-0
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 60
Quoted 5 lines
xen/arch/arm/domain_build.c +2
-0@@ -56,8 +56,20 @@ static const struct dt_device_match dev_map_attrs[] __initconst = .data = (void *) (uintptr_t) p2m_mmio_direct_dev, }, { +/* +* Allthough on chip memories are relatively fast compared to
s/Allthough/Although/
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 65
Quoted 5 lines
xen/arch/arm/domain_build.c +5
-0+* off-chip memories, large OCMs are still significantly slower +* than L1 caches. Depending on the memory, either cached or +* uncached may make most sense. +* +* Also, dom0 may like to use the memory in a cache-coherent
We prefer to use the term "hardware domain" rather than DOM0 when possible in the code.
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 72
Quoted 8 lines
xen/arch/arm/domain_build.c +6
-1+* way to avoid SW managed coherency. +* +* By mapping it cached at S2, we let dom0 select cacheability +* via S1 mappings. +*/ __DT_MATCH_COMPATIBLE("mmio-sram"), - .data = (void *) (uintptr_t) p2m_mmio_direct_nc, + .data = (void *) (uintptr_t) p2m_mmio_direct_c,
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to p2m_mmio_direct_c.
So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Any opinions?
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 75
Quoted 4 lines
xen/arch/arm/domain_build.c +0
-0}, { /* sentinel */ }, };
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 5 lines · Julien Grall
Hi Edgar,
Quoted 2 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Quoted 7 lines
Quoted 5 lines
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Quoted 15 lines
Quoted 15 lines
than L1 caches. Depending on the memory, either cached or uncached may make most sense.
Also, dom0 may like to use the memory in a cache-coherent way to avoid SW managed coherency.
By mapping it cached at S2, we let dom0 select cacheability via S1 mappings.
Signed-off-by Edgar E. Iglesias <[email protected]>---
xen/arch/arm/domain_build.c| 14 +++++++++++++-1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 12 lines
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 60
Quoted 10 lines
xen/arch/arm/domain_build.c +2
-0@@ -56,8 +56,20 @@ static const struct dt_device_match dev_map_attrs[] __initconst = .data = (void *) (uintptr_t) p2m_mmio_direct_dev, }, { +/* +* Allthough on chip memories are relatively fast compared to s/Allthough/Although/
Fixed for v2.
Quoted 9 lines
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 65
Quoted 6 lines
xen/arch/arm/domain_build.c +5
-0+* off-chip memories, large OCMs are still significantly slower +* than L1 caches. Depending on the memory, either cached or +* uncached may make most sense. +* +* Also, dom0 may like to use the memory in a cache-coherent We prefer to use the term "hardware domain" rather than DOM0 when possible in the code.
Sounds good, I've changed it in code and commit msg for v2.
Quoted 10 lines
xen/arch/arm/domain_build.c static const struct dt_device_match dev_map_attrs[] __initconst = · line 72
Quoted 9 lines
xen/arch/arm/domain_build.c +6
-1+* way to avoid SW managed coherency. +* +* By mapping it cached at S2, we let dom0 select cacheability +* via S1 mappings. +*/ __DT_MATCH_COMPATIBLE("mmio-sram"), - .data = (void *) (uintptr_t) p2m_mmio_direct_nc, + .data = (void *) (uintptr_t) p2m_mmio_direct_c,
Quoted 7 lines
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
Yes, I agree.
Quoted 8 lines
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to
p2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Any opinions?
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.html
The concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or unpredictable behavior that could be exploited.
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.
It would be interesting to see a concrete example of a problematic system.
Best regards,
Edgar
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Edgar,
Quoted 12 lines · Edgar E. Iglesias
Quoted 10 lines · Julien Grall
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Quoted 8 lines
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Yes please. I was not able to find the acronym with a quick search Google.
[...]
Quoted 17 lines
Quoted 7 lines
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
Yes, I agree.
Quoted 7 lines
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to
p2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Quoted 8 lines
Quoted 1 line
Any opinions?
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.htmlThe concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or unpredictable behavior that could be exploited.
I think it would be fine for DOM0. It is already a trusted domain and have other way to take down the platform.
Quoted 9 lines
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.
Another example is having the device mapped with different in 2 places with different cacheability attributes. The data accessed would not be coherent. But I believe that should not lead to a security issue.
Quoted 3 lines
It would be interesting to see a concrete example of a problematic system.
I believe it would depend a lot on how the platform have been designed.
I think we have two choices to go forward:
1) Relax the memory attribute on case by case. DOM0 would not be able
to exploit potential undefined behavior. However, this means that code is been added for any new device (e.g compatible string).
2) Relax the memory attribute on every case. DOM0 would be able to
exploit potential undefined behavior. On the benefit side, every devices can be used at its full performance without any change required in Xen.
In the case of ACPI, we rely on DOM0 to provide the correct mapping attribute when asking to do the stage-2 mapping (see XENMAPSPACE_dev_mmio). Note that currently, the MMIO are always mapped with the attribute Device-nGnRE. There is plan to change that in the future. So ACPI is implementing 2).
Device Tree is currently implementing 1). But I would like to see the behavior of Xen the same no matter the firmware tables used. So I would lean towards 2).
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 85 lines · Julien Grall
Hi Edgar,
Quoted 12 lines · Edgar E. Iglesias
Quoted 10 lines · Julien Grall
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Quoted 8 lines
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Yes please. I was not able to find the acronym with a quick search Google.
[...]
Quoted 17 lines
Quoted 7 lines
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
Yes, I agree.
Quoted 7 lines
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to
p2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Quoted 8 lines
Quoted 1 line
Any opinions?
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.htmlThe concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or unpredictable behavior that could be exploited.
I think it would be fine for DOM0. It is already a trusted domain and have other way to take down the platform.
Quoted 9 lines
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.
Another example is having the device mapped with different in 2 places with different cacheability attributes. The data accessed would not be coherent. But I believe that should not lead to a security issue.
Quoted 3 lines
It would be interesting to see a concrete example of a problematic system.
I believe it would depend a lot on how the platform have been designed.
I think we have two choices to go forward:
1) Relax the memory attribute on case by case. DOM0 would not be able
to exploit potential undefined behavior. However, this means that code is been added for any new device (e.g compatible string).
2) Relax the memory attribute on every case. DOM0 would be able to
exploit potential undefined behavior. On the benefit side, every devices can be used at its full performance without any change required in Xen.
Quoted 8 lines
In the case of ACPI, we rely on DOM0 to provide the correct mapping attribute when asking to do the stage-2 mapping (see
XENMAPSPACE_dev_mmio). Note that currently, the MMIO are always mapped with the attribute Device-nGnRE. There is plan to change that in the future. So ACPI is implementing 2).Device Tree is currently implementing 1). But I would like to see the behavior of Xen the same no matter the firmware tables used. So I would lean towards 2).
That's fine by me.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 91 lines · Stefano Stabellini
Quoted 90 lines · Julien Grall
Hi Edgar,
Quoted 12 lines · Edgar E. Iglesias
Quoted 10 lines · Julien Grall
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Quoted 8 lines
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Yes please. I was not able to find the acronym with a quick search Google.
[...]
Quoted 17 lines
Quoted 7 lines
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
Yes, I agree.
Quoted 7 lines
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to
p2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Quoted 8 lines
Quoted 1 line
Any opinions?
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.htmlThe concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or unpredictable behavior that could be exploited.
I think it would be fine for DOM0. It is already a trusted domain and have other way to take down the platform.
Quoted 9 lines
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.
Another example is having the device mapped with different in 2 places with different cacheability attributes. The data accessed would not be coherent. But I believe that should not lead to a security issue.
Quoted 3 lines
It would be interesting to see a concrete example of a problematic system.
I believe it would depend a lot on how the platform have been designed.
I think we have two choices to go forward:
1) Relax the memory attribute on case by case. DOM0 would not be able
to exploit potential undefined behavior. However, this means that code is been added for any new device (e.g compatible string).
2) Relax the memory attribute on every case. DOM0 would be able to
exploit potential undefined behavior. On the benefit side, every devices can be used at its full performance without any change required in Xen.In the case of ACPI, we rely on DOM0 to provide the correct mapping attribute when asking to do the stage-2 mapping (see
XENMAPSPACE_dev_mmio). Note that currently, the MMIO are always mapped with the attribute Device-nGnRE. There is plan to change that in the future. So ACPI is implementing 2).
Quoted 5 lines
Quoted 3 lines
Device Tree is currently implementing 1). But I would like to see the behavior of Xen the same no matter the firmware tables used. So I would lean towards 2).
That's fine by me.
OK, I've sent a v2 of the mmio-sram patch to avoid delays with that part.
But now that we seem to be in agreement with going for relaxing the default S2 mappings, perhaps we should ditch the whitelist/blacklist mechanism? Or does someone see a need for a blacklist?
Cheers,
Edgar
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Edgar,
Quoted 96 lines · Edgar E. Iglesias
Quoted 95 lines · Stefano Stabellini
Quoted 93 lines · Julien Grall
Hi Edgar,
Quoted 12 lines · Edgar E. Iglesias
Quoted 10 lines · Julien Grall
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Quoted 8 lines
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Yes please. I was not able to find the acronym with a quick search Google.
[...]
Quoted 17 lines
Quoted 7 lines
I consider it as the most trusted domain and has other way to mess up the platform. So I am fine with this relaxation for the hardware domain (AKA DOM0).
However, I have the feeling that we need this kind of relaxation for many devices. For instance prefetchable memory BARs for PCI would have to be cacheable, same for integrated graphic cards.
Yes, I agree.
Quoted 7 lines
I am wondering whether for DOM0 only (*not the other guests), we should relax the default stage-2 attribute mapping to
p2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the performance of memory access in DOM0.
Quoted 8 lines
Quoted 1 line
Any opinions?
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.htmlThe concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or unpredictable behavior that could be exploited.
I think it would be fine for DOM0. It is already a trusted domain and have other way to take down the platform.
Quoted 9 lines
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.
Another example is having the device mapped with different in 2 places with different cacheability attributes. The data accessed would not be coherent. But I believe that should not lead to a security issue.
Quoted 3 lines
It would be interesting to see a concrete example of a problematic system.
I believe it would depend a lot on how the platform have been designed.
I think we have two choices to go forward:
1) Relax the memory attribute on case by case. DOM0 would not be able
to exploit potential undefined behavior. However, this means that code is been added for any new device (e.g compatible string).
2) Relax the memory attribute on every case. DOM0 would be able to
exploit potential undefined behavior. On the benefit side, every devices can be used at its full performance without any change required in Xen.In the case of ACPI, we rely on DOM0 to provide the correct mapping attribute when asking to do the stage-2 mapping (see
XENMAPSPACE_dev_mmio). Note that currently, the MMIO are always mapped with the attribute Device-nGnRE. There is plan to change that in the future. So ACPI is implementing 2).Device Tree is currently implementing 1). But I would like to see the behavior of Xen the same no matter the firmware tables used. So I would lean towards 2).
Quoted 8 lines
Quoted 1 line
That's fine by me.
OK, I've sent a v2 of the mmio-sram patch to avoid delays with that part.
But now that we seem to be in agreement with going for relaxing the default S2 mappings, perhaps we should ditch the whitelist/blacklist mechanism? Or does someone see a need for a blacklist?
I don't have in mind of any device requiring more tighter memory attribute from the hypervisor. AFAICT, it would only be necessary to do it if DOM0 was using wrong attribute, but that kernel would also have issue whilst running on baremetal.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 124 lines · Julien Grall
Hi Edgar,
Quoted 121 lines · Edgar E. Iglesias
Quoted 109 lines · Stefano Stabellini
Quoted 108 lines · Julien Grall
Hi Edgar,
Quoted 12 lines · Edgar E. Iglesias
Quoted 10 lines · Julien Grall
Quoted 7 lines · Edgar E. Iglesias
From: "Edgar E. Iglesias" <[email protected]>
Relax the mapping of mmio-sram nodes that do not set the no-memory-wc property to cached normal memory.
Rationale:
Allthough on chip memories are relatively fast compared tos/Allthough/Although/
Quoted 8 lines
Fixed for v2.
Quoted 4 lines
Quoted 2 lines
off-chip memories, large OCMs are still significantly slower
May I ask what does OCMs mean?
It means On Chip Memories. I can spell it out in v2.
Yes please. I was not able to find the acronym with a quick search Google.
[...]
Quoted 25 lines
Quoted 11 lines
I consider it as the most trusted domain and has other way to mess up the
platform. So I am fine with this relaxation for the hardware domain (AKA
DOM0).However, I have the feeling that we need this kind of relaxation for many
devices. For instance prefetchable memory BARs for PCI would have to be
cacheable, same for integrated graphic cards.Yes, I agree.
Quoted 10 lines
I am wondering whether for DOM0 only (*not the other guests), we should
relax the default stage-2 attribute mapping top2m_mmio_direct_c.So we would let DOM0 in charge of the final attribute. This may boost the
performance of memory access in DOM0.Any opinions?
Quoted 8 lines
I think it makes sense. We had a discussiong about it a while back ago:
https://lists.xenproject.org/archives/html/xen-devel/2015-05/msg02349.htmlThe concerns that were raised were wether there could be devices that could behave badly and possibly giving dom0 access to trig undefined or
unpredictable behavior that could be exploited.I think it would be fine for DOM0. It is already a trusted domain and have
other way to take down the platform.Quoted 10 lines
If dom0 accesses devices through a cache, access patterns will change. In theory it may trig unexpected behaviour in some device. It's hard to say unless talking about specific chips and implementations.
For example, given dom0 access to a DMA capable device may also achieve
the same. I.e access patterns from DMA units differ from the ones originating from a CPU using uncached device memory. It could trig similar kind of errors.Another example is having the device mapped with different in 2 places with
different cacheability attributes. The data accessed would not be coherent.
But I believe that should not lead to a security issue.Quoted 3 lines
It would be interesting to see a concrete example of a problematic system.
I believe it would depend a lot on how the platform have been designed.
I think we have two choices to go forward:
1) Relax the memory attribute on case by case. DOM0 would not be able
to exploit potential undefined behavior. However, this means that code is been
added for any new device (e.g compatible string).
2) Relax the memory attribute on every case. DOM0 would be able to
exploit potential undefined behavior. On the benefit side, every devices can
be used at its full performance without any change required in Xen.In the case of ACPI, we rely on DOM0 to provide the correct mapping attribute
when asking to do the stage-2 mapping (seeXENMAPSPACE_dev_mmio). Note that
currently, the MMIO are always mapped with the attribute Device-nGnRE. There
is plan to change that in the future. So ACPI is implementing 2).Quoted 7 lines
Quoted 5 lines
Device Tree is currently implementing 1). But I would like to see the behavior
of Xen the same no matter the firmware tables used. So I would lean towards
2).That's fine by me.
OK, I've sent a v2 of the mmio-sram patch to avoid delays with that part.
Quoted 8 lines
Quoted 3 lines
But now that we seem to be in agreement with going for relaxing the default S2 mappings, perhaps we should ditch the whitelist/blacklist mechanism? Or does someone see a need for a blacklist?
I don't have in mind of any device requiring more tighter memory attribute from the hypervisor. AFAICT, it would only be necessary to do it if DOM0 was using wrong attribute, but that kernel would also have issue whilst running on baremetal.
Edgar,
I'll just wait for the patch that relaxes stage-2 mappings. I won't apply this one.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel