From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] iommu/vt-d: Use cmpxchg16b to update posted format IRTE atomically
Date: Thu, 15 Oct 2015 16:24:20 +0200 [thread overview]
Message-ID: <20151015142420.GT27420@8bytes.org> (raw)
In-Reply-To: <1444875551-4064-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On Thu, Oct 15, 2015 at 10:19:11AM +0800, Feng Wu wrote:
> If IRTE is in posted format, the 'pda' field goes across the 64-bit
> boundary, we need use cmpxchg16b to atomically update it. We only
> expose posted-interrupt when X86_FEATURE_CX16 is supported and use
> to update it atomically.
>
> Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/iommu/intel_irq_remapping.c | 33 ++++++++++++++++++++++++++++++---
> 1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
> index f15692a..b4f7569 100644
> --- a/drivers/iommu/intel_irq_remapping.c
> +++ b/drivers/iommu/intel_irq_remapping.c
> @@ -169,8 +169,26 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
> index = irq_iommu->irte_index + irq_iommu->sub_handle;
> irte = &iommu->ir_table->base[index];
>
> - set_64bit(&irte->low, irte_modified->low);
> - set_64bit(&irte->high, irte_modified->high);
> +#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
> + if ((irte->pst == 1) || (irte_modified->pst == 1)) {
> + bool ret;
> +
> + ret = cmpxchg_double(&irte->low, &irte->high,
> + irte->low, irte->high,
> + irte_modified->low, irte_modified->high);
> + /*
> + * We use cmpxchg16 to atomically update the 128-bit IRTE,
> + * and it cannot be updated by the hardware or other processors
> + * behind us, so the return value of cmpxchg16 should be the
> + * same as the old value.
> + */
> + BUG_ON(!ret);
Changed this to a WARN_ON, otherwise applied.
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Feng Wu <feng.wu@intel.com>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/vt-d: Use cmpxchg16b to update posted format IRTE atomically
Date: Thu, 15 Oct 2015 16:24:20 +0200 [thread overview]
Message-ID: <20151015142420.GT27420@8bytes.org> (raw)
In-Reply-To: <1444875551-4064-1-git-send-email-feng.wu@intel.com>
On Thu, Oct 15, 2015 at 10:19:11AM +0800, Feng Wu wrote:
> If IRTE is in posted format, the 'pda' field goes across the 64-bit
> boundary, we need use cmpxchg16b to atomically update it. We only
> expose posted-interrupt when X86_FEATURE_CX16 is supported and use
> to update it atomically.
>
> Signed-off-by: Feng Wu <feng.wu@intel.com>
> ---
> drivers/iommu/intel_irq_remapping.c | 33 ++++++++++++++++++++++++++++++---
> 1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
> index f15692a..b4f7569 100644
> --- a/drivers/iommu/intel_irq_remapping.c
> +++ b/drivers/iommu/intel_irq_remapping.c
> @@ -169,8 +169,26 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
> index = irq_iommu->irte_index + irq_iommu->sub_handle;
> irte = &iommu->ir_table->base[index];
>
> - set_64bit(&irte->low, irte_modified->low);
> - set_64bit(&irte->high, irte_modified->high);
> +#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
> + if ((irte->pst == 1) || (irte_modified->pst == 1)) {
> + bool ret;
> +
> + ret = cmpxchg_double(&irte->low, &irte->high,
> + irte->low, irte->high,
> + irte_modified->low, irte_modified->high);
> + /*
> + * We use cmpxchg16 to atomically update the 128-bit IRTE,
> + * and it cannot be updated by the hardware or other processors
> + * behind us, so the return value of cmpxchg16 should be the
> + * same as the old value.
> + */
> + BUG_ON(!ret);
Changed this to a WARN_ON, otherwise applied.
next prev parent reply other threads:[~2015-10-15 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 2:19 [PATCH] iommu/vt-d: Use cmpxchg16b to update posted format IRTE atomically Feng Wu
2015-10-15 2:19 ` Feng Wu
[not found] ` <1444875551-4064-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-10-15 14:24 ` Joerg Roedel [this message]
2015-10-15 14:24 ` Joerg Roedel
[not found] ` <20151015142420.GT27420-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-16 1:01 ` Wu, Feng
2015-10-16 1:01 ` Wu, Feng
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=20151015142420.GT27420@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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.