From: "Jan Beulich" Subject: Re: [PATCH RFC v2 2/4] x86/mem_access: mem_access and mem_event changes to support PV domains Date: Thu, 24 Jul 2014 15:38:08 +0100 Message-ID: <53D1367002000078000259C8@mail.emea.novell.com> References: <1404787805-4540-1-git-send-email-aravindp@cisco.com> <1404787805-4540-3-git-send-email-aravindp@cisco.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XAK9s-0006t0-DF for xen-devel@lists.xenproject.org; Thu, 24 Jul 2014 14:38:12 +0000 In-Reply-To: <1404787805-4540-3-git-send-email-aravindp@cisco.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Aravindh Puthiyaparambil Cc: xen-devel@lists.xenproject.org, Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 08.07.14 at 04:50, wrote: > +static int mem_access_set_default(struct domain *d, uint64_t *start_page, > + xenmem_access_t access) > +{ > + struct p2m_domain *p2m = p2m_get_hostp2m(d); > + struct page_info *page; > + struct page_list_head head; > + p2m_access_t a; > + int rc = 0, ctr = 0; > + > + if ( !is_pv_domain(d) ) > + return -ENOSYS; > + > + ASSERT(shadow_mode_enabled(d)); > + > + rc = p2m_convert_xenmem_access(p2m, access, &a); > + if ( rc != 0 ) > + return rc; > + > + /* > + * For PV domains we only support r, rw, rx, rx2rw and rwx access > + * permissions > + */ > + switch ( a ) > + { > + case p2m_access_n: > + case p2m_access_w: > + case p2m_access_x: > + case p2m_access_wx: > + case p2m_access_n2rwx: > + return -EINVAL; > + default: > + break; > + } > + > + paging_lock_recursive(d); > + > + if ( *start_page ) > + { > + head.next = (struct page_info *)*start_page; What guarantees that the continuation page is still on d->page_list, or that now other page got inserted ahead of it? And anyway you're iterating the list without holding d->page_alloc_lock. Jan