All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: xen-devel@lists.xenproject.org
Cc: "Wei Liu" <wei.liu2@citrix.com>,
	"George Dunlap" <george.dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH V10 5/5] p2m: change_type_range: Only invalidate mapped gfns
Date: Thu, 29 Nov 2018 00:01:29 +0200	[thread overview]
Message-ID: <80d9c85f-286a-47db-a494-fe3eb9d3f73d@bitdefender.com> (raw)
In-Reply-To: <1543442182-3557-6-git-send-email-rcojocaru@bitdefender.com>

On 11/28/18 11:56 PM, Razvan Cojocaru wrote:
> change_range_type() invalidates gfn ranges to lazily change the type
> of a range of gfns, and also modifies the logdirty rangesets of that
> p2m. At the moment, it clips both down by the hostp2m.
> 
> While this will result in correct behavior, it's not entirely efficient,
> since invalidated entries outside that range will, on fault, simply be
> modified back to "empty" before faulting normally again.
> 
> Separate out the calculation of the two ranges.  Keep using the
> hostp2m's max_mapped_pfn to clip the logdirty ranges, but use the
> current p2m's max_mapped_pfn to further clip the invalidation range
> for alternate p2ms.
> 
> Signed-off-by: George Dunlap <george.dunlap@citrix.com>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> ---
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: "Roger Pau Monné" <roger.pau@citrix.com>
> 
> ---
> Changes since V9:
>  - Corrected function name in patch subject.
>  - Updated the patch to take into account the changes in the
>    previous two patches (no functional changes).
>  - Added Jan's Reviewed-by.
> ---
>  xen/arch/x86/mm/p2m.c | 55 ++++++++++++++++++++++++++++++++++++++-------------
>  1 file changed, 41 insertions(+), 14 deletions(-)
> 
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index fde2012..1907c29 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1007,8 +1007,10 @@ static void change_type_range(struct p2m_domain *p2m,
>                                unsigned long start, unsigned long end,
>                                p2m_type_t ot, p2m_type_t nt)
>  {
> +    unsigned long invalidate_start, invalidate_end;
>      struct domain *d = p2m->domain;
>      const unsigned long host_max_pfn = p2m_get_hostp2m(d)->max_mapped_pfn;
> +    const unsigned long max_pfn = p2m->max_mapped_pfn;
>      int rc = 0;
>  
>      --end;
> @@ -1017,9 +1019,18 @@ static void change_type_range(struct p2m_domain *p2m,
>          printk(XENLOG_G_WARNING "Dom%d logdirty rangeset clipped to max_mapped_pfn\n",
>                 d->domain_id);
>  
> -    /* Always clip the rangeset down to the host p2m */
> +    /*
> +     * If we have an altp2m, the logdirty rangeset range needs to
> +     * match that of the hostp2m, but for efficiency, we want to clip
> +     * down the the invalidation range according to the mapped values
> +     * in the altp2m.  Keep track of and clip the ranges separately.
> +     */
> +	invalidate_start = start;
> +	invalidate_end   = end;
> +
> +	/* Clip down to the host p2m */
>      if ( unlikely(end > host_max_pfn) )
> -        end = host_max_pfn;
> +        end = invalidate_end = host_max_pfn;

Sorry, there seem to be some indentation issues that my editor has
missed here. If the patch is otherwise acceptable and these can't be
fixed on commit I'll resend a corrected version.


Thanks,
Razvan

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

  reply	other threads:[~2018-11-28 22:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 21:56 [PATCH V10 0/5] Fix VGA logdirty related display freezes with altp2m Razvan Cojocaru
2018-11-28 21:56 ` [PATCH V10 1/5] x86/p2m: allocate logdirty_ranges for altp2ms Razvan Cojocaru
2018-11-28 21:56 ` [PATCH V10 2/5] x86/p2m: refactor p2m_reset_altp2m() Razvan Cojocaru
2018-11-28 21:56 ` [PATCH V10 3/5] x86/altp2m: fix display frozen when switching to a new view early Razvan Cojocaru
2018-11-28 21:56 ` [PATCH V10 4/5] p2m: Always use hostp2m when clipping rangesets Razvan Cojocaru
2018-11-29 10:04   ` Jan Beulich
2018-11-29 13:23     ` Razvan Cojocaru
2018-11-29 13:58       ` Jan Beulich
2018-11-30 21:59         ` Razvan Cojocaru
2018-12-03  8:49           ` Jan Beulich
2018-12-04 12:18             ` Razvan Cojocaru
2018-12-04 12:54               ` Jan Beulich
2018-12-04 14:05                 ` Razvan Cojocaru
2018-11-28 21:56 ` [PATCH V10 5/5] p2m: change_type_range: Only invalidate mapped gfns Razvan Cojocaru
2018-11-28 22:01   ` Razvan Cojocaru [this message]
2018-11-29 10:07   ` Jan Beulich
2018-11-29 11:47     ` Razvan Cojocaru
2018-12-04  3:27 ` [PATCH V10 0/5] Fix VGA logdirty related display freezes with altp2m Tamas K Lengyel

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=80d9c85f-286a-47db-a494-fe3eb9d3f73d@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --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.