eal: disable IOVA mode detection by default
PATCH 1/1 eal: disable IOVA mode detection by default
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>
--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)
config/common_base +5 -0
@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=y + +# # Recognize/ignore the AVX/AVX512 CPU flags for performance/power testing. # AVX512 is marked as experimental for now, will enable it after enough # field test and possible optimization.
lib/librte_eal/bsdapp/eal/eal.c +4 -0
@@ -570,8 +570,12 @@ rte_eal_init(int argc, char **argv)return -1 ; } +#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY &&
lib/librte_eal/linuxapp/eal/eal.c +4 -0
@@ -805,8 +805,12 @@ rte_eal_init(int argc, char **argv)return -1 ; } +#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY &&
Signature · 1 line
2.13.6
Quoted 20 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 9:07 AM
To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla
Subject: [PATCH] eal: disable IOVA mode detection by defaultFix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Quoted 7 lines
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>
Refer to how vhost-kernel works, we may leverage a memory region table to do the translation. The bad side is it's less efficient than current phys_to_virt.
Another side, we did not check the result of phys_to_virt, that's why kernel crashes.
Thanks,
Jianfeng
Quoted 22 lines · Jianfeng
Quoted 22 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 9:07 AM
To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla
Subject: [PATCH] eal: disable IOVA mode detection by defaultFix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")
Quoted 7 lines
Quoted 5 lines
Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>Refer to how vhost-kernel works, we may leverage a memory region table to do the translation. The bad side is it's less efficient than current
phys_to_virt.
Hi Jianfeng,
Can you please elaborate?
Thanks,
ferruh
Quoted 5 lines
Another side, we did not check the result of
phys_to_virt, that's why kernel crashes.Thanks,
Jianfeng
Quoted 40 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 2:33 PM
To: Tan, Jianfeng; Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Santosh Shukla
Subject: Re: [PATCH] eal: disable IOVA mode detection by defaultQuoted 11 lines · Jianfeng
Quoted 11 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 9:07 AM
To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla
Subject: [PATCH] eal: disable IOVA mode detection by defaultFix kernel crash with KNI because KNI requires physical addresses.
Quoted 7 lines
Quoted 7 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only
who
Quoted 10 lines
Quoted 9 lines
is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>
Quoted 7 lines
Quoted 1 line
Refer to how vhost-kernel works, we may leverage a memory region table
to do the translation. The bad side is it's less efficient than current
phys_to_virt.Hi Jianfeng,
Can you please elaborate?
It is very similar to what Jacob proposed (KNI IOMMU).
1. Share memsegs (memory regions) with KNI, some pairs of (userspace_addr, length).
2. KNI maintains an address translation table, (userspace_addr, length, kernel_addr).
3. Every time we need a kernel va, we search the table to obtain the addr.
Thanks,
Jianfeng
Quoted 10 lines
Thanks,
ferruhQuoted 1 line
Another side, we did not check the result of
phys_to_virt, that's whykernel crashes.
Quoted 4 lines
Thanks,
Jianfeng
Quoted 44 lines · Jianfeng
Quoted 44 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 2:33 PM
To: Tan, Jianfeng; Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Santosh Shukla
Subject: Re: [PATCH] eal: disable IOVA mode detection by defaultQuoted 11 lines · Jianfeng
Quoted 11 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 9:07 AM
To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla
Subject: [PATCH] eal: disable IOVA mode detection by defaultFix kernel crash with KNI because KNI requires physical addresses.
Quoted 7 lines
Quoted 7 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only
who
Quoted 11 lines
Quoted 9 lines
is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>Refer to how vhost-kernel works, we may leverage a memory region table
to do the translation. The bad side is it's less efficient than current
phys_to_virt.
Quoted 8 lines
Quoted 3 lines
Hi Jianfeng,
Can you please elaborate?
It is very similar to what Jacob proposed (KNI IOMMU).
1. Share memsegs (memory regions) with KNI, some pairs of (userspace_addr, length).
2. KNI maintains an address translation table, (userspace_addr, length,kernel_addr).
3. Every time we need a kernel va, we search the table to obtain the addr.
I see, this looks like can work.
But I concern about cost of this lookup, which needs to be done per packet. Current address translations are basic arithmetic operations.
What do you think doing va -> pa translation in userspace via eal APIs, and keep KNI kernel code intact?
Overall translation cost should be same, but the code complexity kept in eal layer which already knows about memsegs.
Quoted 16 lines
Thanks,
JianfengQuoted 10 lines
Thanks,
ferruhQuoted 1 line
Another side, we did not check the result of
phys_to_virt, that's whykernel crashes.
Quoted 4 lines
Thanks,
Jianfeng
Quoted 62 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 3:29 PM
To: Tan, Jianfeng; Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Santosh Shukla
Subject: Re: [PATCH] eal: disable IOVA mode detection by defaultQuoted 34 lines · Jianfeng
Quoted 34 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 2:33 PM
To: Tan, Jianfeng; Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Santosh Shukla
Subject: Re: [PATCH] eal: disable IOVA mode detection by defaultQuoted 11 lines · Jianfeng
Quoted 11 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, November 1, 2017 9:07 AM
To: Thomas Monjalon; Richardson, Bruce; Gonzalez Monroy, Sergio
Cc: [email protected]; Yigit, Ferruh; Tan, Jianfeng; Santosh Shukla
Subject: [PATCH] eal: disable IOVA mode detection by defaultFix kernel crash with KNI because KNI requires physical addresses.
Quoted 7 lines
Quoted 7 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only
who
Quoted 4 lines
Quoted 4 lines
is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>Refer to how vhost-kernel works, we may leverage a memory region
table
Quoted 9 lines
Quoted 6 lines
to do the translation. The bad side is it's less efficient than current
phys_to_virt.Hi Jianfeng,
Can you please elaborate?
It is very similar to what Jacob proposed (KNI IOMMU).
1. Share memsegs (memory regions) with KNI, some pairs of
Quoted 8 lines
(
userspace_addr, length).Quoted 1 line
2. KNI maintains an address translation table, (
userspace_addr, length,
kernel_addr).Quoted 1 line
3. Every time we need a kernel va, we search the table to obtain the addr.
I see, this looks like can work.
But I concern about cost of this lookup, which needs to be done per packet. Current address translations are basic arithmetic operations.
The cost depends on how memory distribution of DPDK is. It's LOG(N) complexity.
Quoted 4 lines
What do you think doing va -> pa translation in userspace via eal APIs, and keep
KNI kernel code intact?
That works, like a tx callback or tx_prepare for KNI pmd.
But it modifies mbuf, when we switch back this mbuf to use on IOVA_VA PMD, we change back to va again.
Quoted 2 lines
Overall translation cost should be same, but the code complexity kept in eal layer which already knows about memsegs.
This is more complex as I mentioned above.
Thanks,
Jianfeng
Quoted 17 lines
Quoted 17 lines
Thanks,
JianfengQuoted 10 lines
Thanks,
ferruhQuoted 1 line
Another side, we did not check the result of
phys_to_virt, that's whykernel crashes.
Quoted 4 lines
Thanks,
Jianfeng
Quoted 8 lines · Ferruh Yigit
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Quoted 7 lines
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Disabling _IOVA in config (static-way) defeats the dynamic iova autodetect purpose.
HW facilitates iova=pa/va address space so pmd's should able to adapt for both the programming mode.. meaning Perhaps phy2virt style translation might address the KNI crash. For that
KNI could check iova mode by referring to api rte_eal_iova_mode() and then do the phy2virt translation.
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6
Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (rte_eal_iova_mode() == RTE_IOVA_VA)
kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;
On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni, dma_addr_t dma_addr)
{
/* Translation is installed only when IOMMU is present */
if (kni->iommu_domain)
return iommu_iova_to_phys(kni->iommu_domain, dma_addr);
return dma_addr;
} Quoted 28 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0
config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 112
Quoted 6 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=y
Defeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.
Quoted 72 lines · Jerin Jacob
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (
rte_eal_iova_mode()==RTE_IOVA_VA)kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni,
dma_addr_tdma_addr){ /* Translation is installed only when IOMMU is present */ if (kni->iommu_domain) return iommu_iova_to_phys(kni->iommu_domain, dma_addr); return dma_addr; }Quoted 28 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 112
Quoted 6 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=yDefeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.
Quoted 1 line
This commit just enables IOVA VA mode for Intel drivers, that is how I can able to observe the issue, but it is not the source of the problem. Reverting that commit will not solve KNI crash with any other PMD that enables IOVA VA mode.
Related to the KNI, iommu is not involved at all, I am not clear with your above suggestion, physical address is required for kernelspace - userspace communication.
KNI uses physical address for two things:
1- Creates a buffer in userspace, a memzone, and shares its physical address to the kernel, so that both kernel and app can access same buffer.
The question is, even all devices supports IOVA VA mode, why creating a memzone that has real physical address info is not possible anymore?
For KNI case this is not related at all with what devices supports.
2- For each mbuf that will be sent to kernel, dpdk app puts physical address of that mbuf into shared buffer, so that kernel can access it. So that kernel can access to mbuf data that can be coming from any mempool.
For this the physical address of the mbuf is required.
Overall KNI needs to know physical address of mbufs and memzone.
This patch provides a way to have old behavior with a config option, so that KNI can work and anyone who needs to create memzone with physical address can a way to have it, and all PMDs will work fine.
If there is no need for these, it is possible to disable config and dynamic probing scheme is already there.
Thanks,
ferruh
-----Original Message-----
Quoted 85 lines
Date: Tue, 31 Oct 2017 23:21:18 -0700
From: Ferruh Yigit <[email protected]>
To: Jerin Jacob <[email protected]>
CC: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>, [email protected], Jianfeng Tan <[email protected]>, Santosh Shukla <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0Quoted 72 lines · Jerin Jacob
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (
rte_eal_iova_mode()==RTE_IOVA_VA)kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni,
dma_addr_tdma_addr){ /* Translation is installed only when IOMMU is present */ if (kni->iommu_domain) return iommu_iova_to_phys(kni->iommu_domain, dma_addr); return dma_addr; }Quoted 28 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 112
Quoted 6 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=yDefeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.
Quoted 5 lines
Quoted 1 line
This commit just enables IOVA VA mode for Intel drivers, that is how I can able to observe the issue, but it is not the source of the problem. Reverting that commit will not solve KNI crash with any other PMD that enables IOVA VA mode.
I don't understand why a PMD needs to enable IOVA_VA if it can support IOVA_PA. IMO, IOVA_VA should be enabled only for those device it can WORK ONLY on IOVA_VA mode. Forget about KNI, If we set CONFIG_RTE_EAL_USE_PHYS_IOVA as y then the normal stuff wont work for if PMD can operate only in IOVA_VA mode(like octeontx).
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode == IOVA_VA;
Quoted 3 lines
Related to the KNI, iommu is not involved at all, I am not clear with your above suggestion, physical address is required for kernelspace - userspace communication.
vhost-kernel addressed this case with IOVA as VA. I need to spend cycles on what takes to remove physical address dependency from KNI. But someone can add that support if it is required in future.
Quoted 26 lines
KNI uses physical address for two things:
1- Creates a buffer in userspace, a memzone, and shares its physical address to the kernel, so that both kernel and app can access same buffer.
The question is, even all devices supports IOVA VA mode, why creating a memzone that has real physical address info is not possible anymore?
For KNI case this is not related at all with what devices supports.2- For each mbuf that will be sent to kernel, dpdk app puts physical address of that mbuf into shared buffer, so that kernel can access it. So that kernel can access to mbuf data that can be coming from any mempool.
For this the physical address of the mbuf is required.Overall KNI needs to know physical address of mbufs and memzone.
This patch provides a way to have old behavior with a config option, so that KNI can work and anyone who needs to create memzone with physical address can a way to have it, and all PMDs will work fine.
If there is no need for these, it is possible to disable config and dynamic probing scheme is already there.
Thanks,
ferruh
Quoted 83 lines · Jerin Jacob
-----Original Message-----
Quoted 82 lines
Date: Tue, 31 Oct 2017 23:21:18 -0700
From: Ferruh Yigit <[email protected]>
To: Jerin Jacob <[email protected]>
CC: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>, [email protected], Jianfeng Tan <[email protected]>, Santosh Shukla <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0Quoted 69 lines · Jerin Jacob
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (
rte_eal_iova_mode()==RTE_IOVA_VA)kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni,
dma_addr_tdma_addr){ /* Translation is installed only when IOMMU is present */ if (kni->iommu_domain) return iommu_iova_to_phys(kni->iommu_domain, dma_addr); return dma_addr; }Quoted 27 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 112
Quoted 6 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=yDefeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
This commit just enables IOVA VA mode for Intel drivers, that is how I can able to observe the issue, but it is not the source of the problem. Reverting that commit will not solve KNI crash with any other PMD that enables IOVA VA mode.
I don't understand why a PMD needs to enable
IOVA_VAif it can supportIOVA_PA. IMO,IOVA_VAshould be enabled only for those device it can WORK ONLY onIOVA_VAmode.
IOVA_VA is also necessary if we don't want/have root privilege to run DPDK app.
Quoted 3 lines
Forget about KNI, If we set
CONFIG_RTE_EAL_USE_PHYS_IOVAas y then the normal stuff wont work for if PMD can operate only inIOVA_VAmode(like octeontx).
Yes, agreed.
Quoted 4 lines
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode ==
IOVA_VA;
For the KNI crash, do we really need to correct the case: make those PMDs (requires IOVA_VA) also work well with KNI?
- If no, we just need to report RTE_PCI_DRV_IOVA_AS_VA smartly.
- If yes, we shall make KNI work with VA.
Thanks,
Jianfeng
-----Original Message-----
Quoted 101 lines
Date: Wed, 1 Nov 2017 15:39:01 +0800
From: "Tan, Jianfeng" <[email protected]>
To: Jerin Jacob <[email protected]>, Ferruh Yigit
<[email protected]>
CC: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>, [email protected], Santosh Shukla <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0Quoted 86 lines · Jerin Jacob
-----Original Message-----
Quoted 85 lines
Date: Tue, 31 Oct 2017 23:21:18 -0700
From: Ferruh Yigit <[email protected]>
To: Jerin Jacob <[email protected]>
CC: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>, [email protected], Jianfeng Tan <[email protected]>, Santosh Shukla <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0Quoted 68 lines · Jerin Jacob
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (
rte_eal_iova_mode()==RTE_IOVA_VA)kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni,
dma_addr_tdma_addr){ /* Translation is installed only when IOMMU is present */ if (kni->iommu_domain) return iommu_iova_to_phys(kni->iommu_domain, dma_addr); return dma_addr; }Quoted 27 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 111
Quoted 5 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=yDefeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.Quoted 1 line
This commit just enables IOVA VA mode for Intel drivers, that is how I can able to observe the issue, but it is not the source of the problem. Reverting that commit will not solve KNI crash with any other PMD that enables IOVA VA mode.
Quoted 6 lines
Quoted 3 lines
I don't understand why a PMD needs to enable
IOVA_VAif it can supportIOVA_PA. IMO,IOVA_VAshould be enabled only for those device it can WORK ONLY onIOVA_VAmode.
IOVA_VAis also necessary if we don't want/have root privilege to run DPDK app.
OK.
Quoted 12 lines
Quoted 4 lines
Forget about KNI, If we set
CONFIG_RTE_EAL_USE_PHYS_IOVAas y then the normal stuff wont work for if PMD can operate only inIOVA_VAmode(like octeontx).Yes, agreed.
Quoted 4 lines
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode ==
IOVA_VA;
Quoted 4 lines
For the KNI crash, do we really need to correct the case: make those PMDs (requires
IOVA_VA) also work well with KNI?
- If no, we just need to reportRTE_PCI_DRV_IOVA_AS_VAsmartly.
- If yes, we shall make KNI work with VA.
I would say "yes". But for this immediate release, I would say "no".
Quoted 4 lines
Thanks,
Jianfeng
Quoted 3 lines
-----Original Message-----
...
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode ==
IOVA_VA;
Quoted 6 lines
Quoted 4 lines
For the KNI crash, do we really need to correct the case: make those PMDs (requires
IOVA_VA) also work well with KNI?
- If no, we just need to reportRTE_PCI_DRV_IOVA_AS_VAsmartly.
- If yes, we shall make KNI work with VA.I would say "yes". But for this immediate release, I would say "no".
Ferruh, if you also agree on "no" for now, we might fix it like this:
For PMDs like ixgbe/i40e/..., we detect if phys_addrs_available to decide RTE_PCI_DRV_IOVA_AS_VA in a RTE_INIT function.
How do you think of that?
Thanks,
Jianfeng
Quoted 10 lines · Jianfeng
Quoted 3 lines
-----Original Message-----
...
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode ==
IOVA_VA;
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
For the KNI crash, do we really need to correct the case: make those PMDs (requires
IOVA_VA) also work well with KNI?
- If no, we just need to reportRTE_PCI_DRV_IOVA_AS_VAsmartly.
- If yes, we shall make KNI work with VA.I would say "yes". But for this immediate release, I would say "no".
Ferruh, if you also agree on "no" for now, we might fix it like this:
I agree with Jerin, for this release "no", for long term "yes".
Quoted 4 lines
For PMDs like ixgbe/i40e/..., we detect if
phys_addrs_availableto decideRTE_PCI_DRV_IOVA_AS_VAin aRTE_INITfunction.How do you think of that?
Instead Santosh's suggestion looks simpler. Detect if kni module inserted, if so set IOVA PA mode.
I guess rte_bus_get_iommu_class() can updated for this check as workaround.
Quoted 4 lines
Thanks,
Jianfeng
Quoted 92 lines · Jerin Jacob
-----Original Message-----
Quoted 85 lines
Date: Tue, 31 Oct 2017 23:21:18 -0700
From: Ferruh Yigit <[email protected]>
To: Jerin Jacob <[email protected]>
CC: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>, [email protected], Jianfeng Tan <[email protected]>, Santosh Shukla <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0Quoted 72 lines · Jerin Jacob
-----Original Message-----
Quoted 11 lines
Date: Wed, 1 Nov 2017 01:07:26 +0000
From: Ferruh Yigit <[email protected]>
To: Thomas Monjalon <[email protected]>, Bruce Richardson
<[email protected]>, Sergio Gonzalez Monroy <[email protected]>
CC: [email protected], Ferruh Yigit <[email protected]>, Jianfeng Tan
<[email protected]>, Santosh Shukla <[email protected]>
Subject: [dpdk-dev] [PATCH] eal: disable IOVA mode detection by default
X-Mailer: git-send-email 2.13.6Quoted 1 line
Fix kernel crash with KNI because KNI requires physical addresses.
The actual fix would be to make KNI IOMMU aware based on the DPDK mode.
ie. On slow path,
/* Get iommu domain for iova to physical addr conversion */ if (
rte_eal_iova_mode()==RTE_IOVA_VA)kni->iommu_domain = iommu_get_domain_for_dev(dev); else kni->iommu_domain = NULL;On fast path,
static inline u64 kni_iova_to_phys(struct ... *kni,
dma_addr_tdma_addr){ /* Translation is installed only when IOMMU is present */ if (kni->iommu_domain) return iommu_iova_to_phys(kni->iommu_domain, dma_addr); return dma_addr; }Quoted 28 lines
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
Cc: Jianfeng Tan <[email protected]>
Cc: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>--- config/common_base | 5 +++++ lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/linuxapp/eal/eal.c | 4 ++++ 3 files changed, 13 insertions(+)config/common_base +0
-0config/common_base CONFIG_RTE_MALLOC_DEBUG=n · line 112
Quoted 6 lines
config/common_base +3
-0@@ -107,6 +107,11 @@ CONFIG_RTE_MALLOC_DEBUG=n CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n # +# Disabling PHYS_IOVA may crash kernel for KNI, use with caution +# +CONFIG_RTE_EAL_USE_PHYS_IOVA=yDefeat the purpose of all dynamic probing scheme.
Either we can fix the KNI or revert the following patch for this release.Quoted 5 lines
Quoted 1 line
This commit just enables IOVA VA mode for Intel drivers, that is how I can able to observe the issue, but it is not the source of the problem. Reverting that commit will not solve KNI crash with any other PMD that enables IOVA VA mode.
Quoted 5 lines
I don't understand why a PMD needs to enable
IOVA_VAif it can supportIOVA_PA. IMO,IOVA_VAshould be enabled only for those device it can WORK ONLY onIOVA_VAmode. Forget about KNI, If we setCONFIG_RTE_EAL_USE_PHYS_IOVAas y then the normal stuff wont work for if PMD can operate only inIOVA_VAmode(like octeontx).
Hmm, I wasn't aware that octeontx only operate on IOVA VA mode, I got your concern now.
But still that config option still enables choosing between KNI and "IOVA_VA mode only" devices until KNI gets fixed. Unfortunately both won't work at same time for now.
Quoted 4 lines
Regarding the KNI crash, it can be avoid by first checking the exiting mode(rte_eal_iova_mode()). i.e since legacy driver like KNI need real physical address to work "now", it can grace full exit on the init time if mode ==
IOVA_VA;
Definitely agree to gracefully exit, but I was looking to make KNI work more than just exit without crash.
Quoted 6 lines
Quoted 2 lines
Related to the KNI, iommu is not involved at all, I am not clear with your above suggestion, physical address is required for kernelspace - userspace communication.
vhost-kernel addressed this case with IOVA as VA. I need to spend cycles on what takes to remove physical address dependency from KNI. But someone can add that support if it is required in future.
Since the iova patchset breaks the existing KNI, I would like to see KNI fix part of the iova work.
It doesn't look right to me that a new feature breaking the existing one.
Quoted 26 lines
Quoted 26 lines
KNI uses physical address for two things:
1- Creates a buffer in userspace, a memzone, and shares its physical address to the kernel, so that both kernel and app can access same buffer.
The question is, even all devices supports IOVA VA mode, why creating a memzone that has real physical address info is not possible anymore?
For KNI case this is not related at all with what devices supports.2- For each mbuf that will be sent to kernel, dpdk app puts physical address of that mbuf into shared buffer, so that kernel can access it. So that kernel can access to mbuf data that can be coming from any mempool.
For this the physical address of the mbuf is required.Overall KNI needs to know physical address of mbufs and memzone.
This patch provides a way to have old behavior with a config option, so that KNI can work and anyone who needs to create memzone with physical address can a way to have it, and all PMDs will work fine.
If there is no need for these, it is possible to disable config and dynamic probing scheme is already there.
Thanks,
ferruh
01/11/2017 02:07, Ferruh Yigit:
Quoted 15 lines
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Signed-off-by Ferruh Yigit <[email protected]>---
lib/librte_eal/bsdapp/eal/eal.c rte_eal_init(int argc, char **argv) · line 578
Quoted 6 lines
lib/librte_eal/bsdapp/eal/eal.c +4
-0+#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif
I don't understand why you are adding a compile-time option. I think it should be an EAL option --use-phys-addr.
The opposite option may be required to force VA: --use-virt-addr. And if there is no option given, we fallback to autodetect. We can improve the autodetect by checking whether rte_kni.ko is loaded.
Opinions?
Quoted 14 lines · Thomas Monjalon
01/11/2017 02:07, Ferruh Yigit:
Quoted 13 lines
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")
Quoted 13 lines
lib/librte_eal/bsdapp/eal/eal.c rte_eal_init(int argc, char **argv) · line 578
Quoted 8 lines
Signed-off-by Ferruh Yigit <[email protected]>---
lib/librte_eal/bsdapp/eal/eal.c +4
-0+#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif I don't understand why you are adding a compile-time option. I think it should be an EAL option --use-phys-addr.
The opposite option may be required to force VA: --use-virt-addr. And if there is no option given, we fallback to autodetect. We can improve the autodetect by checking whether rte_kni.ko is loaded.
IMO, we could introduce a rule for kni in iova autodetection(/for linux case) such away that:
if cat /proc/modules has rte_kni entry
then use default iova=pa mode.
so +1 to your proposition Thomas.
Quoted 1 line
Opinions?
Quoted 30 lines · santosh
Quoted 14 lines · Thomas Monjalon
01/11/2017 02:07, Ferruh Yigit:
Quoted 13 lines
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")Quoted 13 lines
lib/librte_eal/bsdapp/eal/eal.c rte_eal_init(int argc, char **argv) · line 578
Quoted 8 lines
Signed-off-by Ferruh Yigit <[email protected]>---
lib/librte_eal/bsdapp/eal/eal.c +4
-0+#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif I don't understand why you are adding a compile-time option. I think it should be an EAL option --use-phys-addr.
The opposite option may be required to force VA: --use-virt-addr. And if there is no option given, we fallback to autodetect. We can improve the autodetect by checking whether rte_kni.ko is loaded.
Quoted 5 lines
IMO, we could introduce a rule for kni in iova autodetection(/for linux case) such away that:
if cat
/proc/moduleshasrte_knientry
then use default iova=pa mode.
This sounds good as a workaround for this release [1].
For long term I believe KNI should be updated to work with virtual addresses.
[1]
This won't work if both IOVA VA mode only device and KNI used together. But I assume this is not common use case.
Quoted 5 lines
so +1 to your proposition Thomas.
Quoted 1 line
Opinions?
Quoted 14 lines · Thomas Monjalon
01/11/2017 02:07, Ferruh Yigit:
Quoted 13 lines
Fix kernel crash with KNI because KNI requires physical addresses.
A config option introduced to disable IOVA mode detection and to set it to physical address by default. Disabling config option will enable IOVA mode detection.
When there is no intension to use KNI, it is safe to enable detection.
Config option disable IOVA mode detection by default to be sure only who is aware of result enable it.
Fixes 72d013644bd6 ("mem: honor IOVA mode in malloc virt2phy")
Quoted 13 lines
lib/librte_eal/bsdapp/eal/eal.c rte_eal_init(int argc, char **argv) · line 578
Quoted 8 lines
Signed-off-by Ferruh Yigit <[email protected]>---
lib/librte_eal/bsdapp/eal/eal.c +4
-0+#ifdef RTE_EAL_USE_PHYS_IOVA +rte_eal_get_configuration ()->iova_mode =RTE_IOVA_PA ; +#else /* autodetect the iova mapping mode (default is iova_pa) */ rte_eal_get_configuration ()->iova_mode =rte_bus_get_iommu_class (); +#endif I don't understand why you are adding a compile-time option. I think it should be an EAL option --use-phys-addr.
The opposite option may be required to force VA: --use-virt-addr. And if there is no option given, we fallback to autodetect.
It was to have old behavior by default without doing anything special, so that previous KNI applications can continue to run as it is.
Quoted 4 lines
We can improve the autodetect by checking whether rte_kni.ko is loaded.
Opinions?