[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v2 11/40] xen/mpu: build up start-of-day Xen MPU memory region map


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "ayan.kumar.halder@xxxxxxxxxx" <ayan.kumar.halder@xxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Thu, 2 Feb 2023 11:30:08 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=81oPDZqnenrFmE/c1UvH/EDyHHSndpEg2rKs9xVhYcs=; b=gar6Qx4aRkK2gFX+EzNcj0UPNIeGSwyNCL944dPk5vfo2ZuA2nJ8X+9KfmM7ESzkiIhfDgTeuOP6ko46zDowztn/tTRxcAUzCj8p57kWRSJurKLurMOusX0vjsC14DgHlM15DKu4Va8SmNCY+/u0AH8qi5fE8US/BHcSiUaZIO1nJdszqBIEPaTDypNLzHVstEUxfqn3xDOlNNfGR0Wb0kxmtrQfVyCxuf38pK+dDuoJ7FBnrICTYHP2KYSCCB2w9cq95rqtHUR8JiNEyrM2YtO4bGEnOg/1+ue+bUdzR+yFhDPZo7BuDalWwqO7jZE6zArEPgdBv66NE76H/bqyvQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MRdvzyHZU2uE6hDiLDbm2z4gfqHWB9zm3k5qS6oadCsK9dTGZvQXbGYvZ2RkeEkMCc0aBPNZ45TPZQaVvG7ZIbOvpDufb4AKKJntq4ZHGZ1rAn24ozvHcFsslMO8BOFq7CZmYnqD+WFzXnao64dqzS3pbq1pFjvw5wqn8SpncceyjhyVkSkCWkVFZnEAIN3XRIMoGS2fxkODf9YbwBRNPd+UnnN0Gk7Woy26/H79mtbYPkqZO3bpLMZrjIW3ULkLwXCdBTdBJJscwNoyrFfmKiz4tAItvyRNDFbFDJzygujyjk0+1Ys0XdpZ7w0Wif286aEvQa/PC7qYg00FW6ZyDQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 02 Feb 2023 11:30:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZJxAhTWb1zeTHm029bSgcZo/2Yq6l4H6AgA7nVJCAAFMfgIAAHOxggAGXmACAARsywIAAc7oAgAFRxNCAAN+ggIABBK2AgAAH44CAAAdVIA==
  • Thread-topic: [PATCH v2 11/40] xen/mpu: build up start-of-day Xen MPU memory region map

Hi, Julien

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Thursday, February 2, 2023 6:58 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx;
> Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> ayan.kumar.halder@xxxxxxxxxx
> Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: Re: [PATCH v2 11/40] xen/mpu: build up start-of-day Xen MPU
> memory region map
> 
> 
> 
> On 02/02/2023 10:53, Penny Zheng wrote:
> > Hi Julien,
> 
> Hi,
> 
> >> -----Original Message-----
> >> From: Julien Grall <julien@xxxxxxx>
> >> Sent: Thursday, February 2, 2023 2:57 AM
> >> To: Penny Zheng <Penny.Zheng@xxxxxxx>;
> >> xen-devel@xxxxxxxxxxxxxxxxxxxx; Wei Chen <Wei.Chen@xxxxxxx>;
> Stefano
> >> Stabellini <sstabellini@xxxxxxxxxx>; Bertrand Marquis
> >> <Bertrand.Marquis@xxxxxxx>; ayan.kumar.halder@xxxxxxxxxx
> >> Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> >> Subject: Re: [PATCH v2 11/40] xen/mpu: build up start-of-day Xen MPU
> >> memory region map
> >>
> >> Hi Penny,
> >>
> >> On 01/02/2023 05:39, Penny Zheng wrote:
> >>>>> If we are adding MPU regions in sequence as you suggested, while
> >>>>> using bitmap at the same time to record used entry.
> >>>>> TBH, this is how I designed at the very beginning internally. We
> >>>>> found that if we don't do reorg late-boot to keep fixed in front
> >>>>> and switching ones after, each time when we do vcpu context
> >>>>> switch, not only we need to hunt down switching ones to disable,
> >>>>> while we add new switch-in regions, using bitmap to find free
> >>>>> entry is saying that the
> >>>> process is unpredictable. Uncertainty is what we want to avoid in
> >>>> Armv8-R architecture.
> >>>>
> >>>> I don't understand why it would be unpredictable. For a given
> >>>> combination of platform/device-tree, the bitmap will always look
> >>>> the same. So the number of cycles/instructions will always be the
> same.
> >>>>
> >>>
> >>> In boot-time, it will be always the same. But if we still use bitmap
> >>> to find free entry(for switching MPU regions) on runtime, hmmm, I
> >>> thought this part will be unpredictable.
> >>
> >> I know this point is now moot as we agreed on not using a bitmap but
> >> I wanted to answer on the unpredictability part.
> >>
> >> It depends on whether you decide to allocate more entry at runtime.
> >> My assumption is you won't and therefore the the time to walk the
> >> bitmap will always be consistent.
> >>
> >
> > In MPU, we don't have something like vttbr_el2 in MMU, to store stage
> > 2
> > EL1/EL0 translation table. Xen stage 1 EL2 mapping and stage 2 EL1/EL0
> > mapping are both sharing one table.
> > So when context switching into different guest, the current design is
> > to disable DOM1's guest RAM mapping firstly, then enable DOM2's guest
> > RAM mapping, to ensure isolation and safety.
> 
> I understood that but I don't understand how this is related to my point
> here. The entries you are replacing are always going to be the same after
> boot.
> 
> So if you have a bitmap indicate the fixed entries and you don't add more
> fixed one at runtime, then it will always take the same time to walk it.
> 

Ah, sorry for taking so long to understand ;/. True, the fixed entries will 
never
change after boot-time, each time when switching to guest vcpu, we always choose
the same entry.

> Cheers,
> 
> --
> Julien Grall

Cheers,

--
Penny Zheng

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.