Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965182AbeAJJLw (ORCPT + 1 other); Wed, 10 Jan 2018 04:11:52 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:55584 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965153AbeAJJLs (ORCPT ); Wed, 10 Jan 2018 04:11:48 -0500 X-IronPort-AV: E=Sophos;i="5.46,339,1511827200"; d="scan'208";a="465256683" Subject: Re: [PATCH 2/2] xen/gntdev: Fix partial gntdev_mmap() cleanup To: Boris Ostrovsky , CC: Juergen Gross , References: <20180109121022.11467-1-ross.lagerwall@citrix.com> <20180109121022.11467-2-ross.lagerwall@citrix.com> From: Ross Lagerwall Message-ID: <7b27b9ee-2c38-356c-14bd-b21db3a96960@citrix.com> Date: Wed, 10 Jan 2018 09:11:17 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 01/10/2018 01:22 AM, Boris Ostrovsky wrote: > > > On 01/09/2018 07:10 AM, Ross Lagerwall wrote: >> When cleaning up after a partially successful gntdev_mmap(), unmap the >> successfully mapped grant pages otherwise Xen will kill the domain if >> in debug mode (Attempt to implicitly unmap a granted PTE) or Linux will >> kill the process and emit "BUG: Bad page map in process" if Xen is in >> release mode. >> >> This is only needed when use_ptemod is true because gntdev_put_map() >> will unmap grant pages itself when use_ptemod is false. >> >> Signed-off-by: Ross Lagerwall > > Reviewed-by: Boris Ostrovsky > > although I wonder whether it may be possible to have gntdev_put_map() > figure whether to unmap the pages if use_ptemod is set. It was a while since I wrote this patch, but IIRC when use_ptemod is set, successfully mmapped pages are unmapped via the mmu_notifier release callback. So doing it in gntdev_put_map() isn't possible without further changes. -- Ross Lagerwall