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

Re: Linux pin_user_pages_fast fails on Xen


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Fri, 9 Sep 2022 13:25:35 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=mroN2LYISOz1p+YklRyyQtahsx+nKrF2HvLfBkIooS0=; b=LtZMlBA9FI3MmfJG6Oet78npGnhjYX5sV7M2FqAwVdRnYyEW2vpqM01NTaR8VAlut1BDao96bgbvrOMT4cvqww3xcv6HrEak66mb9lXTW/aHZlNl0+PHk0bnPUpN9w8qsrT9uqaMfJVQ1W7KPR9AqDtgr2l94tSOSKBZITD8HkTDUcmbMDELQ1dAkFLJP2iQhUMwyIwpO6f2SldgmdK2RU+YkJsXJR3Ap3DnAc1YdBaKmnAY5RLf1BMg+oQLVW2BiCdLpHktC0mG5poGp7a+dirgqqH2NsCl7n/HIKYthRHtdd5TFLI6ZiTFfv1yvcrbA46AIcxjY82pGouqSg2Plg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z0Wqqmo/JP5u1RHPk8GU+0kL140C0xicjygWj8LsQ2lhZcwWpAsP30lz385au+nbhkgWpVmu6x7SjhGrDUMIYgB5KEixN+2dRfkqJUgQjYIbJyOnfDSHPXBOIulJtalFFKZg2VLn2vcZJfHJQpHR0nqsIzJEHVN1vIQAR9jfS+thCvCTzpz+yvvSL9clsweZ/F75J/pwV6a/L7oFkCVGPkG5zp+dIoSJLSZnp9seIKw1q8JaqagijVSlSnoHAmJsOFPR8R0Y8FSTgTZm8BfAh7KVuU96OQh32C6nGi5Z7ieh+DLrYnytNni5CKt2cHG4XDAloxfgnANfdpMUXhmXCQ==
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <boris.ostrovsky@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <JESHWANTHKUMAR.NK@xxxxxxx>, <Devaraj.Rangasamy@xxxxxxx>, <Mythri.Pandeshwarakrishna@xxxxxxx>, <SivaSangeetha.SK@xxxxxxx>, <Rijo-john.Thomas@xxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 20:26:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, 9 Sep 2022, Juergen Gross wrote:
> On 09.09.22 04:11, Stefano Stabellini wrote:
> > Adding more people in CC
> > 
> > On Thu, 8 Sep 2022, Stefano Stabellini wrote:
> > > Hi Juergen,
> > > 
> > > A colleague is seeing a failure on x86 in Linux Dom0. The failure is
> > > pin_user_pages_fast with addresses that correspond to foreign memory
> > > pages:
> > > 
> > > - QEMU maps a domU address using dma_memory_map (xen_map_cache)
> > > - QEMU calls an IOCTL to the TEE subsystem with the Virtual Address
> > >    returned by dma_memory_map
> > > - Linux tee_shm_register->pin_user_pages_fast Returns -14 -
> > > drivers/tee/tee_shm.c
> > > 
> > > Once upon a time it used to be the case that get_user_pages_fast would
> > > fail on Xen because we didn't have a struct page corresponding to
> > > foreign memory mappings. But that hasn't been the case for years now.
> > > 
> > > Any other ideas why it would fail?
> 
> I think we can expect that access_ok() isn't failing.
> 
> I assume the mapping was done allowing writes (sorry for paranoia mode)?
 
I was told it was verified: QEMU could read and write to the VA returned
by dma_memory_map. From /proc/<qemu-pid>/maps, the VA assigned after the
mapping is pointing to /dev/xen/privcmd.


> Other than that I'm not having enough memory management skills. It might be
> related to mmap()-ed foreign pages having _PAGE_SPECIAL set, though.

Do we still set PAGE_SPECIAL for foreign mapped pages? It looks like it
is not there anymore? If PAGE_SPECIAL is not there, then they really
should look like regular pages?



 


Rackspace

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