Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-08-21 Thread Lennert Buytenhek
On Thu, Aug 05, 2021 at 11:26:25AM -0500, Suthikulpanit, Suravee wrote: > Lennert, Hi Suravee, > > - EVENT_FLAG_I unset, but the request was a translation request > > (EVENT_FLAG_TR set) or the target page was not present > > (EVENT_FLAG_PR unset): call report_iommu_fault(), but the RW > >

[PATCH,RFC] iommu/amd: Recover from event log overflow

2021-08-21 Thread Lennert Buytenhek
, or the IOMMU won't actually resume logging events. Signed-off-by: Lennert Buytenhek --- N.B.: I have only tested this change against an older in-house custom kernel version. (Where it appears to survive stress testing.) This version of the patch was only compile-tested. This patch makes

[PATCH v3] iommu/amd: Use report_iommu_fault()

2021-08-03 Thread Lennert Buytenhek
faults I encounter are all to non-present (!EVENT_FLAG_PR) mappings, in which case EVENT_FLAG_RW doesn't make sense. Signed-off-by: Lennert Buytenhek --- Changes for v3: - Test fault flags via macros. (Suggested by Suravee Suthikulpanit.) Changes for v2: - Don't call report_iommu_fault() for IRQ

Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-08-03 Thread Lennert Buytenhek
On Fri, Jul 30, 2021 at 05:32:16AM +0300, Lennert Buytenhek wrote: > > > This patch makes iommu/amd call report_iommu_fault() when an I/O page > > > fault occurs, which has two effects: > > > > > > 1) It allows device drivers to register a callback to be n

Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-07-29 Thread Lennert Buytenhek
[drvname] :05:00.0 iova=0x914826a0 flags=0x > > > > For determining IOMMU_FAULT_{READ,WRITE}, I followed the AMD IOMMU > > spec, but I haven't tested that bit of the code, as the page faults I > > encounter are all to non-present (!EVENT_FLAG_PR) mapping

Re: [PATCH v2] iommu/amd: Use report_iommu_fault()

2021-09-25 Thread Lennert Buytenhek
On Sat, Aug 21, 2021 at 06:44:39PM +0300, Lennert Buytenhek wrote: > > > - EVENT_FLAG_I unset, but the request was a translation request > > > (EVENT_FLAG_TR set) or the target page was not present > > > (EVENT_FLAG_PR unset): call report_iommu_fault(), but the RW

[PATCH v4] iommu/amd: Use report_iommu_fault()

2021-09-25 Thread Lennert Buytenhek
pages. Signed-off-by: Lennert Buytenhek --- Tested on v5.15-rc2 on a Ryzen 3700X, where it has the desired effect. Changes for v4: - Unconditionally pass through RW bit, after testing that suggests that this bit is reliable even for I/O page faults to non-present pages. Changes for v3: - Test

[PATCH v5] iommu/amd: Use report_iommu_fault()

2021-09-28 Thread Lennert Buytenhek
pages. Signed-off-by: Lennert Buytenhek --- Tested on v5.15-rc3 on a Ryzen 3700X and on a Ryzen 5950X, where it has the desired effect. Changes for v5: - Code formatting tweaking. (Suggested by Joerg Roedel.) Changes for v4: - Unconditionally pass through RW bit, after testing that suggests

Re: [PATCH,RFC] iommu/amd: Recover from event log overflow

2021-09-30 Thread Lennert Buytenhek
On Tue, Sep 28, 2021 at 10:45:30AM +0200, Joerg Roedel wrote: > Hi Lennert, Hi Joerg, Thanks for your feedback! > > +/* > > + * This function restarts event logging in case the IOMMU experienced > > + * an event log buffer overflow. > > + */ > > +void amd_iommu_restart_event_logging(struct

[PATCH v2] iommu/amd: Recover from event log overflow

2021-10-04 Thread Lennert Buytenhek
, or the IOMMU won't actually resume logging events. Signed-off-by: Lennert Buytenhek --- Tested on v5.15-rc4 on a Ryzen 3700X. Changes for v2: - Rate limit event log overflow messages. drivers/iommu/amd/amd_iommu.h | 1 + drivers/iommu/amd/amd_iommu_types.h | 1 + drivers/iommu/amd/init.c

[PATCH] iommu/amd: Fix printing of IOMMU events when rate limiting kicks in

2021-07-21 Thread Lennert Buytenhek
panit Signed-off-by: Lennert Buytenhek --- drivers/iommu/amd/iommu.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 811a49a95d04..a7d6d78147b7 100644 --- a/drivers/iommu/amd/iommu.c ++

Re: [PATCH] iommu/amd: Fix I/O page fault logging ratelimit test

2021-07-21 Thread Lennert Buytenhek
On Tue, Jul 20, 2021 at 07:05:50PM -0500, Suthikulpanit, Suravee wrote: > Hi Lennert, Hi Suravee, > > On an AMD system, I/O page faults are usually logged like this: > > > > diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c > > index 811a49a95d04..7ae426b092f2 100644 > >

[PATCH] iommu/amd: Fix I/O page fault logging ratelimit test

2021-07-18 Thread Lennert Buytenhek
eeds, we will log the fault anyway, but in a different format. Change this to only check printk_ratelimit() if !dev_data, which seems to be what had been originally intended. Signed-off-by: Lennert Buytenhek --- drivers/iommu/amd/iommu.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -

[PATCH,RFC] iommu/amd: Use report_iommu_fault()

2021-07-19 Thread Lennert Buytenhek
faults I encounter are all to non-present (!EVENT_FLAG_PR) mappings, in which case EVENT_FLAG_RW doesn't make sense. Signed-off-by: Lennert Buytenhek --- drivers/iommu/amd/amd_iommu_types.h |4 drivers/iommu/amd/iommu.c | 25 + 2 files changed, 29

Re: [PATCH,RFC] iommu/amd: Use report_iommu_fault()

2021-07-22 Thread Lennert Buytenhek
ent is used to communicate various types of > fault events, why don't we just pass the flags as-is? This way, it can > be used to report/trace various types of IO_PAGE_FAULT events (e.g. > for I/O page table, interrupt remapping, and etc). > > Interested parties can register domain fault

Re: [PATCH,RFC] iommu/amd: Use report_iommu_fault()

2021-07-26 Thread Lennert Buytenhek
On Mon, Jul 26, 2021 at 01:54:49PM +0200, Joerg Roedel wrote: > Hi Lennert, Hi Joerg, > On Mon, Jul 19, 2021 at 12:54:43PM +0300, Lennert Buytenhek wrote: > > + if (dev_data) { > > + int report_flags; > > + > > + /* > > +

[PATCH v2] iommu/amd: Use report_iommu_fault()

2021-07-26 Thread Lennert Buytenhek
faults I encounter are all to non-present (!EVENT_FLAG_PR) mappings, in which case EVENT_FLAG_RW doesn't make sense. Signed-off-by: Lennert Buytenhek --- Changes since v1 RFC: - Don't call report_iommu_fault() for IRQ remapping faults. (Suggested by Joerg Roedel.) drivers/iommu/amd