All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Julien Grall <julien.grall@arm.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	oleksandr_tyshchenko@epam.com,
	xen-devel <xen-devel@lists.xenproject.org>,
	"andrii_anisov@epam.com" <andrii_anisov@epam.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH 09/14] xen: Introduce HAS_M2P config and use to protect mfn_to_gmfn call
Date: Fri, 10 May 2019 07:45:03 -0600	[thread overview]
Message-ID: <5CD5805F020000780022D939@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <3a359c40-ec6e-db96-b86e-17829c8ccf88@arm.com>

>>> On 10.05.19 at 15:41, <julien.grall@arm.com> wrote:
> On 10/05/2019 14:32, Jan Beulich wrote:
>>>>> On 10.05.19 at 15:22, <julien.grall@arm.com> wrote:
>>> On 10/05/2019 13:31, Jan Beulich wrote:
>>>>>>> On 07.05.19 at 17:14, <julien.grall@arm.com> wrote:
>>>>> --- a/xen/common/domctl.c
>>>>> +++ b/xen/common/domctl.c
>>>>> @@ -205,7 +205,7 @@ void getdomaininfo(struct domain *d, struct
>>>>> xen_domctl_getdomaininfo *info)
>>>>>        info->outstanding_pages = d->outstanding_pages;
>>>>>        info->shr_pages         = atomic_read(&d->shr_pages);
>>>>>        info->paged_pages       = atomic_read(&d->paged_pages);
>>>>> -    info->shared_info_frame = mfn_to_gmfn(d, virt_to_mfn(d->shared_info));
>>>>> +    info->shared_info_frame = gfn_x(domain_shared_info_gfn(d));
>>>>
>>>> What is the intended behavior on 32-bit Arm here? Do you really
>>>> mean to return a value with 32 bits of ones (instead of 64 bits of
>>>> them) in this 64-bit field?
>>> It does not matter as long as the GFN is invalid so it can't be mapped
>>> afterwards. The exact value is not documented in the header to avoid any
>>> assumption.
>> 
>> That's not helpful - how would a consumer know to avoid the mapping
>> attempt in the first place?
> 
> I can't see any issue with the consumer to try to map it. Ok, you will waste a 
> couple of cycles, but that should be pretty rare.

The attempt may result in a log message spit out.

> The point here, we keep within the hypervisor the idea of what's valid or 
> invalid. This allows us more flexibility on the value here (imagine we decide to 
> change the value of GFN_INVALID in the future...).

Exactly, and hence INVALID_GFN should not become visible to the
outside. Hence my request to use an all-ones value here.

>>>>> --- a/xen/drivers/passthrough/iommu.c
>>>>> +++ b/xen/drivers/passthrough/iommu.c
>>>>> @@ -188,9 +188,10 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
>>>>>        hd->need_sync = iommu_hwdom_strict && !iommu_use_hap_pt(d);
>>>>>        if ( need_iommu_pt_sync(d) )
>>>>>        {
>>>>> +        int rc = 0;
>>>>> +#ifdef CONFIG_HAS_M2P
>>>>>            struct page_info *page;
>>>>>            unsigned int i = 0, flush_flags = 0;
>>>>> -        int rc = 0;
>>>>>    
>>>>>            page_list_for_each ( page, &d->page_list )
>>>>>            {
>>>>> @@ -217,6 +218,9 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
>>>>>            /* Use while-break to avoid compiler warning */
>>>>>            while ( iommu_iotlb_flush_all(d, flush_flags) )
>>>>>                break;
>>>>> +#else
>>>>> +        rc = -EOPNOTSUPP;
>>>>> +#endif
>>>>>    
>>>>>            if ( rc )
>>>>>                printk(XENLOG_WARNING "d%d: IOMMU mapping failed: %d\n",
>>>>
>>>> Would you mind extending the scope of the #ifdef beyond this printk()?
>>>> It seems pretty pointless to me to unconditionally emit a log message
>>>> here.
>>>
>>> Well, it at least tell you the function can't work. So I think it is still makes
>>> sense to have it.
>> 
>> I disagree.
> You disagree because...?

Because of what I've said in my initial reply (still quoted above).

> I hope you are aware, this is unlikely going to be printed as the code should 
> not be called.

ASSERT_UNREACHABLE() then?

Jan



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

WARNING: multiple messages have this Message-ID (diff)
From: "Jan Beulich" <JBeulich@suse.com>
To: "Julien Grall" <julien.grall@arm.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	oleksandr_tyshchenko@epam.com,
	xen-devel <xen-devel@lists.xenproject.org>,
	"andrii_anisov@epam.com" <andrii_anisov@epam.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 09/14] xen: Introduce HAS_M2P config and use to protect mfn_to_gmfn call
Date: Fri, 10 May 2019 07:45:03 -0600	[thread overview]
Message-ID: <5CD5805F020000780022D939@prv1-mh.provo.novell.com> (raw)
Message-ID: <20190510134503.cvnYRABc_NGOunHf9agNCmLB3Mb-NC3kKB84LXYFMXw@z> (raw)
In-Reply-To: <3a359c40-ec6e-db96-b86e-17829c8ccf88@arm.com>

>>> On 10.05.19 at 15:41, <julien.grall@arm.com> wrote:
> On 10/05/2019 14:32, Jan Beulich wrote:
>>>>> On 10.05.19 at 15:22, <julien.grall@arm.com> wrote:
>>> On 10/05/2019 13:31, Jan Beulich wrote:
>>>>>>> On 07.05.19 at 17:14, <julien.grall@arm.com> wrote:
>>>>> --- a/xen/common/domctl.c
>>>>> +++ b/xen/common/domctl.c
>>>>> @@ -205,7 +205,7 @@ void getdomaininfo(struct domain *d, struct
>>>>> xen_domctl_getdomaininfo *info)
>>>>>        info->outstanding_pages = d->outstanding_pages;
>>>>>        info->shr_pages         = atomic_read(&d->shr_pages);
>>>>>        info->paged_pages       = atomic_read(&d->paged_pages);
>>>>> -    info->shared_info_frame = mfn_to_gmfn(d, virt_to_mfn(d->shared_info));
>>>>> +    info->shared_info_frame = gfn_x(domain_shared_info_gfn(d));
>>>>
>>>> What is the intended behavior on 32-bit Arm here? Do you really
>>>> mean to return a value with 32 bits of ones (instead of 64 bits of
>>>> them) in this 64-bit field?
>>> It does not matter as long as the GFN is invalid so it can't be mapped
>>> afterwards. The exact value is not documented in the header to avoid any
>>> assumption.
>> 
>> That's not helpful - how would a consumer know to avoid the mapping
>> attempt in the first place?
> 
> I can't see any issue with the consumer to try to map it. Ok, you will waste a 
> couple of cycles, but that should be pretty rare.

The attempt may result in a log message spit out.

> The point here, we keep within the hypervisor the idea of what's valid or 
> invalid. This allows us more flexibility on the value here (imagine we decide to 
> change the value of GFN_INVALID in the future...).

Exactly, and hence INVALID_GFN should not become visible to the
outside. Hence my request to use an all-ones value here.

>>>>> --- a/xen/drivers/passthrough/iommu.c
>>>>> +++ b/xen/drivers/passthrough/iommu.c
>>>>> @@ -188,9 +188,10 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
>>>>>        hd->need_sync = iommu_hwdom_strict && !iommu_use_hap_pt(d);
>>>>>        if ( need_iommu_pt_sync(d) )
>>>>>        {
>>>>> +        int rc = 0;
>>>>> +#ifdef CONFIG_HAS_M2P
>>>>>            struct page_info *page;
>>>>>            unsigned int i = 0, flush_flags = 0;
>>>>> -        int rc = 0;
>>>>>    
>>>>>            page_list_for_each ( page, &d->page_list )
>>>>>            {
>>>>> @@ -217,6 +218,9 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
>>>>>            /* Use while-break to avoid compiler warning */
>>>>>            while ( iommu_iotlb_flush_all(d, flush_flags) )
>>>>>                break;
>>>>> +#else
>>>>> +        rc = -EOPNOTSUPP;
>>>>> +#endif
>>>>>    
>>>>>            if ( rc )
>>>>>                printk(XENLOG_WARNING "d%d: IOMMU mapping failed: %d\n",
>>>>
>>>> Would you mind extending the scope of the #ifdef beyond this printk()?
>>>> It seems pretty pointless to me to unconditionally emit a log message
>>>> here.
>>>
>>> Well, it at least tell you the function can't work. So I think it is still makes
>>> sense to have it.
>> 
>> I disagree.
> You disagree because...?

Because of what I've said in my initial reply (still quoted above).

> I hope you are aware, this is unlikely going to be printed as the code should 
> not be called.

ASSERT_UNREACHABLE() then?

Jan



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

  reply	other threads:[~2019-05-10 13:45 UTC|newest]

Thread overview: 154+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 15:14 [PATCH 00/14] xen/arm: Properly disable M2P on Arm Julien Grall
2019-05-07 15:14 ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 01/14] xen/arm: Use mfn_to_pdx instead of pfn_to_pdx when possible Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-09 17:50   ` Stefano Stabellini
2019-05-09 17:50     ` [Xen-devel] " Stefano Stabellini
2019-05-07 15:14 ` [PATCH 02/14] xen/x86: Constify the parameter "d" in mfn_to_gfn Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 03/14] xen/x86: Make mfn_to_gfn typesafe Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-10 11:35   ` Jan Beulich
2019-05-10 11:35     ` [Xen-devel] " Jan Beulich
2019-05-10 13:02     ` Julien Grall
2019-05-10 13:02       ` [Xen-devel] " Julien Grall
2019-05-10 13:24       ` Jan Beulich
2019-05-10 13:24         ` [Xen-devel] " Jan Beulich
2019-05-10 13:25         ` Julien Grall
2019-05-10 13:25           ` [Xen-devel] " Julien Grall
2019-05-20 15:13           ` Julien Grall
2019-05-20 15:13             ` [Xen-devel] " Julien Grall
2019-05-28 17:29             ` George Dunlap
2019-05-28 17:29               ` [Xen-devel] " George Dunlap
2019-05-29 11:39               ` Julien Grall
2019-05-29 11:39                 ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 04/14] xen/x86: Use mfn_to_gfn rather than mfn_to_gmfn Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-10 12:15   ` Jan Beulich
2019-05-10 12:15     ` [Xen-devel] " Jan Beulich
2019-05-10 13:07     ` Julien Grall
2019-05-10 13:07       ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 05/14] xen/grant-table: Make arch specific macros typesafe Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-09 17:54   ` Stefano Stabellini
2019-05-09 17:54     ` [Xen-devel] " Stefano Stabellini
2019-05-07 15:14 ` [PATCH 06/14] xen: Convert hotplug page function to use typesafe MFN Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-09 18:01   ` Stefano Stabellini
2019-05-09 18:01     ` [Xen-devel] " Stefano Stabellini
2019-05-09 18:10     ` Julien Grall
2019-05-09 18:10       ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 07/14] xen: Convert is_xen_fixed_mfn " Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-24 15:16   ` George Dunlap
2019-05-24 15:16     ` [Xen-devel] " George Dunlap
2019-05-07 15:14 ` [PATCH 08/14] xen: Convert is_xen_heap_mfn " Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-24 15:15   ` George Dunlap
2019-05-24 15:15     ` [Xen-devel] " George Dunlap
2019-05-07 15:14 ` [PATCH 09/14] xen: Introduce HAS_M2P config and use to protect mfn_to_gmfn call Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-09 18:06   ` Stefano Stabellini
2019-05-09 18:06     ` [Xen-devel] " Stefano Stabellini
2019-05-09 18:12     ` Julien Grall
2019-05-09 18:12       ` [Xen-devel] " Julien Grall
2019-05-09 18:16       ` Stefano Stabellini
2019-05-09 18:16         ` [Xen-devel] " Stefano Stabellini
2019-05-09 18:29         ` Julien Grall
2019-05-09 18:29           ` [Xen-devel] " Julien Grall
2019-05-09 19:49           ` Stefano Stabellini
2019-05-09 19:49             ` [Xen-devel] " Stefano Stabellini
2019-05-10 12:31   ` Jan Beulich
2019-05-10 12:31     ` [Xen-devel] " Jan Beulich
2019-05-10 13:22     ` Julien Grall
2019-05-10 13:22       ` [Xen-devel] " Julien Grall
2019-05-10 13:32       ` Jan Beulich
2019-05-10 13:32         ` [Xen-devel] " Jan Beulich
2019-05-10 13:41         ` Julien Grall
2019-05-10 13:41           ` [Xen-devel] " Julien Grall
2019-05-10 13:45           ` Jan Beulich [this message]
2019-05-10 13:45             ` Jan Beulich
2019-05-10 14:04             ` Julien Grall
2019-05-10 14:04               ` [Xen-devel] " Julien Grall
2019-05-10 14:19               ` Jan Beulich
2019-05-10 14:19                 ` [Xen-devel] " Jan Beulich
2019-05-10 14:34                 ` Julien Grall
2019-05-10 14:34                   ` [Xen-devel] " Julien Grall
2019-05-22 16:03                   ` Julien Grall
2019-05-22 16:03                     ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 10/14] xen: Remove mfn_to_gmfn macro Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 11/14] xen/x86: mm: Re-implement set_gpfn_from_mfn() as a static inline function Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-10 12:43   ` Jan Beulich
2019-05-10 12:43     ` [Xen-devel] " Jan Beulich
2019-05-10 13:27     ` Julien Grall
2019-05-10 13:27       ` [Xen-devel] " Julien Grall
2019-05-10 13:35       ` Jan Beulich
2019-05-10 13:35         ` [Xen-devel] " Jan Beulich
2019-05-10 13:41         ` Julien Grall
2019-05-10 13:41           ` [Xen-devel] " Julien Grall
2019-05-10 13:48           ` Jan Beulich
2019-05-10 13:48             ` [Xen-devel] " Jan Beulich
2019-05-10 14:05             ` Julien Grall
2019-05-10 14:05               ` [Xen-devel] " Julien Grall
2019-05-10 14:21               ` Jan Beulich
2019-05-10 14:21                 ` [Xen-devel] " Jan Beulich
2019-05-10 14:48                 ` Julien Grall
2019-05-10 14:48                   ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 12/14] xen/x86: pv: Convert update_intpte() to use typesafe MFN Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-10 12:54   ` Jan Beulich
2019-05-10 12:54     ` [Xen-devel] " Jan Beulich
2019-05-10 13:28     ` Julien Grall
2019-05-10 13:28       ` [Xen-devel] " Julien Grall
2019-05-07 15:14 ` [PATCH 13/14] xen/mm: Convert {s, g}et_gpfn_from_mfn() " Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-07 20:27   ` Tamas K Lengyel
2019-05-07 20:27     ` [Xen-devel] " Tamas K Lengyel
2019-05-09 18:19   ` Stefano Stabellini
2019-05-09 18:19     ` [Xen-devel] " Stefano Stabellini
2019-05-10 13:21   ` Jan Beulich
2019-05-10 13:21     ` [Xen-devel] " Jan Beulich
2019-05-10 13:27     ` Andrew Cooper
2019-05-10 13:27       ` [Xen-devel] " Andrew Cooper
2019-05-10 13:34     ` Julien Grall
2019-05-10 13:34       ` [Xen-devel] " Julien Grall
2019-05-10 13:41       ` Jan Beulich
2019-05-10 13:41         ` [Xen-devel] " Jan Beulich
2019-05-10 13:46         ` Julien Grall
2019-05-10 13:46           ` [Xen-devel] " Julien Grall
2019-05-10 14:02           ` Jan Beulich
2019-05-10 14:02             ` [Xen-devel] " Jan Beulich
2019-05-10 14:05             ` Andrew Cooper
2019-05-10 14:05               ` [Xen-devel] " Andrew Cooper
2019-05-10 14:08               ` Julien Grall
2019-05-10 14:08                 ` [Xen-devel] " Julien Grall
2019-05-10 14:09                 ` Andrew Cooper
2019-05-10 14:09                   ` [Xen-devel] " Andrew Cooper
2019-05-10 14:14               ` Jan Beulich
2019-05-10 14:14                 ` [Xen-devel] " Jan Beulich
2019-05-10 14:27                 ` Andrew Cooper
2019-05-10 14:27                   ` [Xen-devel] " Andrew Cooper
2019-05-24 16:24     ` George Dunlap
2019-05-24 16:24       ` [Xen-devel] " George Dunlap
2019-05-29 16:27       ` Julien Grall
2019-05-29 16:27         ` [Xen-devel] " Julien Grall
2019-05-29 16:29         ` George Dunlap
2019-05-29 16:29           ` [Xen-devel] " George Dunlap
2019-05-24 16:35   ` George Dunlap
2019-05-24 16:35     ` [Xen-devel] " George Dunlap
2019-05-07 15:14 ` [PATCH 14/14] xen/mm: Provide dummy M2P-related helpers when !CONFIG_HAVE_M2P Julien Grall
2019-05-07 15:14   ` [Xen-devel] " Julien Grall
2019-05-09 18:20   ` Stefano Stabellini
2019-05-09 18:20     ` [Xen-devel] " Stefano Stabellini
2019-05-10 13:28   ` Jan Beulich
2019-05-10 13:28     ` [Xen-devel] " Jan Beulich
2019-05-10 13:29     ` Julien Grall
2019-05-10 13:29       ` [Xen-devel] " Julien Grall
2019-05-10 13:37       ` Jan Beulich
2019-05-10 13:37         ` [Xen-devel] " Jan Beulich
2019-05-10 13:38         ` Julien Grall
2019-05-10 13:38           ` [Xen-devel] " Julien Grall
2019-05-24 16:51   ` George Dunlap
2019-05-24 16:51     ` [Xen-devel] " George Dunlap

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=5CD5805F020000780022D939@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=andrii_anisov@epam.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.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.