All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Cc: will@kernel.org, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	mingo@redhat.com, bp@alien8.de, joe@perches.com,
	tglx@linutronix.de, zhongjiang@huawei.com
Subject: Re: [PATCH] x86/iommu: Fix two minimal issues in check_iommu_entries()
Date: Mon, 4 Jan 2021 14:02:40 -0500	[thread overview]
Message-ID: <20210104190240.GF6029@char.us.oracle.com> (raw)
In-Reply-To: <20201223062412.343-1-zhenzhong.duan@gmail.com>

On Wed, Dec 23, 2020 at 02:24:12PM +0800, Zhenzhong Duan wrote:
> check_iommu_entries() checks for cyclic dependency in iommu entries
> and fixes the cyclic dependency by setting x->depend to NULL. But
> this repairing isn't correct if q is in front of p, there will be
> "EXECUTION ORDER INVALID!" report following. Fix it by NULLing
> whichever in the front.
> 
> The second issue is about the report of exectuion order reverse,
> the order is reversed incorrectly in the report, fix it.

Heya!

When you debugged this, did you by any chance save the
serial logs and the debug logs to double-check it?

Thanks!
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> ---
>  arch/x86/kernel/pci-iommu_table.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-iommu_table.c b/arch/x86/kernel/pci-iommu_table.c
> index 2e9006c..40c8249 100644
> --- a/arch/x86/kernel/pci-iommu_table.c
> +++ b/arch/x86/kernel/pci-iommu_table.c
> @@ -60,7 +60,10 @@ void __init check_iommu_entries(struct iommu_table_entry *start,
>  			printk(KERN_ERR "CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n",
>  			       p->detect, q->detect);
>  			/* Heavy handed way..*/
> -			x->depend = NULL;
> +			if (p > q)
> +				q->depend = NULL;
> +			else
> +				p->depend = NULL;
>  		}
>  	}
>  
> @@ -68,7 +71,7 @@ void __init check_iommu_entries(struct iommu_table_entry *start,
>  		q = find_dependents_of(p, finish, p);
>  		if (q && q > p) {
>  			printk(KERN_ERR "EXECUTION ORDER INVALID! %pS should be called before %pS!\n",
> -			       p->detect, q->detect);
> +			       q->detect, p->detect);
>  		}
>  	}
>  }
> -- 
> 1.8.3.1
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Cc: linux-kernel@vger.kernel.org, zhongjiang@huawei.com,
	joe@perches.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, iommu@lists.linux-foundation.org,
	dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org,
	will@kernel.org
Subject: Re: [PATCH] x86/iommu: Fix two minimal issues in check_iommu_entries()
Date: Mon, 4 Jan 2021 14:02:40 -0500	[thread overview]
Message-ID: <20210104190240.GF6029@char.us.oracle.com> (raw)
In-Reply-To: <20201223062412.343-1-zhenzhong.duan@gmail.com>

On Wed, Dec 23, 2020 at 02:24:12PM +0800, Zhenzhong Duan wrote:
> check_iommu_entries() checks for cyclic dependency in iommu entries
> and fixes the cyclic dependency by setting x->depend to NULL. But
> this repairing isn't correct if q is in front of p, there will be
> "EXECUTION ORDER INVALID!" report following. Fix it by NULLing
> whichever in the front.
> 
> The second issue is about the report of exectuion order reverse,
> the order is reversed incorrectly in the report, fix it.

Heya!

When you debugged this, did you by any chance save the
serial logs and the debug logs to double-check it?

Thanks!
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> ---
>  arch/x86/kernel/pci-iommu_table.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-iommu_table.c b/arch/x86/kernel/pci-iommu_table.c
> index 2e9006c..40c8249 100644
> --- a/arch/x86/kernel/pci-iommu_table.c
> +++ b/arch/x86/kernel/pci-iommu_table.c
> @@ -60,7 +60,10 @@ void __init check_iommu_entries(struct iommu_table_entry *start,
>  			printk(KERN_ERR "CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n",
>  			       p->detect, q->detect);
>  			/* Heavy handed way..*/
> -			x->depend = NULL;
> +			if (p > q)
> +				q->depend = NULL;
> +			else
> +				p->depend = NULL;
>  		}
>  	}
>  
> @@ -68,7 +71,7 @@ void __init check_iommu_entries(struct iommu_table_entry *start,
>  		q = find_dependents_of(p, finish, p);
>  		if (q && q > p) {
>  			printk(KERN_ERR "EXECUTION ORDER INVALID! %pS should be called before %pS!\n",
> -			       p->detect, q->detect);
> +			       q->detect, p->detect);
>  		}
>  	}
>  }
> -- 
> 1.8.3.1
> 

  parent reply	other threads:[~2021-01-04 19:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  6:24 [PATCH] x86/iommu: Fix two minimal issues in check_iommu_entries() Zhenzhong Duan
2020-12-23  6:24 ` Zhenzhong Duan
2020-12-30  7:02 ` Borislav Petkov
2020-12-30  7:02   ` Borislav Petkov
2021-01-04  5:43   ` Zhenzhong Duan
2021-01-04  5:43     ` Zhenzhong Duan
2021-01-04 19:02 ` Konrad Rzeszutek Wilk [this message]
2021-01-04 19:02   ` Konrad Rzeszutek Wilk
2021-01-07  2:51   ` Zhenzhong Duan
2021-01-07  2:51     ` Zhenzhong Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210104190240.GF6029@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=bp@alien8.de \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=zhenzhong.duan@gmail.com \
    --cc=zhongjiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.