Re: [PATCH v3 2/3] perf/smmuv3: Add a MODULE_SOFTDEP() to indicate dependency on SMMU

2021-01-29 Thread Leizhen (ThunderTown)



On 2021/1/30 1:03, Robin Murphy wrote:
> On 2021-01-29 15:34, John Garry wrote:
>> On 29/01/2021 15:12, Robin Murphy wrote:
>>> On 2021-01-27 11:32, Zhen Lei wrote:
 The MODULE_SOFTDEP() gives user space a hint of the loading sequence. And
 when command "modprobe arm_smmuv3_pmu" is executed, the arm_smmu_v3.ko is
 automatically loaded in advance.
>>>
>>> Why do we need this? If probe order doesn't matter when both drivers are 
>>> built-in, why should module load order?
>>>
>>> TBH I'm not sure why we even have a Kconfig dependency on ARM_SMMU_V3, 
>>> given that the drivers operate completely independently :/
>>
>> Can that Kconfig dependency just be removed? I think that it was added under 
>> the idea that there is no point in having the SMMUv3 PMU driver without the 
>> SMMUv3 driver.
> 
> A PMCG *might* be usable for simply counting transactions to measure device 
> activity regardless of its associated SMMU being enabled.

If that's the case, the SOFTDEP really shouldn't be added. I wasn't trying to 
make sure they were loaded in order, just to make sure that the SMMU was not 
forgotten to load.

> Either way, it's not really Kconfig's job to decide what makes sense (beyond 
> the top-level "can this driver *ever* be used on this platform" visibility 
> choices). Imagine if we gave every PCI/USB/etc. device driver an explicit 
> ?dependency on at least one host controller driver being enabled...
> 
> Robin.
> 
> .
> 



Re: [PATCH v3 2/3] perf/smmuv3: Add a MODULE_SOFTDEP() to indicate dependency on SMMU

2021-01-29 Thread Robin Murphy

On 2021-01-29 15:34, John Garry wrote:

On 29/01/2021 15:12, Robin Murphy wrote:

On 2021-01-27 11:32, Zhen Lei wrote:
The MODULE_SOFTDEP() gives user space a hint of the loading sequence. 
And
when command "modprobe arm_smmuv3_pmu" is executed, the 
arm_smmu_v3.ko is

automatically loaded in advance.


Why do we need this? If probe order doesn't matter when both drivers 
are built-in, why should module load order?


TBH I'm not sure why we even have a Kconfig dependency on ARM_SMMU_V3, 
given that the drivers operate completely independently :/


Can that Kconfig dependency just be removed? I think that it was added 
under the idea that there is no point in having the SMMUv3 PMU driver 
without the SMMUv3 driver.


A PMCG *might* be usable for simply counting transactions to measure 
device activity regardless of its associated SMMU being enabled. Either 
way, it's not really Kconfig's job to decide what makes sense (beyond 
the top-level "can this driver *ever* be used on this platform" 
visibility choices). Imagine if we gave every PCI/USB/etc. device driver 
an explicit dependency on at least one host controller driver being 
enabled...


Robin.


[PATCH v3 2/3] perf/smmuv3: Add a MODULE_SOFTDEP() to indicate dependency on SMMU

2021-01-27 Thread Zhen Lei
The MODULE_SOFTDEP() gives user space a hint of the loading sequence. And
when command "modprobe arm_smmuv3_pmu" is executed, the arm_smmu_v3.ko is
automatically loaded in advance.

Signed-off-by: Zhen Lei 
---
 drivers/perf/arm_smmuv3_pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index e5e505a0804fe53..9a305ac51208cd2 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -950,6 +950,7 @@ static void __exit arm_smmu_pmu_exit(void)
 module_exit(arm_smmu_pmu_exit);
 
 MODULE_DESCRIPTION("PMU driver for ARM SMMUv3 Performance Monitors Extension");
+MODULE_SOFTDEP("pre: arm_smmu_v3");
 MODULE_AUTHOR("Neil Leeder ");
 MODULE_AUTHOR("Shameer Kolothum ");
 MODULE_LICENSE("GPL v2");
-- 
1.8.3