All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	BrianWoods <brian.woods@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [Xen-devel] [PATCH v3 08/14] AMD/IOMMU: introduce 128-bit IRTE non-guest-APIC IRTE format
Date: Tue, 23 Jul 2019 08:13:40 +0000	[thread overview]
Message-ID: <4266c118-7a89-ed64-6196-52a82ec6e42a@suse.com> (raw)
In-Reply-To: <c25f432f-5408-83ce-26f4-fe9a0edf4e46@citrix.com>

On 22.07.2019 17:43, Andrew Cooper wrote:
> On 22/07/2019 16:01, Jan Beulich wrote:
>> On 22.07.2019 15:36, Andrew Cooper wrote:
>>> On 22/07/2019 09:34, Jan Beulich wrote:
>>>> On 19.07.2019 19:27, Andrew Cooper wrote:
>>>>> On 16/07/2019 17:38, Jan Beulich wrote:
>>>>>> @@ -142,7 +178,15 @@ static void free_intremap_entry(const st
>>>>>>      {
>>>>>>          union irte_ptr entry = get_intremap_entry(iommu, bdf, index);
>>>>>>      
>>>>>> -    ACCESS_ONCE(entry.ptr32->raw[0]) = 0;
>>>>>> +    if ( iommu->ctrl.ga_en )
>>>>>> +    {
>>>>>> +        ACCESS_ONCE(entry.ptr128->raw[0]) = 0;
>>>>>> +        /* Low half (containing RemapEn) needs to be cleared first. */
>>>>>> +        barrier();
>>>>> While this will function on x86, I still consider this buggy.  From a
>>>>> conceptual point of view, barrier() is not the correct construction to
>>>>> use, whereas smp_wmb() is.
>>>> I think it's the 3rd time now that I respond saying that barrier() is
>>>> as good or as bad as smp_wmb(), just for different reasons.
>>> barrier() and smp_wmb() are different constructs, with specific,
>>> *different* meanings.  From a programmers point of view, they should be
>>> considered black boxes of functionality.
>>>
>>> barrier() is for forcing the compiler to not reorder things.
>>>
>>> smp_wmb() is about the external visibility of writes, as observed by a
>>> different entity on a coherent fabric.
>> I'm afraid I disagree here: The "smp" in its name means "CPU", not
>> "entity" in your sentence.
> 
> Citation definitely needed.

Which I did provide in the earlier reply: If what you say was
intended to be that way, the !CONFIG_SMP definitions in Linux were
wrong, and ...

> The term SMP means Symmetric MultiProcessing, but no computer these days
> matches any of the traditional definitions.  You can thank the fact we
> are one of the fastest evolving industries in the world, and that the
> term you're using is more than 20 years old.

... would have been for a long time.

> In particular, it predates cache-coherent uncore devices.
> Cache-coherent devices by definition have the same ordering properties
> and constraints as cpus, because they are part of one shared (or dare I
> say, symmetric), cache-coherent domain.
> 
> How would your argument change if the IOMMU was a real CPU running real
> x86 code?  Its interface to the rest of the system would be identical,
> and in that case, it would obviously need an smp_{r,w}mb() pair for
> correctness reasons.  This is why smp_wmb() is the only appropriate
> construct to use.

It wouldn't change at all. What matters (as per above) is the
understanding the OS has, i.e. what is being surfaced to it as CPU.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-07-23  8:15 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 16:30 [Xen-devel] [PATCH v3 00/14] x86: AMD x2APIC support Jan Beulich
2019-07-16 16:35 ` [Xen-devel] [PATCH v3 01/14] AMD/IOMMU: free more memory when cleaning up after error Jan Beulich
2019-07-19 15:02   ` Andrew Cooper
2019-07-19 18:22   ` Woods, Brian
2019-07-16 16:35 ` [Xen-devel] [PATCH v3 02/14] AMD/IOMMU: use bit field for extended feature register Jan Beulich
2019-07-17  6:19   ` Jan Beulich
2019-07-19 16:23   ` Andrew Cooper
2019-07-19 16:27     ` Jan Beulich
2019-07-16 16:36 ` [Xen-devel] [PATCH v3 03/14] AMD/IOMMU: use bit field for control register Jan Beulich
2019-07-19 18:23   ` Woods, Brian
2019-07-22  8:55     ` Jan Beulich
2019-07-16 16:36 ` [Xen-devel] [PATCH v3 04/14] AMD/IOMMU: use bit field for IRTE Jan Beulich
2019-07-19 15:56   ` Andrew Cooper
2019-07-19 16:16     ` Jan Beulich
2019-07-19 18:44       ` Andrew Cooper
2019-07-22 12:50         ` Jan Beulich
2019-07-19 18:24   ` Woods, Brian
2019-07-16 16:37 ` [Xen-devel] [PATCH v3 05/14] AMD/IOMMU: pass IOMMU to iterate_ivrs_entries() callback Jan Beulich
2019-07-19 16:32   ` Andrew Cooper
2019-07-19 18:26   ` Woods, Brian
2019-07-16 16:37 ` [Xen-devel] [PATCH v3 06/14] AMD/IOMMU: pass IOMMU to amd_iommu_alloc_intremap_table() Jan Beulich
2019-07-19 16:34   ` Andrew Cooper
2019-07-19 18:27   ` Woods, Brian
2019-07-16 16:37 ` [Xen-devel] [PATCH v3 07/14] AMD/IOMMU: pass IOMMU to {get, free, update}_intremap_entry() Jan Beulich
2019-07-19 16:47   ` Andrew Cooper
2019-07-19 18:32   ` Woods, Brian
2019-07-16 16:38 ` [Xen-devel] [PATCH v3 08/14] AMD/IOMMU: introduce 128-bit IRTE non-guest-APIC IRTE format Jan Beulich
2019-07-19 17:27   ` Andrew Cooper
2019-07-22  8:34     ` Jan Beulich
2019-07-22 13:36       ` Andrew Cooper
2019-07-22 15:01         ` Jan Beulich
2019-07-22 15:43           ` Andrew Cooper
2019-07-23  8:13             ` Jan Beulich [this message]
2019-07-23  8:19               ` Jan Beulich
2019-07-16 16:39 ` [Xen-devel] [PATCH v3 09/14] AMD/IOMMU: split amd_iommu_init_one() Jan Beulich
2019-07-19 18:36   ` Woods, Brian
2019-07-16 16:39 ` [Xen-devel] [PATCH v3 10/14] AMD/IOMMU: allow enabling with IRQ not yet set up Jan Beulich
2019-07-19 18:38   ` Woods, Brian
2019-07-16 16:39 ` [Xen-devel] [PATCH v3 11/14] AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode Jan Beulich
2019-07-19 17:31   ` Andrew Cooper
2019-07-22  8:43     ` Jan Beulich
2019-07-22 13:45       ` Andrew Cooper
2019-07-22 15:22         ` Jan Beulich
2019-07-19 18:39   ` Woods, Brian
2019-07-16 16:40 ` [Xen-devel] [PATCH v3 12/14] AMD/IOMMU: enable x2APIC mode when available Jan Beulich
2019-07-19 17:38   ` Andrew Cooper
2019-07-19 18:41   ` Woods, Brian
2019-07-16 16:40 ` [Xen-devel] [PATCH RFC v3 13/14] AMD/IOMMU: correct IRTE updating Jan Beulich
2019-07-19 17:44   ` Andrew Cooper
2019-07-16 16:41 ` [Xen-devel] [PATCH v3 14/14] AMD/IOMMU: process softirqs while dumping IRTs Jan Beulich
2019-07-19 17:55   ` Andrew Cooper
2019-07-22  8:49     ` Jan Beulich
2019-07-22 12:17       ` Andrew Cooper
2019-07-19 18:43   ` Woods, Brian

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=4266c118-7a89-ed64-6196-52a82ec6e42a@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=brian.woods@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.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.