Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5280644ybc; Wed, 27 Nov 2019 01:24:38 -0800 (PST) X-Google-Smtp-Source: APXvYqw4+y5zVESvLeAXqBqA6KvWyd1EhUgYDu2r/zpu+8D2AliUIhgFqQXH6Gy1IvIew8m47r+2 X-Received: by 2002:a05:6402:1515:: with SMTP id f21mr6608914edw.224.1574846678045; Wed, 27 Nov 2019 01:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574846678; cv=none; d=google.com; s=arc-20160816; b=ibvXfu576xdidMsmvrYmSXiIcDveRrj/Hm/CXNx5hpYxWHDCF0sRUoZEnqkksrb1s8 TA7IP53XqEhBtvn2t7/Zx6qQyqig7M6/Z8ESOD73cjgDEIIZZLtI28jnHLzcClhnecf9 HWwtH6gBegZz1Vc878/CqupwnfJDKZsd1H+1xTs/EcZqRRRcqg0fOV774jIGaQ60vKIh RCMj81/PT/54ypRA6DzjDvi70mL8x5BYjjJmrUWBeIz/X4WC7/uandBsFz9AOTOuSHJB 8e4bRpLmbo32XtlHRrqghobBgm/sW4hovCn0Hq4pS/RSRAoDQ8MvdwaeEYmSDSdxBzND wNSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :dkim-signature; bh=ypRky3oyC95MxkzJoCc91EBdc4+T3C+DJLzgyr7TIcA=; b=jWDktulu8+FXThsaz0Qo+eT+Que9zvIaafNzH5Kr5LTCH5hmoF1yP7hqSuZcJrDbIu AlJHfu0ah24GA1Xd7NtocHKKMvgJq5ufzi18OIzvIPy7lFBSQpWu0s0sqM7n85O/rDdu R0pLHHW8HxrvnmFOfbJmCcNJR/wZqnUC93mati2dUT3vWy8buIanRbvmEgbS+NsvxWXr MCbvlFsg4hI+ZRRKr1xfReYyxqi2y69jan/ilejAuFR+6uva3uKZ9yHfQadaVYxUVGsO GCplzWD3esoJZOE0aKGn+6p7gvGJwZc7g0LyDjfa1s8K5Bt6xpLGmGnCRFtCt8bcBRyd uTVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=EPFRTqu7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si10879477edd.401.2019.11.27.01.24.13; Wed, 27 Nov 2019 01:24:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=EPFRTqu7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfK0JU1 (ORCPT + 99 others); Wed, 27 Nov 2019 04:20:27 -0500 Received: from esa6.hc3370-68.iphmx.com ([216.71.155.175]:57339 "EHLO esa6.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfK0JU1 (ORCPT ); Wed, 27 Nov 2019 04:20:27 -0500 X-Greylist: delayed 425 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Nov 2019 04:20:26 EST DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1574846426; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=9uuURIb8lrZNL/OMu7igvzdkxlazHa9ULxcdZfdQEJk=; b=EPFRTqu7qGE0PnTMBM61BMPiR89NpZMOBWQJBOI3Uk05xGnj7AVYD/oo kayMYYzU2Z7psgmhd5VaFrE+TxWSn5leyp9LMO3uWvHReSGlpFG9bhK5S hai5aVgeD3A1fwi0zz7DQbOUeJqyR2f5+Qvi9OSeSdBKjttJmXop4TOKO A=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 3w5d59L52Mn1fIy3qlLg2l1iAGFHhwnFM+YxEHAiihny2aU1k/iXW9X2fzLiyzswN46YEeyy82 MLt3NJLzRsx9IenYw0lON3SkfoO7Rl4dtAjrcoReZBPDbYWosP5elBiuth7JAsxXx7N1hOogoa jpZQ/nVMnSfxXiMEF9T2J1hEjRrA6zjwKijqesLels9WAo+D9IGxa6G5jMou7W8ZJ2Tmm9cv6h zHQFdo2MGJoFlqg0Mts+7CAI6B4pOEvFe6V8OzDi2yz9tcCcDnh9TGgZadpIwwi6p2q1fap1vA d8o= X-SBRS: 2.7 X-MesageID: 9306850 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,248,1571716800"; d="scan'208";a="9306850" Date: Wed, 27 Nov 2019 10:13:14 +0100 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: SeongJae Park CC: , , , , , SeongJae Park Subject: Re: [PATCH] xen/blkback: Avoid unmapping unmapped grant pages Message-ID: <20191127091314.GK980@Air-de-Roger> References: <20191126153605.27564-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191126153605.27564-1-sjpark@amazon.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 26, 2019 at 04:36:05PM +0100, SeongJae Park wrote: > From: SeongJae Park > > For each I/O request, blkback first maps the foreign pages for the > request to its local pages. If an allocation of a local page for the > mapping fails, it should unmap every mapping already made for the > request. > > However, blkback's handling mechanism for the allocation failure does > not mark the remaining foreign pages as unmapped. Therefore, the unmap > function merely tries to unmap every valid grant page for the request, > including the pages not mapped due to the allocation failure. On a > system that fails the allocation frequently, this problem leads to > following kernel crash. > > [ 372.012538] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001 > [ 372.012546] IP: [] gnttab_unmap_refs.part.7+0x1c/0x40 > [ 372.012557] PGD 16f3e9067 PUD 16426e067 PMD 0 > [ 372.012562] Oops: 0002 [#1] SMP > [ 372.012566] Modules linked in: act_police sch_ingress cls_u32 > ... > [ 372.012746] Call Trace: > [ 372.012752] [] gnttab_unmap_refs+0x34/0x40 > [ 372.012759] [] xen_blkbk_unmap+0x83/0x150 [xen_blkback] > ... > [ 372.012802] [] dispatch_rw_block_io+0x970/0x980 [xen_blkback] > ... > Decompressing Linux... Parsing ELF... done. > Booting the kernel. > [ 0.000000] Initializing cgroup subsys cpuset > > This commit fixes this problem by marking the grant pages of the given > request that didn't mapped due to the allocation failure as invalid. > > Fixes: c6cc142dac52 ("xen-blkback: use balloon pages for all mappings") > > Signed-off-by: SeongJae Park > Reviewed-by: David Woodhouse > Reviewed-by: Maximilian Heyne > Reviewed-by: Paul Durrant Reviewed-by: Roger Pau Monn? Thanks, Roger.