From: Daniel Kiper Subject: An issue in xen_limit_pages_to_max_mfn() in Xenlinux Ver. 2.6.18 Date: Thu, 10 Nov 2011 09:58:21 +0100 Message-ID: <20111110085821.GA15751@router-fw-old.local.net-space.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: jbeulich@suse.com Cc: xen-devel@lists.xensource.com, konrad.wilk@oracle.com List-Id: xen-devel@lists.xenproject.org Hi Jan, During work on kexec/kdump for Xen domU I found that xen_limit_pages_to_max_mfn() registers undo_limit_pages() destructor which breaks __free_pages(). When __free_pages() is called then at beginning of this function put_page_testzero() is called which decrements page count for given page. Later undo_limit_pages() destructor is called which once again calls __free_pages() and in consequence put_page_testzero() fails (BUG_ON() is called) because page count is 0. It could be easily fixed, however, after reviewing xen_limit_pages_to_max_mfn() I could not find any good reason for which undo_limit_pages() destructor is registered. Maybe it could be removed at all because all pages are freed when __free_pages() is called and in this case we do not care where they live. However, maybe I missed something important. Could you explain for which cases undo_limit_pages() destructor was prepared ??? Daniel