Re: [PATCH 2/2] iommu/amd: Remove performance counter pre-initialization test

From: David Coe
Date: Thu Apr 15 2021 - 12:20:40 EST


Hi Suravee!

On 15/04/2021 10:28, Suthikulpanit, Suravee wrote:
David,

On 4/14/2021 10:33 PM, David Coe wrote:
Hi Suravee!

I've re-run your revert+update patch on Ubuntu's latest kernel 5.11.0-14 partly to check my mailer's 'mangling' hadn't also reached the code!

There are 3 sets of results in the attachment, all for the Ryzen 2400G. The as-distributed kernel already incorporates your IOMMU RFCv3 patch.

A. As-distributed kernel (cold boot)
    >5 retries, so no IOMMU read/write capability, no amd_iommu events.

B. As-distributed kernel (warm boot)
    <5 retries, amd_iommu running stats show large numbers as before.

C. Revert+Update kernel
    amd_iommu events listed and also show large hit/miss numbers.

In due course, I'll load the new (revert+update) kernel on the 4700G but won't overload your mail-box unless something unusual turns up.

Best regards,


For the Ryzen 2400G, could you please try with:
- 1 event at a time
- Not more than 8 events (On your system, it has 2 banks x 4 counters/bank.
I am trying to see if this issue might be related to the counters multiplexing).

Thanks,

Herewith similar one-at-a-time perf stat results for the Ryzen 4700U. As before, more than 8 events displays the third (%) column and (sometimes) 'silly' numbers in the first column.

--
David
$ sudo ./iommu_list.sh

Performance counter stats for 'system wide':

20 amd_iommu_0/cmd_processed/

10.003010666 seconds time elapsed


Performance counter stats for 'system wide':

5 amd_iommu_0/cmd_processed_inv/

10.002349464 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/ign_rd_wr_mmio_1ff8h/

10.002386129 seconds time elapsed


Performance counter stats for 'system wide':

325 amd_iommu_0/int_dte_hit/

10.002346630 seconds time elapsed


Performance counter stats for 'system wide':

2 amd_iommu_0/int_dte_mis/

10.002365656 seconds time elapsed


Performance counter stats for 'system wide':

356 amd_iommu_0/mem_dte_hit/

10.002426866 seconds time elapsed


Performance counter stats for 'system wide':

3,955 amd_iommu_0/mem_dte_mis/

10.002729058 seconds time elapsed


Performance counter stats for 'system wide':

4 amd_iommu_0/mem_iommu_tlb_pde_hit/

10.002422610 seconds time elapsed


Performance counter stats for 'system wide':

1,326 amd_iommu_0/mem_iommu_tlb_pde_mis/

10.002397045 seconds time elapsed


Performance counter stats for 'system wide':

1,009 amd_iommu_0/mem_iommu_tlb_pte_hit/

10.002445347 seconds time elapsed


Performance counter stats for 'system wide':

1,072 amd_iommu_0/mem_iommu_tlb_pte_mis/

10.002414734 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/mem_pass_excl/

10.002435482 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/mem_pass_pretrans/

10.002409956 seconds time elapsed


Performance counter stats for 'system wide':

3,405 amd_iommu_0/mem_pass_untrans/

10.002563812 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/mem_target_abort/

10.002473657 seconds time elapsed


Performance counter stats for 'system wide':

1,311 amd_iommu_0/mem_trans_total/

10.002471787 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/page_tbl_read_gst/

10.002216033 seconds time elapsed


Performance counter stats for 'system wide':

276,609 amd_iommu_0/page_tbl_read_nst/

10.002029261 seconds time elapsed


Performance counter stats for 'system wide':

126,161 amd_iommu_0/page_tbl_read_tot/

10.003569029 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/smi_blk/

10.001871818 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/smi_recv/

10.002212891 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/tlb_inv/

10.002396606 seconds time elapsed


Performance counter stats for 'system wide':

0 amd_iommu_0/vapic_int_guest/

10.002435308 seconds time elapsed


Performance counter stats for 'system wide':

340 amd_iommu_0/vapic_int_non_guest/

10.002405868 seconds time elapsed


$ sudo perf stat -e 'amd_iommu_0/mem_dte_hit/, amd_iommu_0/mem_dte_mis/, amd_iommu_0/mem_iommu_tlb_pde_hit/, amd_iommu_0/mem_iommu_tlb_pde_mis/, amd_iommu_0/mem_iommu_tlb_pte_hit/, amd_iommu_0/mem_iommu_tlb_pte_mis/' sleep 10

Performance counter stats for 'system wide':

345 amd_iommu_0/mem_dte_hit/
606 amd_iommu_0/mem_dte_mis/
10 amd_iommu_0/mem_iommu_tlb_pde_hit/
910 amd_iommu_0/mem_iommu_tlb_pde_mis/
140 amd_iommu_0/mem_iommu_tlb_pte_hit/
797 amd_iommu_0/mem_iommu_tlb_pte_mis/

10.002553966 seconds time elapsed


$ sudo perf stat -e 'amd_iommu_0/mem_dte_hit/, amd_iommu_0/mem_dte_mis/, amd_iommu_0/mem_iommu_tlb_pde_hit/, amd_iommu_0/mem_iommu_tlb_pde_mis/, amd_iommu_0/mem_iommu_tlb_pte_hit/, amd_iommu_0/mem_iommu_tlb_pte_mis/, amd_iommu_0/mem_pass_excl/, amd_iommu_0/mem_pass_pretrans/, amd_iommu_0/mem_pass_untrans/, amd_iommu_0/mem_target_abort/, amd_iommu_0/mem_trans_total/' sleep 10

Performance counter stats for 'system wide':

340 amd_iommu_0/mem_dte_hit/ (72.65%)
389 amd_iommu_0/mem_dte_mis/ (72.67%)
8 amd_iommu_0/mem_iommu_tlb_pde_hit/ (72.71%)
849 amd_iommu_0/mem_iommu_tlb_pde_mis/ (72.76%)
96 amd_iommu_0/mem_iommu_tlb_pte_hit/ (72.78%)
742 amd_iommu_0/mem_iommu_tlb_pte_mis/ (72.75%)
0 amd_iommu_0/mem_pass_excl/ (72.76%)
0 amd_iommu_0/mem_pass_pretrans/ (72.76%)
6 amd_iommu_0/mem_pass_untrans/ (72.77%)
0 amd_iommu_0/mem_target_abort/ (72.71%)
1,122 amd_iommu_0/mem_trans_total/ (72.69%)

10.002471480 seconds time elapsed