From: Juergen Gross <jgross@suse.com> To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel <xen-devel@lists.xenproject.org>, Boris Ostrovsky <boris.ostrovsky@oracle.com> Subject: Question regarding swiotlb-xen in Linux kernel Date: Thu, 18 Apr 2019 09:36:25 +0200 [thread overview] Message-ID: <ba241f11-7681-77c9-3f9a-340d7f656d6b@suse.com> (raw) I'm currently investigating a problem related to swiotlb-xen. With a specific driver a customer is capable to trigger a situation where a MFN is mapped to multiple dom0 PFNs at the same time. There is no guest involved, so this is not related to grants. Wit a debug kernel I have managed to track the inconsistency to a call of xen_destroy_contiguous_region() from xen_swiotlb_free_coherent() where the region was obviously not contiguous. xen_swiotlb_free_coherent() contains: if (((dev_addr + size - 1 <= dma_mask)) || range_straddles_page_boundary(phys, size)) xen_destroy_contiguous_region(phys, order); Shouldn't it be either: if (((dev_addr + size - 1 <= dma_mask)) && !range_straddles_page_boundary(phys, size)) xen_destroy_contiguous_region(phys, order); or: if (dev_addr + size - 1 <= dma_mask) { BUG_ON(range_straddles_page_boundary(phys, size)); xen_destroy_contiguous_region(phys, order); } as calling xen_destroy_contiguous_region() with a non-contiguous memory region is a perfect receipt for a latent crash? The remaining question is why the driver is calling xen_swiotlb_free_coherent() for a non-contiguous region, of course. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Juergen Gross <jgross@suse.com> To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel <xen-devel@lists.xenproject.org>, Boris Ostrovsky <boris.ostrovsky@oracle.com> Subject: [Xen-devel] Question regarding swiotlb-xen in Linux kernel Date: Thu, 18 Apr 2019 09:36:25 +0200 [thread overview] Message-ID: <ba241f11-7681-77c9-3f9a-340d7f656d6b@suse.com> (raw) Message-ID: <20190418073625.KhB18rldYd_ACCzi4hGB89gWrKtmK2noMPdp_Iuf-IU@z> (raw) I'm currently investigating a problem related to swiotlb-xen. With a specific driver a customer is capable to trigger a situation where a MFN is mapped to multiple dom0 PFNs at the same time. There is no guest involved, so this is not related to grants. Wit a debug kernel I have managed to track the inconsistency to a call of xen_destroy_contiguous_region() from xen_swiotlb_free_coherent() where the region was obviously not contiguous. xen_swiotlb_free_coherent() contains: if (((dev_addr + size - 1 <= dma_mask)) || range_straddles_page_boundary(phys, size)) xen_destroy_contiguous_region(phys, order); Shouldn't it be either: if (((dev_addr + size - 1 <= dma_mask)) && !range_straddles_page_boundary(phys, size)) xen_destroy_contiguous_region(phys, order); or: if (dev_addr + size - 1 <= dma_mask) { BUG_ON(range_straddles_page_boundary(phys, size)); xen_destroy_contiguous_region(phys, order); } as calling xen_destroy_contiguous_region() with a non-contiguous memory region is a perfect receipt for a latent crash? The remaining question is why the driver is calling xen_swiotlb_free_coherent() for a non-contiguous region, of course. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2019-04-18 7:36 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-18 7:36 Juergen Gross [this message] 2019-04-18 7:36 ` [Xen-devel] Question regarding swiotlb-xen in Linux kernel Juergen Gross 2019-04-18 21:09 ` Boris Ostrovsky 2019-04-18 21:09 ` [Xen-devel] " Boris Ostrovsky 2019-04-18 22:31 ` Joe Jin 2019-04-18 22:31 ` [Xen-devel] " Joe Jin 2019-04-19 5:47 ` Juergen Gross 2019-04-19 5:47 ` [Xen-devel] " Juergen Gross 2019-04-19 14:40 ` Joe Jin 2019-04-19 14:40 ` [Xen-devel] " Joe Jin 2019-04-19 15:28 ` Dongli Zhang 2019-04-19 15:28 ` [Xen-devel] " Dongli Zhang
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=ba241f11-7681-77c9-3f9a-340d7f656d6b@suse.com \ --to=jgross@suse.com \ --cc=boris.ostrovsky@oracle.com \ --cc=konrad.wilk@oracle.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: linkBe 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.