xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Julien Grall <jgrall@amazon.com>,
	Oleksandr Tyshchenko <olekstysh@gmail.com>
Subject: Re: [PATCH V7 1/2] xen/arm: Harden the P2M code in p2m_remove_mapping()
Date: Wed, 20 Jul 2022 19:20:00 +0100	[thread overview]
Message-ID: <43793378-6539-1795-8262-189f7ff61d66@xen.org> (raw)
In-Reply-To: <7960855a-5135-00d9-fff8-b571d7be03d1@epam.com>

Hi Oleksandr,

On 16/07/2022 16:29, Oleksandr Tyshchenko wrote:
>> On 16/07/2022 15:56, Oleksandr Tyshchenko wrote:
>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>
>>> Borrow the x86's check from p2m_remove_page() which was added
>>> by the following commit: c65ea16dbcafbe4fe21693b18f8c2a3c5d14600e
>>> "x86/p2m: don't assert that the passed in MFN matches for a remove"
>>> and adjust it to the Arm code base.
>>>
>>> Basically, this check will be strictly needed for the xenheap pages
>>> after applying a subsequent commit which will introduce xenheap based
>>> M2P approach on Arm. But, it will be a good opportunity to harden
>>> the P2M code for *every* RAM pages since it is possible to remove
>>> any GFN - MFN mapping currently on Arm (even with the wrong helpers).
>>>
>>> Suggested-by: Julien Grall <jgrall@amazon.com>
>>> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>> ---
>>> You can find the corresponding discussion at:
>>> https://urldefense.com/v3/__https://lore.kernel.org/xen-devel/82d8bfe0-cb46-d303-6a60-2324dd76a1f7@xen.org/__;!!GF_29dbcQIUBPA!3a2u-XL4NvAzSMfz72LARrdWVFvq2In5ZpUdxP2cSt7bM8PgV7P_ZclZG2R-rE9PcosUHyqsKRNfVG2TiM9Tlg$
>>> [lore[.]kernel[.]org]
>>> https://urldefense.com/v3/__https://lore.kernel.org/xen-devel/1652294845-13980-2-git-send-email-olekstysh@gmail.com/__;!!GF_29dbcQIUBPA!3a2u-XL4NvAzSMfz72LARrdWVFvq2In5ZpUdxP2cSt7bM8PgV7P_ZclZG2R-rE9PcosUHyqsKRNfVG0kg7IZSA$
>>> [lore[.]kernel[.]org]
>>>
>>> Changes V6 -> V7:
>>>      - make this commit to be the first
>>>      - update commit description and add a comment in code
>>> ---
>>>    xen/arch/arm/p2m.c | 28 ++++++++++++++++++++++++++++
>>>    1 file changed, 28 insertions(+)
>>>
>>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
>>> index d00c2e462a..2a0d383df4 100644
>>> --- a/xen/arch/arm/p2m.c
>>> +++ b/xen/arch/arm/p2m.c
>>> @@ -1308,11 +1308,39 @@ static inline int p2m_remove_mapping(struct
>>> domain *d,
>>>                                         mfn_t mfn)
>>>    {
>>>        struct p2m_domain *p2m = p2m_get_hostp2m(d);
>>> +    unsigned long i;
>>>        int rc;
>>>          p2m_write_lock(p2m);
>>> +    /*
>>> +     * Before removing the GFN - MFN mapping for any RAM pages make
>>> sure
>>> +     * that there is no difference between what is already mapped
>>> and what
>>> +     * is requested to be unmapped.
>>> +     * If they don't match bail out early. For instance, this could
>>> happen
>>> +     * if two CPUs are requesting to unmap the same P2M concurrently.
>>
>> Missing word: P2M *entry*
> 
> Yes. May I please ask, could this be done on the commit if this appears
> to be the last version?

I have committed the series with the same typo.

Cheers,

-- 
Julien Grall


      reply	other threads:[~2022-07-20 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16 14:56 [PATCH V7 1/2] xen/arm: Harden the P2M code in p2m_remove_mapping() Oleksandr Tyshchenko
2022-07-16 14:56 ` [PATCH V7 2/2] xen/gnttab: Store frame GFN in struct page_info on Arm Oleksandr Tyshchenko
2022-07-16 15:08   ` Julien Grall
2022-07-16 15:20     ` Oleksandr Tyshchenko
2022-07-18  8:53   ` Jan Beulich
2022-10-11 11:59   ` Jan Beulich
2022-10-11 13:01     ` Julien Grall
2022-10-11 13:28       ` Jan Beulich
2022-10-11 13:33         ` Julien Grall
2022-10-11 13:38           ` Jan Beulich
2022-10-17 13:46           ` Jan Beulich
2022-10-17 14:37             ` Julien Grall
2022-07-16 15:06 ` [PATCH V7 1/2] xen/arm: Harden the P2M code in p2m_remove_mapping() Julien Grall
2022-07-16 15:29   ` Oleksandr Tyshchenko
2022-07-20 18:20     ` Julien Grall [this message]

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=43793378-6539-1795-8262-189f7ff61d66@xen.org \
    --to=julien@xen.org \
    --cc=Oleksandr_Tyshchenko@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jgrall@amazon.com \
    --cc=olekstysh@gmail.com \
    --cc=sstabellini@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).