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

Re: [RFC PATCH] x86/p2m-pt: do type recalculations with p2m read lock


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 3 Apr 2023 14:39:08 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=kkNr5iDw5JV3J8qNnpUmRp1zna4a5Qb3MIEAArRhfSo=; b=cth6HxMJ4PI/GbDW7F48qzEVzyzVTE7tT9b4HASmsQyiX33kb0Hj1vQEUD5b7tYGOTz52BW6J1KKBPkANUKMfdxVu022QQ0Pma0QpqUfFZHxmtwAZFrEK9Zvja80Uwla/2Gh1E8YFpbPhdetVYnqRelrz+x2YCWgTdD+3I7yNsyiVZW0jeYn64px1N5y+yW9Y5LzpGihVLpX0l0StoiJ9U1wp06HCphwzvxvw/3Teirc5kUZcf675RRkmQXgHRkZk7dpflvIoHf+NBfaRqUC4LqLMgnkXIkaDmlpn1jQgX6stzwEW416CZbjfWLg6HlJIDoKxxejsR4usdr1dDPUiQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XWlLfxr7YGHGmlmKrz95obtczKkY1oeQ5/h0vLS+ODpFmYmzMlIAnadBrCtRoVmcKvChwGngargD02uF7H7234r7fh4D7xa4JZFWB/YWVpXEI/neAADufIsDcCFCLi402NFl/D5S9uAbJmgluSBKnPMcACkhcxkL+0fD5wu2Vo5yRkIMWy0r2pIwYDxukZBEwnF54iPAl8lpgG+hbXZ7LlG6tuqOeypuTPP3WhqR2kpdeM+G/DBgCVY/8jLNlCiVZI74MISO3pTyDJoTDswZqJxh55ioQxZjhKgqwbf/inCYjmGGe569+MU4hyohqenhhDZb1F+70rx+16DuDNNQ9g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 03 Apr 2023 12:39:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.04.2023 12:14, Roger Pau Monne wrote:
> --- a/xen/arch/x86/mm/p2m-pt.c
> +++ b/xen/arch/x86/mm/p2m-pt.c
> @@ -486,9 +486,6 @@ static int cf_check do_recalc(struct p2m_domain *p2m, 
> unsigned long gfn)
>          p2m_type_t ot, nt;
>          unsigned long mask = ~0UL << (level * PAGETABLE_ORDER);
>  
> -        if ( !valid_recalc(l1, e) )
> -            P2M_DEBUG("bogus recalc leaf at d%d:%lx:%u\n",
> -                      p2m->domain->domain_id, gfn, level);
>          ot = p2m_flags_to_type(l1e_get_flags(e));
>          nt = p2m_recalc_type_range(true, ot, p2m, gfn & mask, gfn | ~mask);
>          if ( nt != ot )

I'm afraid I neither understand why you make this change, nor why you
then leave the other use of valid_recalc() in place.

> @@ -538,9 +535,9 @@ int p2m_pt_handle_deferred_changes(uint64_t gpa)
>       */
>      ASSERT(!altp2m_active(current->domain));
>  
> -    p2m_lock(p2m);
> +    p2m_read_lock(p2m);
>      rc = do_recalc(p2m, PFN_DOWN(gpa));
> -    p2m_unlock(p2m);
> +    p2m_read_unlock(p2m);
>  
>      return rc;
>  }

How can this be safe, when do_recalc() involves p2m_next_level(), which
may install new (intermediate) page tables?

Jan



 


Rackspace

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